FreeRTOS configMINIMAL_STACK_SIZE

Some demos for FreeRTOS on the M0 MCU core are configMINIMAL_STACK_SIZE

set to 60 and some others to 70. Using STM32Cube software, it is set to 128.

My question is, what is actually the size of the MINIMAL stack?

In the STM32 Cortex-M0 programming manual, I see that the processor registers are R0-R12, MSP, PSP, LR, PC, PSR, ASPR, IPSR, EPSR, PRIMASK, CONTROL. Doesn't that mean MINIMAL is only 23 words long? Or is there any additional information that needs to be stored for the context switch?

+3


source to share


1 answer


As described here: http://www.freertos.org/a00110.html#configMINIMAL_STACK_SIZE , as far as RTOS is concerned, the constant does nothing more than set the stack size to the idle task being used.

The stack must be large enough to hold the context of the task, as well as any normal stack elements used by that task (local variables, overhead function calls, etc.), so the actual size required depends on what the task is idle - and will minimal if the idle task does nothing. If, on the other hand, an unused task hook function is used ( http://www.freertos.org/a00016.html ), then the required stack size will depend on what the hook function (its function call depth, etc.) ...



The constant is also used by demo tasks as a convenient way to use the same demo tasks on multiple architectures, but this does not affect RTOS, it is just demo code.

+2


source







All Articles