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: Creating a merge file using Uniflash

Part Number: CC2340R5
Other Parts Discussed in Thread: UNIFLASH,

Tool/software:

I am using LP-EM-CC2340R52 EVK and basic ble dual image as my base project. I want to merge mcuboot.hex and basic_ble_dual_oad_onchip.bin (offset: 0x00006000) and create a single .bin file. 
 

I have some points which I would like to discuss ,

1. Is it possible to merge a file using uniflash? If so, then please do guide for the same.

2. If not then what all options do I have ? Using oad image tool is ti possible to merge a hex and a bin file into a  final output bin  file ?

Please do let me know what will be the best approach to proceed with in order to create a merge bin file.

  • Hello Sushant,

    I am looking into your request on how we can merge these files! 

    Thanks,
    Alex F

  • Hi Alex, 

    Looking forward for your response .

  • Hello Sushant,

    I may of found what we need, it seems like there is a python utility that we can utilize to combine two hex files, it is detailed more in section 2.7 of the following document:

    CC2640/CC2650 Bluetooth low energy Software Developer’s Guide (Rev. E)

    and the download link of the python:

    IntelHex project files : IntelHex

    With that being said it seems like this was made for Flash Programmer 2, so hopefully it works for UniFlash. 

    Thanks,
    Alex F

  • Hello Alex, 

    If you suggest merging two hex files, then I need to know a way wherein I can convert my dual_oad_image.bin first to .hex .

    Then only trying merging two hex files seems possible.

    Please do guide through this as well 

  • Hello Sushant,

    To generate a hex file we need to add the following post build step in the project properties: 

    ${CG_TOOL_ROOT}/bin/tiarmhex -order MS --memwidth=8 --romwidth=8 --intel -o ${BuildArtifactFileBaseName}.hex ${BuildArtifactFileBaseName}

    Thanks,
    Alex F

  • Hi Alex, 

    I used srecord utility for merging two hex files by using following command:-


    D:\Sushant\Srecord\bin>srec_cat mcuboot_LP_EM_CC2340R5_nortos_ticlang.hex -intel basic_ble_oad_dual_image_LP_EM_CC2340R5_freertos_ticlang.hex -intel -offset 0x00006000 -o merge.hex -intel



    The merge.hex file size is 529 KB, now when I try to flash the EVK using UNIFLASH (LP_EM_CC2340R52 with 512 KB Flash) with this file I see an error:


    [4/8/2025, 10:04:54 AM] [ERROR] Cortex_M0P: File Loader: Failed to terminate flash programming: Verification error at address 0x4e026000, expected 0xff but read 0x00




    What can be the possible issue here, please do help me resolve this as soon as possible.

  • Hi Alex, 

    Seems like the issue was with adding the post build steps for basic ble oad dual image.

    Below are the post build steps that I was using 


    ${CG_TOOL_ROOT}/bin/tiarmobjcopy ${BuildArtifactFileBaseName}.out --output-target binary ${BuildArtifactFileBaseName}_noheader.bin --remove-section=.ccfg
    ${COM_TI_SIMPLELINK_LOWPOWER_F3_SDK_INSTALL_DIR}/tools/common/mcuboot/imgtool sign --header-size 0x100 --align 4 --slot-size 0x3B000 --version 1.0.0 --pad-header --pad --key ${COM_TI_SIMPLELINK_LOWPOWER_F3_SDK_INSTALL_DIR}/source/third_party/mcuboot/root-ec-p256.pem ${BuildArtifactFileBaseName}_noheader.bin ${BuildArtifactFileBaseName}_v1.bin
    ${COM_TI_SIMPLELINK_LOWPOWER_F3_SDK_INSTALL_DIR}/tools/common/mcuboot/imgtool sign --header-size 0x100 --align 4 --slot-size 0x3B000 --version 2.0.0 --pad-header --pad --key ${COM_TI_SIMPLELINK_LOWPOWER_F3_SDK_INSTALL_DIR}/source/third_party/mcuboot/root-ec-p256.pem ${BuildArtifactFileBaseName}_noheader.bin ${BuildArtifactFileBaseName}_v2.bin
    ${CG_TOOL_ROOT}/bin/tiarmhex -order MS --memwidth=8 --romwidth=8 --intel -o ${BuildArtifactFileBaseName}.hex ${BuildArtifactFileBaseName}

    Using this the output hex file basic_ble_oad_dual_image_LP_EM_CC2340R5_freertos_ticlang.hex was somehow corrupted, so for workaround I directly used srec_cat utility to get a finl merged hex file. 

    D:\Sushant\Srecord\bin>srec_cat mcuboot_LP_EM_CC2340R5_nortos_ticlang.hex -intel basic_ble_oad_dual_image_LP_EM_CC2340R5_freertos_ticlang.bin -binary -offset 0x00006000 -o merge.hex -intel

    However please do let me know whats wrong with the post build steps that did caused issue with the hex file produced.

     

  • Hello Sushant, 

    Can you try adding the hex post build step after the second build step (before the no-header build step) the hex may be pulling the no-header info causing the error.

    Thanks,
    Alex F