Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

Stack usage in a task

Posted by Willem on November 9, 2008
What is the best way to determine how many stack I need to assign to a task?

RE: Stack usage in a task

Posted by MEdwards on November 9, 2008
Well you could try calculating it [max function call depth + plus max interrupt nesting depth + etc] but really trial and error is the best way. Start at [configMINIMAL_STACK_SIZE * 2], let the task run for a bit, then inspect the high water mark using http://www.freertos.org/uxTaskGetStackHighWaterMark.html and adjust as fit.

If the task does not get that far use http://www.freertos.org/Stacks-and-stack-overflow-checking.html to trap errors.

The new MPLAB and Eclipse plugins make this easier as they display the high water mark.

RE: Stack usage in a task

Posted by Willem on November 9, 2008
Ah, didn't know that kind of (powerfull) tools.

How about the plugin? I have the latest version (not beta) of MPlab.

RE: Stack usage in a task

Posted by Willem on November 9, 2008
*just curious, how big is the minimal_stack_size ? I mean, how many stacks can it contain?

RE: Stack usage in a task

Posted by MEdwards on November 9, 2008
It is sized so the idle task can run without crashing, but how big that has to be depends on the architecture. The idle task does not do anything so only requires a small stack.


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS