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

zliudr
Posts: 357
Joined: Thu Oct 03, 2019 5:15 am

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

Postby zliudr » Thu Aug 27, 2020 3:42 am

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!

Aussie Susan
Posts: 45
Joined: Thu Aug 22, 2019 3:48 am

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

Postby Aussie Susan » Thu Aug 27, 2020 3:44 am

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

zliudr
Posts: 357
Joined: Thu Oct 03, 2019 5:15 am

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

Postby zliudr » Thu Aug 27, 2020 3:48 am

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.

ESP_Sprite
Posts: 9308
Joined: Thu Nov 26, 2015 4:08 am

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

Postby ESP_Sprite » Thu Aug 27, 2020 7:53 am

Fwiw, you're probably looking for this.

Who is online

Users browsing this forum: Bing [Bot], MicroController and 142 guests