简体   繁体   中英

How to Determine how much stack space an embeded program is using

I am wondering what the best way to Determine how much stack space a program is using, are there any techniques or tools to generate the statistics, rather than counting by hand?

The program is hoping to analyze is a C program in code composer, if that makes a difference.

Thank you

You can fill the stack ram with some pattern (0xDEADBEEF for example) and then run for a while then examine the stack to see how much was used. You would still have to do the analysis to find the deepest paths, and then generate the deepest nested interrupts on top of that if it is ever possible in the application.

There is some info about running the static analysis tool on TI's website here . Generally, static analysis will tell you how much stack is used by the deepest call tree from main(), but it won't include the ISRs. You need to manually look at the call tree and add in the ISR call depth. If you have several priority levels of ISRS, don't forget that a higher priority ISR can interrupt a lower priority one.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM