PlatformIO Community

STM32L476 size of generated code

Hi all,

We recently migrated a big project from MBed online to Platformio, with an STM32L476RG as target (on nucleo and as standalone dedicated card), and we’re a bit confused as the application code grew from 220k to 247k.
Are there points to check on platformio configuration so that the code doesn’t grow like this ?
Despite the flash is 1MB wide on our application, it is mandatory that we use only 252k for the code, as the remaining space is used for data logging.

Thanks in advance for any kind of help

  • do a verbose compilation run pio run -v and copy the gcc/g++ compilation flags. Compare them to the output of the other tool.
  • generate a .map file (add build_flags = -Wl,-Map, to the platformio.ini) and use AMAP to compare this file to the .map file the other tool created. It will tell you how much of each resource (Flash & RAM) is used by each file / function.