Hallo
I wonder if there are any good methodes of calculating the stack size for ex user or IRQ stack size? Is there any "best practice"?
Or is it just add up the size of data structures and/ot ISR's??
/Thomas
some libraries require a minimum (RL-ARM, for example). generally, the best you can do is: * calculate exactly what the stack usage of every function is and all possible paths to it. better automate this, and you can make us of the statistics generated by the tool-chain. * use pre-inserted markers in the stacks themselves to follow stack usage overtime. * catch stack overflows by monitoring. * more...?
eg, http://www.keil.com/support/man/docs/armcc/armcc_cjaiidcg.htm
Sorry for that I don't understand Step-5. http://www.keil.com/support/man/docs/armcc/armcc_cjaiidcg.htm
4. Examine, after your application has finished executing, the stack area of memory to see how many of the known values (zeros or 0xDEADDEAD) have been overwritten. The stack shows garbage in the part of the stack that has been used and zeros or 0xDEADDEAD values in the remainder.
5. Count the number of known entries and multiply by eight. This shows how far the stack has grown in memory in bytes.
If, after Step-4, I find that, it uses 200 Bytes stack space;
and my application is very simple as below.
void main(void) { while(1) { func1(); func2(); func3(); } } void func1(void) { int var; // dummy; } void func2(void) { int var; // dummy; } void func3(void) { int var; // dummy; }
What is the value of "the number of known entries"? 3 (3 functions) or 200 (200 Bytes Stack Space).
And why should multiply by eight? Why not 2 or 4 or 10?
And what is the proper setting for stack space? 200 bytes, or 200*3 bytes, or 200*8 bytes, or something else?
Could someone please teach me? Many Thanks.
View all questions in Keil forum