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.

CC1352P: OAD_Image_Tool overflow exception

Part Number: CC1352P

I believe the exception is the hex file does not have a image header for secure boot.

What is the CCS project post-build step to add an OAD Image Header to the hex image file?

Running oad_image_tool_py -verbose -hex1 xxxxxx.hex -k private.pem -o xxxxxx ccs projectdir 7

generates the following exception

Exception has occurred: OverflowError
can't convert negative int to unsigned
File "C:\ti\simplelink_cc13x2_26x2_sdk_4_40_00_44\tools\common\oad\imgBinUtil.py", line 105, in writeBytes
filePtr.write(value.to_bytes(numBytes, byteorder = 'little'))
File "C:\ti\simplelink_cc13x2_26x2_sdk_4_40_00_44\tools\common\oad\imgBinUtil.py", line 252, in updateImgLen
writeBytes(fileName, BIN_LEN_PTR, binLen, IMG_LEN_SIZE)
File "C:\ti\simplelink_cc13x2_26x2_sdk_4_40_00_44\tools\common\oad\oad_image_tool.py", line 184, in createAppStackBinfile
util.updateImgLen(outfileAppPath, imgStAddr, imgEndAddr)
File "C:\ti\simplelink_cc13x2_26x2_sdk_4_40_00_44\tools\common\oad\oad_image_tool.py", line 341, in main
createAppStackBinfile(args.ProjType, args.ProjDir, binaryFileType,
File "C:\ti\simplelink_cc13x2_26x2_sdk_4_40_00_44\tools\common\oad\oad_image_tool.py", line 542, in <module>
main(oad_args)

This due to the start and end image addresses are incorrect as read from the hex file.

  • Someone will be assigned to look into this.

  • Hi Donald, 

    You can compare your added post-build step to run the OAD Image Tool with an example that uses OAD by default. In simple_peripheral_oad_onchip example for CC1352, this is the post-build step: 

    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/tools/common/oad/oad_image_tool --verbose ccs ${PROJECT_LOC} 7 -hex1 ${ConfigName}/${ProjName}.hex -k ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/tools/common/oad/private.pem -o ${ConfigName}/${ProjName}_oad

    You can also read more about the Image Tool in the User's Guilde: https://dev.ti.com/tirex/explore/content/simplelink_cc13x2_26x2_sdk_5_10_00_48/docs/proprietary-rf/proprietary-rf-users-guide/oad/tools.html

    Thanks, 
    Elin 

  • Hello Elin,

    Your recommendation for running OAD_Image_Tool is the essentially same what I was trying. What is difference is I am using the python version of the tool.

    Running the command as recommended results in the same error.

    C:\ti\simplelink_cc13x2_26x2_sdk_4_40_00_44\tools\common\oad>oad_image_tool -verbose ccs projectdir 7 -hex1 CB_RadioMicro_SDK440_v0.51.21.hex -k private.pem -o testbin_oad
    Traceback (most recent call last):
    File "oad_image_tool.py", line 542, in <module>
    main(oad_args)
    File "oad_image_tool.py", line 343, in main
    args.keyFile, args.HexPath2)
    File "oad_image_tool.py", line 184, in createAppStackBinfile
    util.updateImgLen(outfileAppPath, imgStAddr, imgEndAddr)
    File "imgBinUtil.py", line 252, in updateImgLen
    writeBytes(fileName, BIN_LEN_PTR, binLen, IMG_LEN_SIZE)
    File "imgBinUtil.py", line 105, in writeBytes
    filePtr.write(value.to_bytes(numBytes, byteorder = 'little'))
    OverflowError: can't convert negative int to unsigned
    [3040] Failed to execute script oad_image_tool

  • Hi Donald, 

    If you are using the tool standalone, you have to install all the modules that the python scripts use to make it work. This is not required when running in CCS. 

    Did you get the same error message when adding it as a post-build step in CCS?

    Thanks, 
    Elin 

  • Hi Elin,

    I can try from CCS.

    Is there is a project setting to make this a 'secure' application or is it just running the post-build step?

    Thanks,

    Don

  • Hi Elin,

    Added the command to CCS post-build steps and still getting the error.

    Finished building target: "WM_RadioMicro.out"

    C:/ti/ccs1031/ccs/tools/compiler/ti-cgt-arm_20.2.4.LTS/bin/armhex -order MS --memwidth=8 --romwidth=8 --intel -o WM_RadioMicro.hex WM_RadioMicro
    Translating to Intel format...
    "WM_RadioMicro.out" .resetVecs ==> .resetVecs
    "WM_RadioMicro.out" .const ==> .const
    "WM_RadioMicro.out" config_const ==> config_const
    "WM_RadioMicro.out" .text.1 ==> .text.1
    "WM_RadioMicro.out" .cinit ==> .cinit
    "WM_RadioMicro.out" .text.2 ==> .text.2
    "WM_RadioMicro.out" .ccfg ==> .ccfg
    C:/ti/ccs1031/ccs/utils/tiobj2bin/tiobj2bin WM_RadioMicro.out WM_RadioMicro.bin C:/ti/ccs1031/ccs/tools/compiler/ti-cgt-arm_20.2.4.LTS/bin/armofd C:/ti/ccs1031/ccs/tools/compiler/ti-cgt-arm_20.2.4.LTS/bin/armhex C:/ti/ccs1031/ccs/utils/tiobj2bin/mkhex4bin
    C:/ti/simplelink_cc13x2_26x2_sdk_4_40_00_44/tools/common/oad/oad_image_tool --verbose ccs C:/Users/dreynolds/Documents/louie/WM_RadioMicro 7 -hex1 Release/WM_RadioMicro.hex -k C:/ti/simplelink_cc13x2_26x2_sdk_4_40_00_44/tools/common/oad/private.pem -o Release/WM_RadioMicro_oad
    makefile:244: recipe for target 'post-build' failed
    [6984] Failed to execute script oad_image_tool
    Traceback (most recent call last):
    File "oad_image_tool.py", line 542, in <module>
    File "oad_image_tool.py", line 343, in main
    File "oad_image_tool.py", line 184, in createAppStackBinfile
    File "imgBinUtil.py", line 252, in updateImgLen
    File "imgBinUtil.py", line 105, in writeBytes
    OverflowError: can't convert negative int to unsigned
    gmake[2]: [post-build] Error -1 (ignored)

  • Hi Elin,

    Do you have a example hex file with the security segment that I can try?

    Thanks

  • Hi Donald,

    Elin has left TI, I will take over your case.

    Secure OAD needs to be defined at compile time. For most projects, the build configuration for secure (or unsecure) can be selected and no further change is needed. The guide for disabling Secure OAD is here, you can use it as a reverse reference:

    https://dev.ti.com/tirex/content/simplelink_cc13x2_26x2_sdk_5_10_00_48/docs/ble5stack/ble_user_guide/html/ble-stack-oad/setting-up-environment.html#disable-secure-oad