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.

Compiler/msp430g2553: IAR version 6.40

Part Number: MSP430G2553

Tool/software: TI C/C++ Compiler

Hi all.

I have programming msp430 via IAR 6.40 version.
And I have an error message in code, thats performed during performance of the work many times:


void LCD_ShowLong( signed long val, unsigned char xCoord, unsigned char yCoord, bool isClearToEndOfLine )
{
  unsigned char resMas[lcdColCount];
  unsigned char *res = &resMas[0]; //fatal error
...
}


, and one time it causes an error message with caption "Driver": "Fatal Error: Plain pointer ShrAssisn Session aborted!".
And the debug log says "The stack pointer for stack 'Stack' (currently Memory:0x396) is outside the stack range (Memory 0x3B0 to Memory 0x408)", so I have increase the stack size (General Options -> Stack/Heap -> "Stack size" and "Data16 heap size") up to 100, thats have no any effect.

Please help!

  • given this design, if you don't check lcdColCount at runtime against the amount of stack currently available youll forever be at risk of blowing the stack.

    I suggest it is best to make resMas[] a static with a size that can be determined at compile time, or perhaps use malloc() in the function if you can or so desire ( I don't know how well  IAR compiler handles the function ), or in any case do something that will not involve a lot of stack space.

    so islcdColcount actually a const, or in any case a value that will never be particuallry large?

  • Jeff Hastings, thanks for answer.

    The lcdColCount is a define-constant:
    #define lcdColCount 16

    And I have transform the code to the:

    void LCD_ShowLong( signed long val, unsigned char xCoord, unsigned char yCoord, bool isClearToEndOfLine )
    {
    #define lcdColCount_tmp 16
    unsigned char resMas[lcdColCount_tmp];
    unsigned char *res = &resMas[0]; //fatal error too

    ...

    }

    - the result is the same fatal error message too [with caption "Driver" and text "Fatal Error: Plain pointer ShrAssisn Session aborted!"].
  • you have not solved the root problem.
    hint : keyword 'static'

**Attention** This is a public forum