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.

CC1354P10: Assistance Needed: MCUBoot Samples Not Working Correctly on TI RTOS

Part Number: CC1354P10
Other Parts Discussed in Thread: LP-XDS110, UNIFLASH, SYSCONFIG

Tool/software:

Dear TI Community,

I am new to TI RTOS and I'm trying to get the MCUBoot samples running, but I am encountering issues that I haven’t been able to resolve. I would appreciate any guidance or troubleshooting steps to help me get the samples working correctly.

Environment Description:

  • Board: CC1354P10 with LP-XDS110 Programmer
  • SDK Version: simplelink_cc13xx_cc26xx_sdk_8_30_01_01
  • Development Environment: Windows 11 with CCS Studio 20.0.2.5__1.6.2 (I am not using CCS_20.1.0.00006_win due to it requiring an update to my XDS110 Programmer which makes the board unable to flash)

Setup Description:

 I enabled trace in MCUboot (mcuboot_LP_EM_CC1354P10_1_nortos_ticlang).

  • For this I copied trace.c, trace.h, and itm_private.h to local project.
  • I enabled Power TI Driver in mcuboot.syscfg.
  • I changed Upgrade Mode to Overwrite
  • I edited trace.c as follows:
        ITM_config itm_config =
        {
          48000000,
          ITM_115200     //was ITM_3000000 
        };
  • I changed image addresses as follows to accommodate increase in bootloader size due to trace:
    • bootloader base: 0x00000000; bootloader size: 0x00008000
    • Primary image base: 0x00008000; Primary image size: 0x0002B000
    • Secondary image base: 0x00033000; Secondary image size: 0x0002B000

MCUBoot_Blinky Description:

Post build steps:

${CG_TOOL_ROOT}/bin/tiarmhex -order MS --memwidth=8 --romwidth=8 --intel -o ${BuildArtifactFileBaseName}.hex ${BuildArtifactFileBaseName}
${CG_TOOL_ROOT}/bin/tiarmobjcopy -O binary ${BuildArtifactFileBaseName}.out ${BuildArtifactFileBaseName}-noheader.bin --remove-section=.ccfg


${COM_TI_SIMPLELINK_CC13XX_CC26XX_SDK_INSTALL_DIR}/tools/common/mcuboot/imgtool sign --header-size 0x80 --align 4 --slot-size 0x2b000 --version 1.0.0 --pad-header --pad --key ${COM_TI_SIMPLELINK_CC13XX_CC26XX_SDK_INSTALL_DIR}/source/third_party/mcuboot/root-ec-p256.pem ${BuildArtifactFileBaseName}-noheader.bin ${BuildArtifactFileBaseName}.bin


${COM_TI_SIMPLELINK_CC13XX_CC26XX_SDK_INSTALL_DIR}/tools/common/mcuboot/imgtool sign --header-size 0x80 --align 4 --slot-size 0x2b000 --version 2.0.0 --pad-header --pad --key ${COM_TI_SIMPLELINK_CC13XX_CC26XX_SDK_INSTALL_DIR}/source/third_party/mcuboot/root-ec-p256.pem ${BuildArtifactFileBaseName}-noheader.bin ${BuildArtifactFileBaseName}.p2.bin

I updated mcuboot_blinky_cc13x4_cc26x4.cmd as follows to match increase in bootloader size from 0x6000 to 0x8000:

#define FLASH_BASE  0x8080
MCUBOOT_HDR_BASE  = 0x8000;
Important Note: Even if I change FLASH_BASE to 0x9000, the app works once and fails upon a board reset.

Questions:

  • When I erase entire flash and program only MCUboot_blinky or oad_samples, the first MCUboot partition is empty however the sample still runs. Why does this app still run?
  • Also why does the App always fail to run after a board reset. It fails to run even if MCUboot is flashed and addresses correctly (I believe it to be correct, I could be mistaken).
  • When using Upgrade_Mode = Overwrite, I get the following output:

[INFO][MCB ]: mcuboot_app
[ERR ][MCB ]: assert: C:/ti/simplelink_cc13xx_cc26xx_sdk_8_30_01_01/source/third_party/mcuboot/boot/ti/source/mcuboot_app/flash_map_backend/f
[ERR ][MCB ]: assert: C:/ti/simplelink_cc13xx_cc26xx_sdk_8_30_01_01/source/third_party/mcuboot/boot/ti/source/mcuboot_app/flash_map_backend/f
[INFO][MCB ]: Image index: 0, Swap type: none
[INFO][MCB ]: bootRsp: slot = 0, offset = 8000, ver=1.0.0.0
[INFO][MCB ]: Starting Main Application
[INFO][MCB ]: Image Start Offset: 0x8000
[INFO][MCB ]: Vector Table Start Address: 0x8100

  • When using Upgrade_Mode = XIP, I get the following output:

