Dear frined: I have many function calling in my program, and i want to know if it has some side-effect such as tack lost or overflow ? TKS Morris
You could fill the top few bytes of the stack space with a certain value at the beginning of main(). Run the program trying to exercise the most deeply nested functions then take a look at the top of the stack to see whether it has been used. Don't forget that interrupts, if you have any enabled, will asyncronously increase stack usage. Stefan
"I have many function calling in my program" It's not the total number of functions that matters - it's what you do with 'em! Specifically, how deeply your calls get nested.
Dear friends: Thanks for all your replying. My program has 6 or 7 nested calling . Does it exist any way to check if my MCU could run normally rather than use Debugger to see the stack value. Thanks again.
Unless your functions are declared "reentrant", 6 to 7 levels of call hierarchy almost certainly won't pose a problem.
You can read the value of the stack pointer and output it (without using the debugger). Jon
Dear friends, thank you . Well, can you introduce me where can I get the document involved the knowledge you said? I mean , where or how do you absorb in this kind of knowledge? I don't remember ever read this kind of knowledge in textbook. Thank you again.