Quality RTOS & Embedded Software

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




Loading

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 ]    [ 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