tool to calculate task stack size

davdav
Posts: 208
Joined: Thu Nov 17, 2016 2:33 pm

tool to calculate task stack size

Postby davdav » Fri Aug 31, 2018 1:45 pm

Hi everybody,

I wonder if there is a tool based on .elf, .bin and .map after compilation and linkage which can calculate the stask size required by a task.

Around the forum when people ask about "stack overflow" the answer is typically: "try increase until you don't get "stack overflow"".

Any insight on this can be usefull.

Thanks

User avatar
urbanze
Posts: 301
Joined: Sat Jun 10, 2017 9:55 pm
Location: Brazil

Re: tool to calculate task stack size

Postby urbanze » Fri Aug 31, 2018 1:50 pm

You can try analyze individual stack with High Water Mark: https://www.freertos.org/uxTaskGetStack ... rMark.html

Or using xTaskGetInfo() to see all stacks (HighWater Mark) together, you need active some settings in menuconfig to use this: https://www.freertos.org/vTaskGetInfo.html

davdav
Posts: 208
Joined: Thu Nov 17, 2016 2:33 pm

Re: tool to calculate task stack size

Postby davdav » Fri Aug 31, 2018 2:10 pm

Thanks @urbanze,

I already use High Water Mark feature but it requires to flash and run the program. And you have to be sure to test cover all the branch program flow of the task.

I'm looking for an "offline" tool (if it exists) to use without downloading firmware to device. Something which says "Hey, the task XXX will crash for stack overflow" after I have compiled the program. I guess it can leverage on files genereted by the compiler/linker..

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Re: tool to calculate task stack size

Postby fly135 » Fri Aug 31, 2018 2:37 pm

davdav wrote:I'm looking for an "offline" tool (if it exists) to use without downloading firmware to device. Something which says "Hey, the task XXX will crash for stack overflow" after I have compiled the program. I guess it can leverage on files genereted by the compiler/linker..
Probably not going to find that. The tool would have to be able to parse the C/C++ code and intelligently look at all the local variables stored on the stack in a function. Then it would have to traverse into all the called functions and do the same. As soon as the tool hit a call into a function that was binary only with no source available it would fail to accurately compute stack requirements.

John A

davdav
Posts: 208
Joined: Thu Nov 17, 2016 2:33 pm

Re: tool to calculate task stack size

Postby davdav » Fri Aug 31, 2018 2:47 pm

Exactly @fly135, you resume what was my sentiment. Your explanation about "binary only" functions makes sense and therefore stopped my hope.. Thanks

Who is online

Users browsing this forum: Majestic-12 [Bot], SegmentationFault and 121 guests