cancel
Showing results for 
Search instead for 
Did you mean: 

"Ram overflowed by...": CubeMX generated code is too bloated for STM32L011G4?

Johannes Hofmann
Associate II

Hello Community,

I'm a newly user and have a custom PCB.

Now with having set up the Cube IDE I'm struggling that I can't compile just the code like it came out of the CubeMX's code generator.

Can you give me a hint to start?

I already set the compilers optimization for size and varied the min heap and min stack variables, but no improvement.

If the code really is too big, is there any option how to reduce it's size in CubeMX?

Best regards,

Hannes

4 REPLIES 4

Yes, 16KB FLASH is pretty tight.

I'm building HAL based code into them.

Watch for the floating point library.

Check for initialized memory, if things are constant make sure they like in FLASH, and not both FLASH and RAM

Trick might be to tell linker it has more resources, so it can get closure on what you're trying to build,and then figure out whose eating all the memory resources via the .MAP file

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
S.Ma
Principal

As said Clive, this stm32 flavor is tight in memories. Maybe the stack size needs to be optimized. The map file wilk tell you the memory cost of each object file to know where to optimize. If your code needs compiler optimisation to fit, debug witg breakpoints will be painful down the road....

For ram l, " union " is your friend....

Semer CHERNI
ST Employee

Hello @Johannes Hofmann​ 

I advise you to check first the memory detail in the Build Analyzer.

Also you can try using the LL library.

Finally if it is possible could you send me the IOC file or the project for further analysis.

Kind regards,

Semer.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Semer CHERNI
ST Employee

Hello @Johannes Hofmann​ 

Did the previous replies helped to resolve the issue?

Kind regards,

Semer.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.