They stopped bundling the hardware package for the Due (Arduino SAM Boards) in recent versions of the Arduino IDE but it's quite easy to install it:
- Tools > Board > Boards Manager
- Wait for downloads to finish.
- Click on "Arduino SAM Boards".
- Click "Install".
- Wait for installation to finish.
- Click "Close".
There has been a lot of development on the Arduino IDE since 1.5.7 so you might find it useful to update but the choice is yours of course.
As for the compiler options. These are set in the file platform.txt. Each hardware package has its own platform.txt so you will notice there is one for Arduino AVR Boards and another for Arduino SAM Boards. In your Arduino IDE 1.5.7 installation you will find the Arduino SAM Boards platform.txt at {Arduino IDE instatallation folder}/hardware/arduino/sam/platform.txt.
To make changes to the flags you can edit that file directly. The Arduino IDE only scans platform.txt on startup so you need to close all Arduino IDE windows and then start the IDE again before changes you make to platform.txt will take effect.
There are also some options to add custom compilation flags without editing platform.txt.
You can create a file named platform.local.txt and in that file define any of these properties:
- compiler.c.extra_flags
- compiler.c.elf.extra_flags
- compiler.cpp.extra_flags
- compiler.ar.extra_flags
- compiler.elf2hex.extra_flags
You can examine platform.txt to see exactly where those properties will be expanded in the compilation recipes. For example:
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -mcpu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {compiler.libsam.c.flags} {includes} "{source_file}" -o "{object_file}"
The same requirement of restarting the IDE applies for platform.local.txt.
There is also the possibility to pass these properties from the command line if you're using the Arduino IDE CLI. For example:
arduino --pref compiler.cpp.extra_flags=-O0 --upload --board arduino:sam:arduino_due_x_dbg foobar.ino
Unfortunately it's only possible to do this when compiling from the command line. You can't set the compiler flags as used by compilation in the Arduino IDE GUI from the command line.
More information on the Arduino IDE CLI: