cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 Cubeide Code Generator uses More Program Memory

NM
Associate III

Hello Team,

We have been using the STM8 series for the low level Application projects. Due to Obsolete of the STM8, we have been moved to STM32C0 chips. But we are facing a problem with the program memory which the code generator occupies more space only for the Simple ADC, GPIO, Timer Initializations. We used 8KB chips in STM8 series for the same application. Now we changed to STM32C011F4P6 chip 16KB chip. This STM32 Cube IDE code generator itself takes the 75% of the memory for simple Initialization. Please help me out of this problem and provide a solution to it. 

 

Kind Regards,

Nishanth M

1 ACCEPTED SOLUTION

Accepted Solutions

What optimisation level are you using?

Try at least 'Optimise for Debug'

AndrewNeil_0-1727264517979.png

 

View solution in original post

5 REPLIES 5

What optimisation level are you using?

Try at least 'Optimise for Debug'

AndrewNeil_0-1727264517979.png

 

TDK
Guru

HAL is not designed with small memory footprints in mind. The most you can do is increase your optimization settings for size.

If you feel a post has answered your question, please click "Accept as Solution".
NM
Associate III

Hi,

Thanks for the support... :)

What are difference between the Optimization levels for the -O0, -Og, -O1, -O2, -O3, -Os, -Ofast. What is the pros and cons of these optimization levels. Is this will affect the any other part of the code. When are these levels used? 

 

 

Kind Regards,

Nishanth M. 

See the GCC documentation:

https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html

 

Another thing you can do is use the code generator to get you started and then, if you need to, go through the code manually to see what can be pruned out ...