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.

IAR 5.30 Stack overflow with MSP430F4152

Other Parts Discussed in Thread: MSP430F4152

Hi:

   now I am using IAR v5.30 to debug MSP430F4152. I had set the stack size to be160 bytes and I am sure that it is enough. But when I debug with FET, if I run code in full speed and exit debug, IAR said that stack overflowed. But if I break debug first, and then exit debug, no "stack overflow" msg appear. Are there others meet the same problem? Can anybody tell me why? Thanks.

 

  • the overflow warning basically means that when breaking execution, the stack pointer has a value lower than the configured threshold.
    This may or may not be a problem, as this threshold is a pure organizational value. Your binary file won't change when you alter this threshold. Only if you set it so high that tyour static  and global variables won't fit into ram anymore, you'll get a linker error. (which if you could ignore it would still lead to exactly the same code ffile and maybe no problems at all).

    It is possible that teh debugger has a problem here. When the CPU is nitialized, the stack poitner contains 0, which is definitely below the threshold. When you now let the processor run, it will be initialized and all is well. But the debugger doesn't knwo this, so when exiting, it still sees the old '0' value and thinks this is the current one and issues a warning. If you break execution befre leaving, the debugger iwll update the value to the current value and see that everything is well.

    Just an idea of what could be the reason, no athoritative answer.

  • Got it. Thank you very much.

**Attention** This is a public forum