Platformio.ini stm32duino build flags for optimization? (smallest / fast / faster / fastest)

Hi there, I’m wondering if there are build flags to optimize just like the ones I see in Arduino → tools-> optimize.
I’ve seen this for Teensy but not for stm32duino. Is this implemented?
Captura de pantalla 2022-04-06 a las 9.41.40

LTO maps to the flag -flto. The default optimization flag is -Os (small code).

You can change the optimization flag by doing a build_unflags = -Os (gets rid of the default) and then build_flags = <new flags here> (docs), e.g., -O3 -flto.

thanks a lot for your help!
I get lost surfing the documentation,
where are the -O3 -flto and similar flags detailed?

These are GCC compiler flags, see Optimize Options (Using the GNU Compiler Collection (GCC)), or more high-level, Code Size Optimization: GCC Compiler Flags | Interrupt.

1 Like