Reducing ststm32 core size for arduino framework

I am developing a project on the stm32F103C8 MCU and am running into the 64kB flash memory limit for it. I used the inspect function to check the size of my code, and figured out that of the total size roughly 57% is occupied by the arduino ststm32 framework. Now I use one other big library (for lorawan) that takes another 25%. So together those don’t leave me much room. I am ok for now, but getting close to the limit. So I am wondering if there are any optimizations I can do on the ststm32 core to limit its size. Are there any compile flags for instance that allow me to exclude certain code that I don’t need anyway?

PIO lists available configurations for STM32DUino in ST STM32 — PlatformIO latest documentation. There are few options regarding e.g. newlib-nano as the C library.

For more in depth answers, I think the authors of GitHub - stm32duino/Arduino_Core_STM32: STM32 core support for Arduino can give you a better one than us when you open an issue there, it’s their core after all.

1 Like