How to get free continuous stack size using esp-idf

mmmunir966
Posts: 12
Joined: Tue Feb 08, 2022 2:02 pm

How to get free continuous stack size using esp-idf

Postby mmmunir966 » Thu Sep 01, 2022 9:03 am

Hi,

I am looking for esp-idf function that can provide the availabke stack size just like it provides heap size using

Code: Select all

heap_caps_get_free_size()
I could find the way of determining the stack size of a freeRTOS task using

Code: Select all

xPortGetFreeHeapSize()
, however I want to know the total stack size available at any given point in any task?

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

Re: How to get free continuous stack size using esp-idf

Postby ESP_Sprite » Thu Sep 01, 2022 9:29 am

You probably want uxTaskGetStackHighWaterMark.

mmmunir966
Posts: 12
Joined: Tue Feb 08, 2022 2:02 pm

Re: How to get free continuous stack size using esp-idf

Postby mmmunir966 » Fri Sep 02, 2022 7:14 am

Code: Select all

uxTaskGetStackHighWaterMark
This function provides free stack of the current task or the task of which the handler is passed, but I want to know the total available stack from all the tasks?

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

Re: How to get free continuous stack size using esp-idf

Postby ESP_Sprite » Fri Sep 02, 2022 12:09 pm

Can I ask why you would want that number? Given that stacks are dynamically allocated from the heap on task creation and the total amount of unused stack doesn't really have any meaning, I'm puzzled what information you'd be able to derive from that number.

Who is online

Users browsing this forum: No registered users and 331 guests