Page 1 of 1

How do I investigate the stack of a task to make sure there's enough space?

Posted: Thu Aug 27, 2020 3:42 am
by zliudr
I have a number of tasks each with an assigned stack, basically an arbitrary size, such as 8K, 16K etc. I would like to have a way to find out how their stacks are being used when they are making deep calls especially calls to library functions that I didn't write and don't know how they consume the stack. Is there a standard tool or library to make this happen? Thank you!

Re: How do I investigate the stack of a task to make sure there's enough space?

Posted: Thu Aug 27, 2020 3:44 am
by Aussie Susan
I assume you are referring to the some RTOS stack - most have a function you can call to tell you the maximum used to that point in the execution. You will need to refer to the documentation of the RTOS you are using.
Susan

Re: How do I investigate the stack of a task to make sure there's enough space?

Posted: Thu Aug 27, 2020 3:48 am
by zliudr
Susan,

Thank you! So do you mean that RTOS keeps track of stack usage and I just have to call a function to return the max stack depth? Sounds very convenient! I'm used to programming microcontrollers without any type of operating system support. Maybe I should start chipping away at the RTOS doc.

Re: How do I investigate the stack of a task to make sure there's enough space?

Posted: Thu Aug 27, 2020 7:53 am
by ESP_Sprite
Fwiw, you're probably looking for this.