cancel
Showing results for 
Search instead for 
Did you mean: 

How does the compiler optimization level affect the performance and memory usage of STM32 applications?

TAlbe.1
Associate

How does the compiler optimization level affect the performance and memory usage of STM32 applications?

3 REPLIES 3
AScha.3
Chief II

...depends very much on the type of core and the code. 

and on optimizer setting; you have to try, to see what its doing with your code.

i tested on M4 core, stm32F303 :

set /toggle a pin in a while loop; at 72MHz, needs 260ns. with optimizer (-O2) 65ns.

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

The way a computer program is optimized when it is being made can affect how fast and efficiently it runs on STM32 microcontrollers. If the program is optimized more, it can run faster and use less memory, but it might also take longer to make and be bigger in size. The level of optimization needed depends on what the program is supposed to do, and it's a trade-off between how fast it runs, how much memory it uses, and how long it takes to make. It's important to test the program with different levels of optimization to find the best balance for the specific needs of the program.

S.Ma
Principal

This is a compiler 101 type question, not really specific to any ARM core even.

Reading an [e]book is probably a more effective way to understand how compiler works and why they have the best for speed/size options.

Back in 2000, Microsoft was introducing a new windows operating system, and developping application was with VisualStudio MFC. Originally, the bit type was uint32_t... few years later is became a true single bit in memory....