Calculation of stack sizes...

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

Parents Reply
  • 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?

Children
More questions in this forum