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.

TMS570LS3137: about stack problem

Part Number: TMS570LS3137

 Hello

 Team 

How to check stack overflow?Do  need to do it myself?

How distribution relationship between stack and ram be set? 

How can I allocate space  of stack and ram.

 Thank you 

  • Hello,

    The stack memory is typically used in the following constructs:

    1. On function calls to save register content (such as the link register (LR) for the return address)

    2. Local function variables are stored on the stack when no CPU registers are available.

    3. For interrupt service (ISR) execution, the registers are store on the stack.

    You should perform the analysis of the stack usage to determine how big the stack should be set for your application.

    The Stack Usage View in Code Composer Studio (available in CCS 6.2 and higher) provides a static view of stack usage for your application. The information is generated on project build and displayed as a function call tree with stack usages for each function in a horizontal bar graph. 

    In CCS project linker configuration, you can set the stack size. 

    Please get more helpful information from this user guide:

  • Here is the stack usage view in CCS:

  • Hello

    QJ

    Thank you

    The stack usage view in CCS is good .I thought the size of the stack in the program,that could not be known.

    Do  I need get all Inclusive size Column Add myself,that can get the all stack size

    OR ,the map file STACKS  is the size

    name origin length used unused attr fill
    ---------------------- -------- --------- -------- -------- ---- --------
    VECTORS 00000000 00000020 00000020 00000000 X
    FLASH0 00000020 0005ffe0 00016962 0004967e R X
    STACKS 08000000 00003c00 00003c00 00000000 RW
    RAM 08003c00 00003800 00002499 00001367 RW
    PROFILE 08007400 00001000 00000000 00001000 RW
    LOG 08008400 00000400 00000000 00000400 RW
    FEE f0200000 00000064 00000064 00000000 R deadbeef

    I have the another question. If the stack have the error,whether the CPU can automatically identify error, and trigger something.

    Or I test the stack myself.How do I test the stack.The safety certificate company ask me this question.

  • Hello,

    You need to add all the values up. The stack size in map file is what you define in linker cmd file: staring address, and length. It is define where the stack is located. The _coreInitStackPointer_() in sys_core.asm defines stack size for each mode, and --stack_size in CCS linker option should match the total size defined in _coreInitStackPointer_() function.

    When stack is overflow, you will get an unexpected error.

  • Hello 

    QJ

     Is there some way to test the stack overflow

  • Decrease the stack size, or add more local variables in your function or increase the array size of your local variable array.