2026-04-07 7:10 AM
I'm building a (relatively simple) application with STM32C011F6J6 using HAL for managing onboard peripherals. I believe moving some of the I/O code to LL or "bare metal" (direct register manipulation) would help reduce flash demand - 32K byte budget - but would like target these efforts.
Is there a way (perhaps using the linker that's part of STM32CubemX) to get a memory map telling me how much flash is occupied by each function call?
Thank you
Solved! Go to Solution.
2026-04-07 7:23 AM - edited 2026-04-07 7:27 AM
CudeIDE has the Build Analyser for this:
https://www.st.com/resource/en/user_manual/dm00629856.pdf#page=125
The map file will be in your Projects 'Debug' folder - called <project-nake>.map
PS:
Apart from HAL, other big users of Flash include:
2026-04-07 7:23 AM - edited 2026-04-07 7:27 AM
CudeIDE has the Build Analyser for this:
https://www.st.com/resource/en/user_manual/dm00629856.pdf#page=125
The map file will be in your Projects 'Debug' folder - called <project-nake>.map
PS:
Apart from HAL, other big users of Flash include:
2026-04-07 7:31 AM
Thank you Andrew - I had been using "release" configuration (to reduce flash demand), hence no debug folder activity (that I was seeing, anyway), so that provides a helpful path forward!
Am not using much C library stuff... A possible culprit - not yet looked at memory map, but from prior experience - may to be in USART handling (the application is doing only very rudimentary serial I/O, no need for buffering, etc.), want to quantify HAL USART usage among other possible candidates before diving in.
Thanks again for the quick/helpful reply!
2026-04-07 8:08 AM
I guess it would be called 'Release', then ?
Note that there's nothing to stop you editing the 'Debug' configuration to use a different optimisation setting.
I always use -Og - see: https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-Og