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.

CCS/LAUNCHXL-CC2640R2: How to modified the FLASH_BASE to 0x1000

Part Number: LAUNCHXL-CC2640R2
Other Parts Discussed in Thread: CC1350, CC2640R2F, BLE-STACK, SYSBIOS, CC2650, CC2640

Tool/software: Code Composer Studio

I want to build a custom boot loader project.

The boot loader code be allocated to flash 0x0000 to 0x1000 address, and the application code (based on "multi_role" project build with CCS use the SDK simplelink_cc2640r2_sdk_1_40_00_45) allocated to flash 0x1000 to 0x20000 address.

I 'm successed on the CC1350 according :https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz/f/156/t/605674

But how to do with the CC2640R2F?

Thanks!

LN

  • Hi LN,

    The fundamental changes are the same, you will need to update the linker file and adjust the TI-RTOS configuration file (like in the other thread you linked).

    A side note, I would advice you to use the latest SDK for development (version 2.30).
  • Hi M-W,

    Thanks for your help!

    i only find the "linker.cmd"and there is no ddefine about FLASH_BASE in it.

    i aslo can't find the "cfg" file .

    cloud you tell me where these two files?

    and how to change it,like step1,step2...

    my project:

  • Hi,

    The linker file is found in the "TOOLS" folder, the "cfg" file is in the same folder.

    I would suggest you look over the documentation that exist for the BLE-stack and OAD, it contains a lot of information regarding the BIM used here:

    dev.ti.com/.../

    dev.ti.com/.../
  • Thanks,

    i find the "cc26xx_app.cmd" file,and change the config:
    __UNUSED_FLASH_start__ = 0x1000;//0x0;
    __UNUSED_FLASH_end__ = 0x1FFFF;

    i also find the "app_ble.cfg" ble5stack/.../../..

    what else should i to change?(such as vector table in FLASH )

    i read the linker you posted,but find nothing about how to modified the flash base and vector table base.




    Best regards,

    LN
  • Hi LN,

    I suggest you read the comments in the file, the "__UNUSED_*" defines is only for ROV purpose and do not affect flash placement. The FLASH base is defined at the top.

    The exact changes you need to perform depends on what you need in the end, but moving the vector table to the correct location is a good start.

    A follow up question on this, why can't you use the existing OAD offering for the BLE-Stack and develop on top of that?
  • Hey M-W,

    i just want my bootloader allocated to flash 0x0000 to 0x1000 address, and the application code allocated to flash  0x1000 to  0x20000 address.nothing else.

    i know must to change the flash start and the m3Hwi.resetVectorAddress to 0x1000.

    when use 13xx,i change the code as "red code",and it works well.

    1. cmd file: Change FLASH BASE & SIZE:

    #define FLASH_BASE 0x1000

    #define FLASH_SIZE 0x1F000

    2. cfg file: Change reset vector to the same address

    /* Put reset vector after RCFG pointers */

    m3Hwi.resetVectorAddress = 0x1000;

    3. cfg file: use BIOS from default in ROM to in Flash.

    Reason is that when using BIOS from ROM it demands certain code lays at fix addresses in FLASH on first flash page. (Which is the same page that we want our boot to lay in. )

    /* ================ ROM configuration ================ */

    /*

    * To use BIOS in flash, comment out the code block below.

    */

    /*

    var ROM = xdc.useModule('ti.sysbios.rom.ROM');

    if (Program.cpu.deviceName.match(/CC26/)) {

    ROM.romName = ROM.CC2650;

    }

    else if (Program.cpu.deviceName.match(/CC13/)) {

    ROM.romName = ROM.CC1350;

    }

    */

    but the CC2640R2F is so different , i can find the define of the "FLASH BASE" in the "cc26xx_app.cmd" and change it:

    #define FLASH_BASE     0x00001000  //0x00000000


    According to this description:

    but i can't find the "m3Hwi.resetVectorAddress"in the app_ble.cfg file:4062.app_ble.cfg

    could you tell me where the "m3Hwi.resetVectorAddress" or how to  change the resetVectorAddress?

    about why we can't use the OAD:

    1.There are so many devices(with different MCUS such as STM32,CC25/26XX ,EFM32...)connect by a BUS  in systerm ,

    every device must follow the same communication protocol.

    2.This project development and the test have been completed. We don't want to make any changes, because the re-

    test work will take us a lot of time.

    Thanks!

    LN

  • Hi LN,

    The CC2640R2F is basically the same as the CC13XX devices and requires the same steps. However, the BLE-Stack have a rather complex configuration structure which makes it hard to find all the parts you are looking for.

    If you look close at "app_ble.cfg", you can see that it imports two additional configuration files. You are looking for the "cc2640_r2_csdk.cfg" file which contains most of the configurations (the heap part is split into another one).
    The exact path of this file is <SDK DIR>/source/ti/blestack\common\cc26xx\kernel\cc2640\config.

    As the .cfg file is parsed from top to bottom, you can "overwrite" an previous value by re-assigning it further down. That means that you can simply add "m3Hwi.resetVectorAddress = x" following the "utils.importFile("common/cc26xx/kernel/cc2640/config/cc2640_r2_csdk.cfg");" line to overwrite what ever value that file will set.

    It might be interesting to look into the "Bluetooth OAD" examples and how the linker files look in this case. They typically use the end of the flash for the bootloader which means there is no collision with the ROM. In the BLE case, you REALLY want to use the ROM as the amount of available flash is tight even with ROM.

    If you look at how the TI BIM does it, it uses the CCFG field "SET_CCFG_IMAGE_VALID_CONF_IMAGE_VALID" to change the entry point to the to the end of flash, where the BIM takes over after the ROM bootloader is done bringing up the device.
  • Hi M-W,

    1. i change the "cc26xx_app.cmd" as:

    #define FLASH_BASE   0x1000//0x00000000

    2. change the  "cc2640_r2_csdk.cfg":

    /* Put reset vector at start of Flash */

    if (typeof OAD_IMG_A != 'undefined' && OAD_IMG_A == 1)

    {

     m3Hwi.resetVectorAddress  = 0x0010;

    }

    else if (typeof OAD_IMG_B != 'undefined' && OAD_IMG_B == 1)

    {

     m3Hwi.resetVectorAddress  = 0x7010;

    }

    else if (typeof OAD_IMG_E != 'undefined' && OAD_IMG_E == 1)

    {

     m3Hwi.resetVectorAddress  = 0x0010;

    }

    else

    {

     m3Hwi.resetVectorAddress  = 0x1000;//m3Hwi.resetVectorAddress  = 0x0;

    }

    3.use BIOS from default in ROM to in Flash:

    /*

    if (typeof NO_ROM == 'undefined' || (typeof NO_ROM != 'undefined' && NO_ROM == 0))
    {
    var ROM = xdc.useModule('ti.sysbios.rom.ROM');
    if (Program.cpu.deviceName.match(/CC26/)) {
    ROM.romName = ROM.CC2640R2F;
    }
    else if (Program.cpu.deviceName.match(/CC13/)) {
    ROM.romName = ROM.CC1350;
    }
    }
    */

    and then i rebuild the project, error occurr:

    "C:/ti/simplelink_cc2640r2_sdk_1_40_00_45/source/ti/ble5stack/common/cc26xx/ccs/cc26xx_app.cmd", line 242: error #10264: FLASH_LAST_PAGE memory range overlaps existing memory range FLASH

    it is realy complex compare to the CC1350. 

    so frustrating.

    Thank you for your help.

     

    Best regards,

    LN

     

  • Hi LN,

    This is due to the definition of FLASH_END. Go to #define FLASH_END (FLASH_START + FLASH_SIZE - RESERVED_FLASH_SIZE - 1) and remove the "FLASH_START" part, this should allow you to link using your settings.