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 overflow by given a specified value

Dear all,

 

Now we got an unexpected illegal trip, and we got a stomach feeling that can be a stack overflow.

And we have studied the TI stack monitor (Stack Supervision (spra820).pdf), but it looks takes time.

We hope we can fill a specified data to stack, and check the stack value when we got a halt at illegal_ISR function.

How to do by CCS v3.3? This is the environment  we prefer. 

BR LH

  • Before you use stack much (start of the main() or in startup.asm), fill "top section" (1/8 of the stack area) of the stack with some pattern(0xDEAD). This section can be monitored periodically to see if the stack ever grown into to this "guard" area. When you hit illegal trap verify that the guard area is intact to rule-out stack ov.

    In CCS you can fill this stack space (mem fill) before you hit run.

     

  • Dear Joson,

     

    Excuse me, I never use this function, mem fill, before. Please let me know how to find out the function inside of CCS3.

     

    BR LH

  • Hi Li-Hsiu

    first edit linker command file to generate appropriate symbols e.g.

    /* STACK */
        .stack:     >       D_M1,
                            RUN_START(_stack_start),
                            RUN_END(_stack_end),    
                                                PAGE = 1

    Then add following line to the .gel file to the "OnFileLoaded" function

        GEL_MemoryFill(stack_start,1,stack_end-stack_start,0xBEEF);

    This should automate the procedure

    I still recommend that you use stack monitor as it can be quite helpful in pinpointing who exactly is filling the stack

    Best regards, Mitja