Stack depth and Stack usage calculation - TC Boards

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User21707
Level 2
Level 2
First like received
Hi !!

The scenario is as such, I am using Tasking compiler 6.2r2 and TC375TP and have access to both on-chip debugger and trace32 debugger.

I want to calculate 2 things -
1. Worst case stack depth i.e I have an API that I know has a max number of calls and functionality. For this particular API, I need to calculate the stack depth (worst-case stack depth). How to do it?

2. I had got this link for IFX - SDA,
but there isn't any link/source to download. Can anybody please help with the setup? And will this help me fulfill my requirement mentioned in #1?

3. [A general query] Is stack depth a number i.e the number of function calls, and stack usage is the consumed byte on the stack? or both are the same terminologies used synonymously?

Please don't suggest THIS.
This isn't what I am looking for.

Thanks !!!
0 Likes
2 Replies
NeMa_4793301
Level 6
Level 6
10 likes received 10 solutions authored 5 solutions authored
I equate "stack depth" and "stack usage". The number of function calls isn't nearly as important as the local variables allocated by each function. So, it's entirely possible that the deepest level of your application's call tree might not be the worst case stack depth.

I don't know of any better method than the old school standby of:
- Fill the stack with a known pattern like 0x55555555, 0xC0CAC07A, 0xDEADBEEF, etc.
- Let your application run for a few seconds and do what you can do ensure every code path is executed
- Look at the stack in a debugger and see how much of the known pattern remains

Your SDA link is to an ancient Tasking tool that was developed for the ancient TC17xx.
0 Likes
User21707
Level 2
Level 2
First like received
UC_wrangler wrote:


Your SDA link is to an ancient Tasking tool that was developed for the ancient TC17xx.


Hi Wrangler,

1. Is there any other tool that can help me with this requirement ?
2. And when you say to check in the debugger, are you mentioning looking at the A10 register or something else other than that? Because if in case of context switching, the A10 register value will reset once context switch happens. So what is
the plan in that scenario then?

Thanks !
0 Likes