简体   繁体   English

如何确定嵌入式程序正在使用多少堆栈空间

[英]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. 该程序希望分析是否是代码编写器中的C程序,如果有区别的话。

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. 您可以用某种模式(例如0xDEADBEEF)填充堆栈ram,然后运行一段时间,然后检查堆栈以查看使用了多少内存。 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 . 有一个关于上运行TI网站上的静态分析工具,一些信息在这里 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. 通常,静态分析会告诉您main()的最深调用树使用了多少堆栈,但其中不包括ISR。 You need to manually look at the call tree and add in the ISR call depth. 您需要手动查看呼叫树并添加ISR呼叫深度。 If you have several priority levels of ISRS, don't forget that a higher priority ISR can interrupt a lower priority one. 如果您有多个ISRS优先级,请不要忘记,较高优先级的ISR会中断较低优先级的ISR。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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