Are optimize flags possible

Hello,

I’m new with trying the PlatformIO and the IDE.
I made a blink-a-led project targeting two MBED devices, the lpc1768 and the nucleo_f031k6, which worked amazingly well.
Now I know that the MBED libraries are not very efficient, just a blink a led takes up 12K on the nucleo, which has 32K of flash. But I can’t find if I can add the -Os or -O2 flag so that the compiled optimises the code, making the blink a led a bit smaller then 12K.

Is it possible to add those flags somewhere?

Best regards,

Rik

Please take a look at build_flags and build_unflags.

Build PIO project in verbose mode using $ pio run --verbose and check the current optimization level. Then add it to build_unflags and new optimization level to build_flags. For example, platformio.ini

[env:myenv]
platform = ...
board = ...
build_flags = -O2
build_unflags = -Os
1 Like