-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Task stack size... how much? #1884
Comments
This is an ESP-IDF issue, not arduino. RTFM at https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/system/freertos.html and https://www.freertos.org/a00111.html. |
|
I see, my mistake then, many thanks. |
My app is running LoRa and OTA on a separate core from my main logic. Do any of you know if the OTA update size will affect the stack size required? |
I am experimenting with multitasking on ESP32 using Arduino IDE and I have a question about stack size when creating tasks with xTaskCreate or xTaskCreatePinnedToCore functions.
Is there a way to calculate how much stack is needed?
According to https://www.freertos.org/uxTaskGetStackHighWaterMark.html I have tried to determine the maximum stack size effectively used by my task and noticed that if I lower the value of the stack size when I create the task, then the value returned by uxTaskGetStackHighWaterMark lowers too.
As an example I created a task with stack size = 4000, max stack used was 3700.
So I edited the progam and lowered the stack size to 3800, started the program and uxTaskGetStackHighWaterMark reported 3600 max stack used.
Repeated the procedure and everytime the used stack size was Always lower according to the stack size parameter of xTaskCreate function.
So, how do I determine the minimum required stack size? (If I am correct it's 1024)
Do I have to lower it and check until I get a stack overflow error?
Thanks in advance for support.
The text was updated successfully, but these errors were encountered: