Quality RTOS & Embedded Software

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



Posted by Nobody/Anonymous on February 8, 2006
Can you point me at some more information about the configMINIMAL_STACK_SIZE parameter? I am using the Philips LPC2103 with 8K of internal SRAM and for obvious reasons would like to minimize the amount used by the OS.


Posted by Richard on February 8, 2006
As with any program or function the amount of stack necessary is dependent on the number of local (stack)variables, the function call nesting depth, how library functions are used (like printf which is very stack hungry) and how interrupts use the stack. You can write your software to minimise stack usage if this is your priority.

The only place configMINIMAL_STACK_SIZE is actually used within the scheduler source code itself is to size the stack used by the idle task. However, in the demo projects it is also used to size the stack for the majority of the demo application tasks (in the demo/common directory). A consequence of this is that the demo application projects tend to set configMINIMAL_STACK_SIZE to a value greater than the scheduler itself actually needs.

You can define your application stack sizes to be whatever you want and tailor the size to each task. This would allow you to set the minimal stack definition to be smaller as it would only then be used by the idle task.

You can use the usTaskCheckFreeStackSpace() function (not in release code!) to see if you have enough wiggle room for your settings. Alternatively you can simple run the code in a debugger and check the stacks high water mask.

Remember that the stack has to be large enough for the context to be saved onto the stack by the scheduler.

FreeRTOS 4 should be available by the beginning of April. This has a new feature for stack limited systems.


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

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

Latest News

Version 10.1.0 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

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

Xilinx Microblaze and Zynq partner