PlatformIO Community

Gcc speed-up possibilities?

With special thanks to @maxgerhardt I successfully moved my MSP430 project from IAR to platformIO. Now it seems like the code runs much slower when compiling with GCC compared to the code execution speed compiled with the IAR compiler. I already tried the -O1, -O2 and -O3 build_flags within platformio.ini without any significant improvement in speed (size does differ though). Am I missing other options to get the speed up?


---- some related background -----

@maxgerhard thankfully helped me to write a custom bootloader (see MSP430F5529 BSL memory). I now can also address the entire memory of the MSP430F5529 (see MSP430 use all 128kB (not just 47kB)). Also this site is related MSP430F5521 (instead of MSP430F5529).

Have you used the project task Clean and “Advanced → Verbose Build” to verify that a GCC command only has -Os (or the optimization flag you set), and not some e.g. old flag (or none at all)? Remember to build_unflags = -Os in the platformio.ini as that is the default level, then build_flags = -O3 or whatever you need.

Do you have a specific example of (small or mid-size) function that is slow? Then we can disassemble the object file that IAR and GCC output and see why it might be slower. Are the slow functions e.g. using floating point math?