Understand and monitor the stack for system reliability


Nov 2, 2021

The stack is a fixed block of continuous memory and has to be allocated statically by the developer. It can contain interrupt contexts and local data like variables and parameters for C/C++ functions, which are not stored in registers among other information. The main advantage of stack is that functions in different parts of the application can share the same memory space to store their data.

A proper configuration of the stack is essential to your system stability and reliability. If the stack size is too small, an overflow situation could occur. On the other hand, setting the stack size too large means a waste of RAM resource, which could be very limited in MCU-based embedded systems. The handling of the stack is one of the major challenges for embedded software developers. A good practice is to employ static stack usage analysis and runtime stack usage tracking.

On top, it is recommended to take advantage of guarding against stack overflow with the use of stack canaries (stack protection).

Watch on-demand webinar

If you are interested in learning more, watch our on-demand webinar.

Det här innehållet finns tyvärr inte på svenska.

Vår webbplats finns främst på vårt koncernspråk engelska, förutom det innehåll för investerare som vi är lagstadgade att kommunicera på svenska. Vi rekommenderar att du besöker vår globala webbplats på engelska för att få en bättre upplevelse.

Vi stöder inte längre Internet Explorer. För att få bästa möjliga upplevelse av iar.com rekommenderar vi att du uppgraderar till en modern webbläsare som Chrome eller Edge.