This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

C55x Stack and System Stack Questions



All:

I am using the C5505. Some questions on Stack and System Stack. Here is a paragraph from a 55x workshop:

"The C55x contains two stack pointers: SP and SSP. The SP is the normal User Stack that contains the lower 16 bits of the return address (for calls or interrupts). It also holds the values of any values pushed onto the stack. The System Stack (SSP) is a special-purpose stack that only contains the upper bits of the return address for calls and interrupts. The user does not usually access the system stack because it does not contain any pushed data. Once the user sets up the system stack, it is best to leave it alone."

Questions:

1. When allocating space for Stack and System Stack, should they be given the same amount of memory?

For instance, if Stack is given 0x400, should System Stack be given the same amount?

2. When there is a need to increase stack size, does the System Stack also need to be increased?

Regards,

Todd Anderson

  • If using "32-bit stack with slow return" mode: the two stacks should be the same size.  This mode is intended for C54x compatibility only. If you don't have C54x code in your C55x program, you shouldn't be using this stack mode.

    If using "Dual 16-bit stack with fast return" or "Dual 16-bit stack with slow return" mode: the two stacks may be different sizes.  The size requirement for .sysstack (SSP) is typically much smaller than for .stack (SP).  The exact ratio depends on the nature of your program.

  • Thank you - by the way, we are using DSP/BIOS - does that environment set up the mode for use of stacks?

    It appears that the default stack size is 0x400 for Stack and 0x100 for System Stack.

    If the stack size is increased to 0x600, does the System Stack also need to be increased by a similar size, say 0x100 --> 0x180?

    Regards,

    Todd Anderson

  • I'm sorry, I don't know how DSP/BIOS interacts with C55x stacks.

    There is no requirement for system stack and stack to be in any particular proportion, except for "slow return" mode, where they should be of equal size.

    Whether or not system stack needs to be increased depends on your particular program.   The system stack usually doesn't have to be very big at all; it should be approximately proportional to your maximum call depth.  The stack should be that same size plus enough room for the maximum total size of local variables at any call depth.  There's no way to estimate that without examining each individual program.

  • As the FAE supporting Todd, I'd like to know how we get an answer that takes into count the usage of sys/bios.  Do we need to repost this over in the sys/bios forum?

    Thanks,

    Stuart

  • Stuart Baker said:
    Do we need to repost this over in the sys/bios forum?

    Yes