Calculate stack sizes for FreeRTOS
Calculate stack sizes for FreeRTOS
Hi, I wanted to know if there is a criterion or function to calculate the correct stack size for a FreeRTOS task for ESP32 (Arduino framework). Thank you.
-
- Posts: 9746
- Joined: Thu Nov 26, 2015 4:08 am
Re: Calculate stack sizes for FreeRTOS
Not per se; the easiest way is to assign a stack size that is generous to the stack, then run the program while periodically printing out uxTaskGetStackHighWaterMark() to see how many stack bytes remain unused. Make sure you get the program through most use cases so you can be pretty sure that number is the absolute maximum the stack will ever use. Then lower the stack assigned to the task by that value, plus a few hundred byte as buffer if there's a situation you missed.
Re: Calculate stack sizes for FreeRTOS
Ok, thanks, much simpler than I thought.
Who is online
Users browsing this forum: MicroController and 84 guests