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.

Help with warning: The stack 'XdataStack' is filled to 100%

Other Parts Discussed in Thread: CC2540

Can I ask another question (probably connected with flash issues) -
what's the best way to increase XDataStack in order to avoid
regular warnings like:

>The stack 'XdataStack' is filled to 100% (832 bytes used out of 832). The
>warning threshold is set to 90.%

these regularly entail mistakes in firmware functioning.

Regards,
Evgeny.

  • It looks like you are trying to debug with power savings enabled: POWER_SAVING is defined. Either undefine that in the project --> options --> compiler defines or make an OSAL Task block power saving with a call to osal_pwrmgr_task_state().

    The debugger is supposed to handle all PM modes but PM3, but it gets flaky, especially if you stop when in a PM - it seems you can never run normal again and have to reset and re-run. So when debugging, it is just easier to turn it off.

    Remember to turn it back on before running from batteries ;)

  • I'm afraid problem is not in the compiler settings (removing POWER_SAVING doesn't help anyway)  -

    likely it is in memory arrangement - - compilation render following result:

    >Error[e104]: Failed to fit all segments into specified ranges. Problem discovered in segment XDATA_N. Unable to place 2 
    >block(s) (0xc02 byte(s) total) in 0x573 byte(s) of memory. The problem occurred while processing the segment placement 
    >command "-P(XDATA)XDATA_N=_XDATA_START-_XDATA_END", where at the moment of placement the available 
    >memory ranges were "XDATA:198d-1eff"

    Can I safely remove/extend these restrictions? Or probably there is some reason for it in the CC2540 keyfob having at least 128 kB of memory??

  • XDATA is your RAM - only 8K of that; it is not the 128K or 256K, depending on chip version, of flash - so you have added a lot of variables to make it too big to fit into SRAM.

     

  • so the only way is to slash variables or to store them in flash?

  • SO, is there a workaround for this, if I want to declare more than 8kB of data.  What's the way to store it in flash?

  • Hi ishnanaveen,

    You might want to use the osal_snv api. You can find documentation for this in "BLE-CC254x-1.2\Documents\osal\OSAL API.pdf".
    Keep in mind that flash is limited in rewrites, if you can do so, it would be a good idea to keep the variables that change often in RAM, saving the flash for mostly static data.