cancel
Showing results for 
Search instead for 
Did you mean: 

Need memory map - STM32C011F6J6 project - built with HAL, using too much flash

wb0gaz
Senior

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
Andrew Neil
Super User

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:

  • printf
  • floating-point
A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

View solution in original post

3 REPLIES 3
Andrew Neil
Super User

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:

  • printf
  • floating-point
A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

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!

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

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.