Quality RTOS & Embedded Software

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


Stack overflow while using max stack depth

Posted by nateslager93 on October 21, 2016

I have a task that is created with max stack depth 256kb (max value for data type short = 65535) . But it is still overflowing. I cannot alter the task to use less ram. Is there a way to increase stack depth beyond this for freertos v.8.2.3 (only version supported by Xilinx)? Note that xTaskCreateStatic (which takes in 32 bit stack depth field, instead of 16) isn't availabe before freertos v9.0.0.

Stack overflow while using max stack depth

Posted by rtel on October 21, 2016

The data type dates back a number of years, and for backward compatibility can't be changed - although as you point out the newer function doesn't have the same issue. You will not encounter any problems if you simply edit the code to make it a uint32_t though. Don't forget to edit the prototype in task.h too.

It won't help you know, but I will change this so the data type is instead a macro that defaults to uint16_t for backward compatibility, but can be overridden by defining the macro in the FreeRTOSConfig.h file.

I suppose another option would be to find the path in your code that is using so much stack, and see if you can instead allocate the memory from the heap (remembering to give it back again at the end of the function, of course).

Stack overflow while using max stack depth

Posted by nateslager93 on October 27, 2016

Thank you! This worked!

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

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

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 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