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.

Why a loop or a pointer causes XDATA memory full

Other Parts Discussed in Thread: CC2430

HI buddies,

I am encountering a very strange problem in IAR 7.30B, when building a project for a CC2430 chip. 

 

In project 'test04_lcd_hangzhou' in the attachment, such code in function Print8 cause XDATA almost 100% filled at building time.
>
    uchar * p = pstr; 
<

If such lines are commented, XDATA usage drops tremendously, from 3870 to 6 bytes.

It is the same case for lines in ClearRAM function. If following code is not commented, XDATA is fully filled  when building the project.
>
    for (i = 0; i < 8; i++)
    {
        SendCmd(i|0xb0);
        SendCmd(0x10);
        SendCmd(0x00);
        for (j = 0; j < 132; j++)
        {
            SendData(0);
        }
    }
<

NOTE: xdata stack is set 0xEFF in project options.

Reference: ./test04_lcd_hangzhou 4670.test04_lcd_hangzhou.zip

  • Why do you need such a huge XDATA stack (0xEFF)? Unless you expect some really deep nesting, I would reduce the stack size to e.g. 256 or 512 bytes.

    BTW, I tried to compile your code in IAR EW8051 v7.60 (with all patches), and had to reduce the stack size in order to build successfully. I used the default linker file (which gives you a total of 4kB XDATA), code model near (i.e. max 64kB flash) and large memory model with "calling convention" set to "XDATA stack reentrant".

    Once built, I didn't see any huge difference by commenting out the code you mentioned. Of course, the whole ASCIITAB array won't be included if you remove references to it in your Print8 function. That should only affect the code space, though.

    I would recommend that you reduce the stack size.

  • Hi M,

    Thanks for your help.

    The huge XDATA stack size 0xEFF is the default value when the project is created. I tried to change this value to 0x100(256B), the same warning message still appears:

        Fri Sep 30 16:41:56 2011: The stack 'XdataStack' is filled to 100% (256 bytes used out of 256). The warning threshold is set to 90.%
        Fri Sep 30 16:42:16 2011: The stack 'XdataStack' is filled to 100% (256 bytes used out of 256). The warning threshold is set to 90.%

    And my application still fails to run correctly :(