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.

RTOS/CC2640R2F: CC2640R2F: RAM Memory allocation

Part Number: CC2640R2F
Other Parts Discussed in Thread: CC2640

Tool/software: TI-RTOS

I am using "simplelink_cc2640r2_sdk_1_50_00_58" and loaded the "simple_peripheral_oad_onchip" project.

When I integrate my project (from CC2640), I start to have issue with adding new Task.

Later I discovered related to the SRAM I have in my project.  When I increased to certain level, BLE will start to fail (not connected)

Where I could find a doc explaining how the SRAM being design (mapped) for all builds (BIM, persistent_app, BLE_stack, UserApp) ?

I had reviewed the map files for each and did not noticed where is the over lapped 

Problem start when Unused in UserApp < 0x1000.....is the last 4KB being reserved somewhere ??

BLE_Stack :

name origin length used unused attr fill
---------------------- -------- --------- -------- -------- ---- --------
FLASH 00000000 00014000 00007000 0000d000 R X
SRAM 20000000 00004400 000001e0 00004220 RW X

UserApp :

name origin length used unused attr fill
---------------------- -------- --------- -------- -------- ---- --------
FLASH_IMG_HDR 00000000 00000050 00000050 00000000 R X
ENTRY 00000050 00000040 0000003c 00000004 R X
FLASH 00000090 0000d090 0000a2f0 00002da0 R X
SRAM 20000000 00004220 000030f0 00001130 RW X

 

  • Can you check if you are running out of heap?
    You can take a look at our software user's guide-->debugging-->debugging common heap issues
  • Very strange, just for test, when I modify the RAM start for Stack project, in both files "ccs_linker_defines.cmd" & "ccs_compiler_defines.bcfg"

    /** --define=ICALL_RAM0_START=0x20004220 */

    --define=ICALL_RAM0_START=0x20004600

    In the map file, it stay the same

    20004220    20004220    000001e0   00000000    rw-

  • Can you try to perform the heap debugging and let's see if that can give us more information?
  • I can reproduce the issue by just increase the global variable space (from TI release code) and looks like it will crash with Stack somewhere.

    In main.c :

    //volatile uint8 testBuf1[4800];    // OK - up to 4800
    volatile uint8 testBuf1[5000];      // ERROR

    int main()
    {

    .....

    // Force compiler to include variable
    testBuf1[0]=1;
    if (testBuf1[0])

         SimpleBLEPeripheral_createTask();

    .....

    }

    BLE would not able to connect once it reach ~5KB

     

    But from the map file, it looks OK.  Since I have not add any real code, it should not be the Heap, more RAM memory map issues.

    For Apps map file :

    MEMORY CONFIGURATION

    name origin length used unused attr fill
    ---------------------- -------- --------- -------- -------- ---- --------
    FLASH_IMG_HDR 00000000 00000050 00000050 00000000 R X
    ENTRY 00000050 00000040 0000003c 00000004 R X
    FLASH 00000090 0000a090 0000924c 00000e44 R X
    SRAM 20000000 0000406c 00003160 00000f0c RW X

    20002f95 g_hwiInt
    20002f96 heapStart
    20003c68 __stack
    20003c68 heapEnd
    20004068 __STACK_END
    20004068 __STACK_TOP
    20004f80 eccRom_param_Gx
    20004f84 eccRom_param_Gy

    For Stack map file :

    SEGMENT ALLOCATION MAP

    run origin load origin length init length attrs members
    ---------- ----------- ---------- ----------- ----- -------
    00013000 00013000 00001000 00001000 r-- .snvSectors
    2000406c 2000406c 00000394 00000000 rw-
    2000406c 2000406c 00000354 00000000 rw- .data
    200043c0 200043c0 00000040 00000000 rw- .bss

  • I believe in this case you are running out of heap. Please take a look at our software user's guide section Debugging-->Debugging Common Heap Issues
  • Oh, thanks...I just noticed that heapStart is not Static but Dynamic according to available RAM.