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.

CC2340R5: How to combine mcuboot, persistent and oad-on-chip, and bootup from oad-on-chip?

Part Number: CC2340R5

For adding oad-on-chip function, I separate my app to three parts: mcuboot, persistent and oad-on-chip.

But this need load three apps, and set address. It's OK for develop, but not good for quantity production.

Is there have a way to combine three parts app to one, and after burn, it will start from oad-on-chip app?

  • Hello,

    Thank you for reaching out.

    In general, merging the projects might be difficult. However, you could consider merging the binaries provided by each of the projects before starting production. This way, you have only one image to flash from address 0x0. May I kindly ask if this would help?

    Best regards,

  • Hi ,

    my advice is to go here:

    srecord.sourceforge.net/

    and download this utility. If you're using Linux (like me, on a Ubuntu-based system, but should work more or less the same on other OSes), you don't need to download anything, just install the SRecord utility:

    sudo apt install srecord

    Let's assume that, instead of your custom application, you want to combine the files of the Basic BLE OAD Project (in the latest v7.40.00.64 SDK) that you have imported in your workspace. Then, after you have built both the basic_persistent_LP_EM_CC2340R5_freertos_ticlang and the basic_ble_oad_onchip_LP_EM_CC2340R5_freertos_ticlang examples, you can try this command (please notice your file paths can vary, this example assumes you have installed the SDK in your /home/<your_account>/ti/ directory and the workspace you're using is in /home/<your_account>/):

    srec_cat /home/<your_account>/ti/simplelink_lowpower_f3_sdk_7_40_00_64/examples/rtos/LP_EM_CC2340R5/ble5stack/hexfiles/mcuboot_onchip_LP_EM_CC2340R5_nortos_ticlang.hex -intel /home/<your_account>/<your_workspace>/basic_persistent_LP_EM_CC2340R5_freertos_ticlang/Release/basic_persistent_LP_EM_CC2340R5_freertos_ticlang.bin -bin -offset 0x00006000 /home/<your_account>/<your_workspace>/basic_ble_oad_onchip_LP_EM_CC2340R5_freertos_ticlang/Release/basic_ble_oad_onchip_LP_EM_CC2340R5_freertos_ticlang.bin -bin -offset 0x00032000 -o /home/<your_account>/<your_workspace>/basic_ble_oad_onchip_LP_EM_CC2340R5_freertos_ticlang/Release/basic_ble_oad_onchip_LP_EM_CC2340R5_freertos_ticlang_production.hex -intel

    The memory layout derives from the Readme at:

    file:///home/<your_account>/ti/simplelink_lowpower_f3_sdk_7_40_00_64/examples/rtos/LP_EM_CC2340R5/ble5stack/basic_ble_oad_onchip/README.html

    This will give you a single hex file that you can now flash.

    Of course, remember to add the MCUBoot image header to the application file (in this example, the basic_ble_oad_onchip_LP_EM_CC2340R5_freertos_ticlang.bin), by adding the lines as Post-Build steps in Properties > Build that are described in:

    file:///home/<your_account>/ti/simplelink_lowpower_f3_sdk_7_40_00_64/docs/ble5stack/ble_user_guide/html/oad-mcuboot/imgtool.html

    Bear in mind that, in the basic_ble_oad_onchip_LP_EM_CC2340R5_freertos_ticlang example, the slot size in the second of such lines is 0x4A000, while in the BLE5 Stack doc it is larger (0x4C000). Seems like the current persistent example (which I think should be used as a guideline) size is larger than when they wrote the doc. In the example Readme, they flash the non-persistent app starting at 0x32000 rather than at 0x30000 where it should belong (the following NVS slot for bonding starts at 0x7C000), according to the BLE5 stack documentation memory map, perhaps taking this difference into account. Maybe a competent TIer can comment on this discrepancy in the documentation, or I'm just getting it all wrong myself.

    This file chaining method works for me (using the persistent app from the example and changing the memory offsets accordingly) with my custom on-chip-OAD-enabled custom application, I hope it does for you as well.

    Kind regards,

    Stefano

  • In general, merging the projects might be difficult. However, you could consider merging the binaries provided by each of the projects before starting production. This way, you have only one image to flash from address 0x0. May I kindly ask if this would help?

    Yes, this is OK for me.

  • srec_cat /home/<your_account>/ti/simplelink_lowpower_f3_sdk_7_40_00_64/examples/rtos/LP_EM_CC2340R5/ble5stack/hexfiles/mcuboot_onchip_LP_EM_CC2340R5_nortos_ticlang.hex -intel /home/<your_account>/<your_workspace>/basic_persistent_LP_EM_CC2340R5_freertos_ticlang/Release/basic_persistent_LP_EM_CC2340R5_freertos_ticlang.bin -bin -offset 0x00006000 /home/<your_account>/<your_workspace>/basic_ble_oad_onchip_LP_EM_CC2340R5_freertos_ticlang/Release/basic_ble_oad_onchip_LP_EM_CC2340R5_freertos_ticlang.bin -bin -offset 0x00032000 -o /home/<your_account>/<your_workspace>/basic_ble_oad_onchip_LP_EM_CC2340R5_freertos_ticlang/Release/basic_ble_oad_onchip_LP_EM_CC2340R5_freertos_ticlang_production.hex -intel

    Thank you Stefano Romano Di Segni, I tried this, and it works.