ChibiOS/RT Logo ChibiOS/RT

Architecture - Reference Manual - Guides

Stacks and stack sizes

In an RTOS like ChibiOS/RT there are several dedicated stacks, each stack has a dedicated RAM space that must have a correctly sized assigned area.

The stacks

There are several stacks in the systems, some are always present, some others are present only in some architectures:

Risks

The most critical thing when writing an embedded multithreaded application is to determine the correct stack size for main, threads and, when present, interrupts.
Assigning too much space to a stack is a waste of RAM, assigning too little space leads to crashes or, worst scenario, hard to track instability.

Assigning the correct size

You may try to examine the asm listings in order to calculate the exact stack requirements but this requires much time, experience and patience.
An alternative way is to use an interactive method. Follow this procedure for each thread in the system:

Final Notes

Some useful info:


Generated on Sun Nov 28 2010 14:09:56 for ChibiOS/RT by doxygen 1.7.1