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.

"CSTACK" error in CC2640 with sensor-tag application and code

Other Parts Discussed in Thread: CC2640, CC2650

Hello friends,


I am using my custom board having CC2640.
I am able to debug as well as program it with SimpleBlePeriphral (default code)
I am able to scan this on my laptop.

But when I compile sensor tag code for CC2640,it is getting compile.
I can download stack and code without any error.

But when I start running application in debug mode it is showing me below warning.


Sat Oct 10, 2015 19:06:51: Loaded macro file: C:\Program Files\IAR Systems\Embedded Workbench 7.2\arm\config\debugger\

TexasInstruments\CC26xx.dmac
Sat Oct 10, 2015 19:06:51: Loaded macro file: C:\Program Files\IAR Systems\Embedded Workbench 7.2\arm\config\flashloader\TexasInstruments\FlashCC26xx.mac
Sat Oct 10, 2015 19:06:51: Connecting to TI XDS100 (Probe no: 06EB12212A94)
Sat Oct 10, 2015 19:06:56: TI XDS ARM, device revision: 0x00000001, big endian: false, cache: false, board revision: 0x00000000, driver revision: 0x0B020200
Sat Oct 10, 2015 19:06:56: Initial reset was performed
Sat Oct 10, 2015 19:06:56: Watchdog disabled
Sat Oct 10, 2015 19:06:56: 544 bytes downloaded (3.77 Kbytes/sec)
Sat Oct 10, 2015 19:06:56: Loaded debugee: C:\Program Files\IAR Systems\Embedded Workbench 7.2\arm\config\flashloader\TexasInstruments\FlashCC26xxRAM20.out
Sat Oct 10, 2015 19:06:56: Target reset
Sat Oct 10, 2015 19:07:00: Unloaded macro file: C:\Program Files\IAR Systems\Embedded Workbench 7.2\arm\config\flashloader\TexasInstruments\FlashCC26xx.mac
Sat Oct 10, 2015 19:07:00: Downloaded C:\ti\simplelink\ble_cc26xx_2_01_00_44423\Projects\ble\SensorTag\CC26xx\IAR\Application\CC2650\FlashOnlyOAD\Exe\SensorTagAppFlashOnlyOAD.out to flash memory.
Sat Oct 10, 2015 19:07:05: Watchdog disabled
Sat Oct 10, 2015 19:07:09: 44305 bytes downloaded into FLASH (3.41 Kbytes/sec)
Sat Oct 10, 2015 19:07:09: Loaded debugee: C:\ti\simplelink\ble_cc26xx_2_01_00_44423\Projects\ble\SensorTag\CC26xx\IAR\Application\CC2650\FlashOnlyOAD\Exe\SensorTagAppFlashOnlyOAD.out
Sat Oct 10, 2015 19:07:09: Target reset
Sat Oct 10, 2015 19:07:18: The stack pointer for stack 'CSTACK' (currently 0x20002DB8) is outside the stack range (0x20004058 to 0x20004458)
Regards,
Hiren Shah
  • Hello Hiren,

    This warning is usually benign. You can check the actual System Stack (CSTACK in IAR, Program.stack in CCS) usage by following the guidance in the BLE SW Developer Guide (SWRU393).

    Best wishes
  • Hello JKS,

    We have modified in appble.cfg , program.stack = 512 to 1024.

    Still we are facing same issue.

    We were able to run same code on CC2650DK.

    Regards,
    Hiren Shah
  • For IAR the CSTACK is set in the linker file and the Program.stack variable is not used. Still, the original sensorTag project does not require any modification to this.

    Did you compile both the stack and the application and uploaded both? What behavior do you see when running the program? Do you ever get to main().

    The sensorTag code will for example exit the application task if it fails to run a startup check on the external flash. Search for Task_exit and make sure you don't end up in those cases as the sensorTag HW and your HW is probably not 100% equal. (?)

    Svend
  • Hello Svend,

    I have complied both stack and application. stack and application are compiled without any error and they are downloaded in flash as well.(first stack then application )

    but when I debug application it is going till BIOS_start(); through single step execution.

    but after that when I hit run button and hold debugger after some time,debug log show me below message.

    The stack pointer for stack 'CSTACK' (currently 0x20002DB8) is outside the stack range (0x20004058 to 0x20004458).

    I have removed FACTORY_IMAGE from project option -> C/C++ compiler -> processor -> define symbols.I am not downloading BIM project in to flash.

    My hardware is different then sensor tag hardware but I can still verify my hardware with CC2650EM and smartRF06 board ( putting my boards cable  to jumper settings on smartRF06 board).

  • Hi Hiren,

    When you see this, has the application stopped working? The CSTACK is only used by main() and interrupts, the tasks are using their own stacks but IAR might not understand that.
    Without providing more details of your issue it is not possible to suggest what might be the issue.

    Regards,
    Svend
  • Hi Svend,
    I see this message in debug mode, running the application and halting after some time.
    And what more information you required?
    Please specify so that I can provide it.
    Can I share my code or specific file ?
  • Hiren,

    Does the application work as expected? If so I think you can safely ignore this warning.

    Regards,
    Svend
  • Hi Svend,
    Application is not working as expected.
    Program counter is running at some random location when I halt debugger, as after running the code, there is no output from BLE.
    And when I check debug log it is showing CSTACK warning.
  • Details like that the application is not working are fairly important to mention.
    - Where is this random program counter location when the CPU is running?
    - Can you post an assembly view of the code running?
    - Have you looked at the TI RTOS plugin to check program state (in IAR it is enabled under debugger settings -> Plugin).
    --Goto BIOS->Scan for errors once it has crashed to see what might be wrong.
    --Check all Tasks. The SensorTag application will using Task_exit if many of the HW checks failed as previously mentioned.

    In many cases you are in a CPU exception and the config file have not defined a custom exception handler (you will see the program counter at 0x1001xxxx). See Chapter 9.8 in the BLE software developers guide for details on how to find the reason for an exception.

    Regards,
    Svend
  • Hi Hiren,

    Can you solve the warning of CSTACK and your Application task work? Please tell me how to solve I am also facing same warning.

    Regrads,
    Rajneesh