[INFO][MCB ]: mcuboot_app
[INFO][MCB ]: Primary slot: version=1.0.0+0
[INFO][MCB ]: Secondary slot: Image not found
[INFO][MCB ]: Booting image from the primary slot
[INFO][MCB ]: bootRsp: slot = 0, offset = 8000, ver=1.0.0.0
[INFO][MCB ]: Starting Main Application
[INFO][MCB ]: Image Start Offset: 0x8000
[INFO][MCB ]: Vector Table Start Address: 0x8100

  • Why does Overwrite produce an assert error whilst XIP doesn't?

In Summary:

May someone please provide insights as to how I can get started with MCUBoot with TI RTOS. At this stage I just want to load MCUBoot, and have the blinky sample still load upon a board_reset.

Any assistance would be truly appreciated.

Kind Regards

Brenton

  • Hi Brenton,

    Thank you for the detailed post. I will try answering your questions.

    • When I erase entire flash and program only MCUboot_blinky or oad_samples, the first MCUboot partition is empty however the sample still runs. Why does this app still run?

    I'm not sure what you mean by oad_samples. Do you mean the oad example project? Is it on-chip or off-chip oad?

    You didn't mention it in your post, but the main intention of partitioning flash into primary and secondary slots is to use TrustZone. You will put the secure image in the primary slot and the non-secure image in the secondary slot.

    More about Trustzone here: https://dev.ti.com/tirex/explore/content/simplelink_cc13xx_cc26xx_sdk_8_30_01_01/docs/ble5stack/ble_user_guide/html/security-tfm/tfm_architecture.html

    SimpleLink academy lab which walks thru using MCUBoot with Trustzone: 

    https://dev.ti.com/tirex/explore/node?node=A__AUd0E-3BcdL8ziAQwp75QQ__com.ti.SIMPLELINK_ACADEMY_CC13XX_CC26XX_SDK__AfkT0vQ__LATEST 

    • Also why does the App always fail to run after a board reset. It fails to run even if MCUboot is flashed and addresses correctly (I believe it to be correct, I could be mistaken).

    In order to run your example with MCUBoot, it needs a valid oad image header. You can get this by running it though the oad_image_tool (in the tools folder of the SDK). For the OAD enabled examples, this is automatically done as a post build step and you can find the resulting binary file in the example output folder.

    • Why does Overwrite produce an assert error whilst XIP doesn't?

    Only XIP is supported when you have divided flash into primary and secondary slots.

    Cheers,

    Marie

  • Hi Marie,

    Thank you for your response.

    • I was referring to oad_offchip sample.
    • I've just made some progress and got MCUBoot working and reading the application code. To get it working, I had to flash the signed image via UniFlash. I also noticed that when I flashed the MCUBoot_Blinky sample via CCS_Studio then the MCUBoot magic number (signed header and trailer) was missing. This was the reason MCUBoot wasn't working for me.

    Additional Questions

    • The post-build steps are as follows:
      ${CG_TOOL_ROOT}/bin/tiarmobjcopy ${BuildArtifactFileBaseName}.out --output-target binary ${BuildArtifactFileBaseName}_noheader.bin --remove-section=.ccfg

                ${COM_TI_SIMPLELINK_CC13XX_CC26XX_SDK_INSTALL_DIR}/tools/common/mcuboot/imgtool sign --header-size 0x100 --align 4 --slot-size                  0xCC000 --version 1.0.0 --pad-header --key ${COM_TI_SIMPLELINK_CC13XX_CC26XX_SDK_INSTALL_DIR}/source/third_party/mcuboot/root-                ec-p256.pem ${BuildArtifactFileBaseName}_noheader.bin ${BuildArtifactFileBaseName}_v1.bin

                Is there any way to get CCS_Studio to flash the signed image instead of the regular .bin file?

    • I am currently not using TrustZone. I am attempting to run "basic_ble_oad_offchip_LP_EM_CC1354P10_1_tirtos7_ticlang" sample.
      • bootloader base: 0x00000000;            bootloader size: 0x00006000
      • Primary image base: 0x00006000;      Primary image size: 0x000F6000
      • Secondary image base: 0x00000000; Secondary image size: 0x000F6000
      • enabled external_flash, and enabled Overwrite mode
      • ${CG_TOOL_ROOT}/bin/tiarmobjcopy ${BuildArtifactFileBaseName}.out --output-target binary ${BuildArtifactFileBaseName}_noheader.bin --remove-section=.ccfg
      • ${COM_TI_SIMPLELINK_CC13XX_CC26XX_SDK_INSTALL_DIR}/tools/common/mcuboot/imgtool sign --header-size 0x100 --align 4 --slot-size 0xF6000 --version 1.0.0 --pad-header --pad --key ${COM_TI_SIMPLELINK_CC13XX_CC26XX_SDK_INSTALL_DIR}/source/third_party/mcuboot/root-ec-p256.pem ${BuildArtifactFileBaseName}_noheader.bin ${BuildArtifactFileBaseName}_v1.bin
      • ${COM_TI_SIMPLELINK_CC13XX_CC26XX_SDK_INSTALL_DIR}/tools/common/mcuboot/imgtool sign --header-size 0x100 --align 4 --slot-size 0xF6000 --version 2.0.0 --pad-header --pad --key ${COM_TI_SIMPLELINK_CC13XX_CC26XX_SDK_INSTALL_DIR}/source/third_party/mcuboot/root-ec-p256.pem ${BuildArtifactFileBaseName}_noheader.bin ${BuildArtifactFileBaseName}_v2.bin

                            When using the Sample with the above config, I load the generated _v2.bin file from the simplelink BLE app, and the image successfully                              flashed to external flash; however, it rebooted into the same old _v1.bin. I verified that the external flash was correct by comparing the                                  binaries of the external flash with the signed _v2.bin image. Why doesn't MCUboot auto load from external flash?

    • On CCS_Studio, when selecting XIP mode, then I am unable to enable external flash. Is XIP supported with the use of external flash?

    In Summary

    I am attempting to get MCUBoot working with "basic_ble_oad_offchip_LP_EM_CC1354P10_1_tirtos7_ticlang" sample. I require advice regarding, how to achieve this task. I attached my environment setup above, which I believe to be correct, and I am not sure why MCUBoot is not auto booting from the _v2.bin image from external flash (Slot1).

    Any assistance would be truly appreciated.

    Kind Regards,

    Brenton

    • I also wrote a mcuboot_signed blinky to external flash. I verified via flash-rover and uniflash that the external flash contained the exact binary file.
    • mcuboot did not boot into external flash even if slot0 was blank.
    • I extracted a binary via flash-rover and extracted the external flash memory and directly flashed to slot0 via uniflash and that worked fine.
    • For some reason mcuboot is totally disregarding external flash.

    Does anyone know how to get mcuboot linked to external flash?

    I already Enabled external flash via syscfg and secondary_image was configured as follows:

    • base_address: 0x00000000; image_size: 0x000F6000
    • Overwrite Mode
    • Blinky Samples were set to post-build to size 0xF6000 and were padded.
  • I managed to get Over the Air updates working on my TI CC1354p10 dev kit.

    By default max sector number limit is 250 for internal flash. This will have to be adjusted alongside sector sizes.
    I listed the procedure below for future reference for people getting started with the BLE OAD_Offchip sample.

    • Adjust bootloader size to 0x00008000 (increased to allow for adding trace to mcuboot)
    • In properties of mcuboot->Predefined Symbols, change EXCLUDE_TRACE to something like xEXCLUDE_TRACE.
    • Adjust Slot addresses in mcuboot sysconfig as follows:
      • Primary base: 0x00008000;       Primary size: 0xF4000
      • Secondary base: 0x00000000;  Primary size: 0xF4000
    • For BLE_OAD_OffChip sample, adjust sysconfig->NVS. Change sector size to 0x800
    • In cmd file, ensure #define MCUBOOT_SIZE    0x8000,  #define PAGE_SIZE     0x800
    • In properties -> Build->Steps, change --slot-size 0xF4000
    • In properties -> Arm Compiler -> Predefined Symbols -> APP_HDR_ADDR=0x8000
    • In properties -> Arm Compiler -> Arm Linker-> --define=APP_HDR_ADDR=0x8000
    • C:\ti\simplelink_cc13xx_cc26xx_sdk_8_30_01_01\source\ti\common\flash\no_rtos\extFlash\ext_flash.h
      change #define EXT_FLASH_PAGE_SIZE 2048//4096
    • C:\ti\simplelink_cc13xx_cc26xx_sdk_8_30_01_01\source\ti\common\.meta\templates\mcuboot_config.h.xdt
      #define MCUBOOT_MAX_IMG_SECTORS 488 //change from 250 to 488
    • change ti/bleapp/util/sw_update/sw_update.c: #define MCUBOOT_SIZE 0x8000

    The above changes will allow for BLE_OAD_Offchip sample to work on CC1354P10 with trace enabled.