Created Sun, 05 Jun 2011 20:56:25 +0000 by jasonk
Sun, 05 Jun 2011 20:56:25 +0000
Currently, mpide is configured to call the compiler with the -O2 optimization option. The -O2 set of optimization usually results in a nice balance between code size and speed.
However, there are some instances where you want to sacrifice code size (use more FLASH memory) in order to get more speed. Luckily, Rick has introduced features in mpide that makes changing the default compiler options easy to change.
To change the optimization level:
Optimization levels
For example:
pic32.compiler.c.flags=-O3::-c::-mno-smart-io::-ffunction-sections::-fdata-sections
pic32.compiler.cpp.flags=-O3::-c::-mno-smart-io::-ffunction-sections::-fdata-sections
If you really want aggressive performance for your sketch, you could also add the -funroll-loops option. Note that this option almost always increases code size but it may or may not increase performance.
For example:
pic32.compiler.c.flags=-O3::-funroll-loops::-c::-mno-smart-io::-ffunction-sections::-fdata-sections
pic32.compiler.cpp.flags=-O3::-funroll-loops::-c::-mno-smart-io::-ffunction-sections::-fdata-sections
For more information on platforms.txt, see Rick's post here.