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.

STACK OF C6472

Hello,

I have some questions regarding the stack of C6472 processor:

1) What is the address from where the stack starts? It seems to me by default the B15 regsiter contains 0x00801FFF. Am I right? In that case is it the starting point of the stack?

2) Is the stack relocatable?(By overwriting the B15 register)

3) Can only the B15 register be used to point the stack or some other register can be used?

Regards,

AC.

  • AC,

    The C compiler uses B15 to hold the stack pointer, you can define in the cmd file where you want to have the stack section (.stack >L2MEM) and the size (-stack 0x800), the stack address is set at link time,  if you are writing an ASM sw than you can change it,

    You can find more information regarding the stack in spru187,

    BR,

    HR

  • Thank you HR for your informative reply........ "stack address is set at link time"..... wow!!!

     

    Regards,

    AC.

  • To add to HR's statements, DSP/BIOS or any O/S will change the stack from time-to-time. Each BIOS task will have its own stack, while other BIOS entities will use the system stack.

    Also, as you will find in reading the document HR mentioned above, the stack pointer in B15 must always be 8-byte-aligned, meaning it should never have the value of 0x00801FFF.

    Regards,
    RandyP

  • Thanks RandyP for the answers. Does the 8-byte-aligned stack is thought of in order to load/store 64 bit words if necessary? In that case if a task written in assembly uses only 32 bit data then can it manage its own stack portion by 4-byte-aligned arrangement? Or is it better to go for the generalized doubleword arrangement always?

    Regards,

    AC

  • AC,

    Somewhere in the C Compiler User's Guide, it says that the stack pointer SP must always be 8-byte aligned. Always. That means do not increment it by 4 then increment it by 4 again or even decrement it by 4. Maybe The User's Guide explains why this is the case somewhere, or maybe it is explained somewhere in the forum or on a Wiki page. But it is a firm requirement. If you do not do this, you can assume you will spend time trying to track down a hard-to-find bug in your code.

    Regards,
    RandyP

     

    If this does not answer your question, please tell us more. If it does, please click the  Verify Answer  button, below.

  • Thanks RandyP for your answer.

     

    Regards,

    AC.