Anyone knows if uVision can register the maximum stack usage in
debug mode?.. Is very useful to run the code in the target and then
check the maximum usage of the stack in any moment in order to be
safe about the size. Perhaps anyone knows a better way to calculate
This is easy to accomplish.
Fill the stack area with a known pattern (0xDEADBEEF or whatever) at
your program initialization in the code or using debug macros. Run
the program for a while. Inspect stack area to see how much of the
pattern was overwritten (can be automated as well.)
hehe... very good solution, I will do that, but, I think the
debuger can do it wihtout need to write code to fill it.
I think the debuger can do it wihtout need to write code to
I agree. That would be useful functionality to have.
The method described can be quite a useful indicator, but remember
when you look at the stack after your run don't assume it is the
absolute maximum use, because it may not be. It is the use of a run
up to that point. The absolute maximum would be the result of worst
case nestings and might only occur infrequently.
Any such test should be done togeter with a code coverage analysis
- what parts of the code was executed?
Another thing to remember is that some processors have a unified
stack also including interrupts. So knowledge about the used
processor is needed.
View all questions in Keil forum