Stack overflow while using max stack depth

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

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

Thank you! This worked!