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: MCUBoot boot-time reduction

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

Tool/software:

Hi Forum,

I am working on integration of OAD with project. SDK 8.10.02.01. I observed that boot time is around ~4.5 sec to 5 seconds. Could you suggest a way to chop it off to ~2-2.5 seconds. 

I went through forum for similar issues, and it seem "disabling GPIO debug" will solved the issue but i am not exactly sure how to do that. what i understood is by disabling a GPIO they mean disconnecting debug pins which i did (think so).

I am using MCUBoot hex file from SDK and using persistent from example project.

Regards 

Vaibhav

  • Hi !

    The MCUboot hex files have the GPIO led debugs enabled by default, which causes the red led to blink on failure, and the green led to blink on success. This blinking takes up to 3 seconds of the MCUboot time, and can be disabled by building yourself the MCUboot project yourself and removing the blinking code.

    The MCUboot project is located in the SDK in {SDK_INSTALL_PATH}\examples\nortos\LP_EM_CC2340R53\mcuboot. You can remove the blinking code by removing the blinkLed(GREEN_LED, 3, 500); instruction on line 143 of the mcuboot_app.c file.

    By default, the MCUboot project is configured for the on-chip OAD upgrade method (XIP). If in the future you wish to use another method like off-chip or dual-image, you can change the method by following the User guide about MCUboot and the SLA about MCUboot to know the right addresses for your MCUboot configuration, and set these addresses in the MCUboot project sysconfig file. If you need help to set it up, don't hesitate to reply to this thread.

    Kind regards,
    Maxence

  • Hi Maxence,

    Thanks for support, as you may know the MCUBoot will verify image upon each reset or every boot up which is not required in my view because it accounting for major startup overhead time. Is there any work around for it? MCUBoot should only verify once and from next reset or boot it shouldn't.

    Thanks

    Vaibhav

  • Hi,

    The MCUboot project from TI's SDK is based on the open source MCUboot project. This project does not support only verifying once the image, as this would go against the security model of MCUboot. You can disable image validation completely, but this will make anyone able to upload firmware images through OAD, making your device unsecure.

    Kind regards,
    Maxence

  • Hi,

    I tried OAD with this modification (commenting blinkLed(GREEN_LED, 3, 500);). I am facing issue i.e. only persistent is getting loaded though i am able to OAD the new image. could please let me know what might went wrong.

    Regards

    Vaibhav 

  • Hi,

    I'm not sure I understand your problem. Are you able to boot into your firmware after flashing ? Can you send a new image through OAD ? Does it boot into the new image after OAD is completed ?

    Kind regards,
    Maxence

  • I could send new image via OAD but each time it is booting to persistent. 

  • It's possible that you have flashed the persistent app and the firmware at the wrong address. Could you send a screenshot of your uniflash before flashing, and could you try swapping the address you use for the persistent app and for the firmware ?

  • Hi, in your screenshot, you are not flashing your firmware. Your uniflash should look like this (screenshot from the SLA about MCUboot).

    You should make sure that the MCUboot binary is the first element, as it should be flashed at address 0x0.

    I highly recommend to read through this SLA and to follow the on-chip examples in a new workspace to familiarize yourself with MCUboot.

    Kind regards,
    Maxence

  • Hi 

    I even tried that way but still it is only loading to persistent 

  • Hi,

    Could you show me the content of your Sysconfig for MCUboot ? Does it look something similar to this ?

    Could you also try the exact same setup as your last screenshot, but using the hexfile for MCUboot on-chip instead of the one you built yourself, and tell me if it works, in order to know if the problem comes from the MCUboot binary ?

    Kind regards,
    Maxence

  • Hi,

    I dont see that option in sysconfig

  • Hi,

    Any updates?

    Regards

    Vaibhav

  • Hi !

    I'm really sorry I completely missed your reply.
    It surprises me that you don't have the MCUboot option. Maybe your version of the SDK or SysConfig is older than mine. Could you go to the properties of your project and then to General > Products, and tell me which version of the SDK you are using, and which version of SysConfig are you using ?

    Kind regards,
    Maxence

  • Hi

    Here you go!

    Regards

    Vaibhav

  • Hi !

    Your SDK and SysConfig versions are 1 year old, and I suspect that the MCUboot setting in sysconfig was added recently. I would try to update the SDK by downloading it here LINK, and then create a new workspace, import the MCUboot project from the new SDK, remove the led blinking instruction, and see if it works.

    Kind regards,
    Maxence

  • Hi

    I have updated to 8.40.02. and commented LED delay. Still it is loading to Persistent App.

  • Hi !

    Could you also try the exact same setup as your last screenshot, but using the hexfile for MCUboot on-chip instead of the one you built yourself, and tell me if it works, in order to know if the problem comes from the MCUboot binary ?

    One of the reasons why you might be booting into the persistent app is because the persistent app version number is higher than your app's number. Could you send me your image in this thread so I can have a look at the header values, and see if I can fix the problem on my side ?

    Kind regards,
    Maxence

  • Hi !

    Yes it is working fine with the hexfile for MCUboot on-chip. I cannot share image on public forum. could you let me know how to check version of image i will check and confirm

    Regards

    Vaibhav

  • Hi !

    The version number is in the header added by MCUboot when signing the firmware. If you look at the MCUboot image header struct from the MCUboot documentation, it should be the 6th and 7th words of the hex file, so around address 0xA0 of your hex file. You can check this value by using xxd file.hex | head -n 20 if you have xxd installed on a Linux or WSL, or you can use any hex editor you wish (HxD is old but reliable on Windows).

    Another possibility is that your firmware image is not properly signed which causes the verification of the firmware image to fail. There could be many reasons to that , have you changed the private key used for signing your firmware ?

    Could you show me the post-build steps of your firmware ? You can find them by right clicking on your project in CCS, then going to Properties, Build and finally Steps. This is what it will look like :

    As for sending your firmware, you can send me a friend request on this forum and send me the file through a private message. But please continue to talk about the issue here and not in private messages, as your issue could help others Smile

    Kind regards,
    Maxence

  • Hi Maxence,

    Below i have attached snap of both persistent.bin and app.bin . If i am understanding correctly at address 0xA0 we have 0xFF on both file.

    Below is screenshot of post-build steps

    Regards

    Vaibhav 

  • Hi, sorry I was wrong and the right address is for the image version is 0x14. The image version for the persistent app is 0.1.0 and the version for the firmware image is 1.0 so that's not the problem.

    The second screenshot you send are the build steps but for the MCUboot project, but I need the post build steps of your firmware instead Sweat smile

    I really encourage you to send me your firmware in private messages so I can debug on my side what the problem might be.

    Kind regards,
    Maxence

  • Hi Maxence,

    I don't think so there is problem with app image because it is working with MCUBoot hex file provided by TI. 

    Regards

    Vaibhav

  • Can you try flashing the firmware without the persistent image ? You can set the load address to 0x6000. Does it boot into your image ?

  • Hi,

    I tried loading only MCUBoot and Application file. It seems it is not booting the image.

    Regards

    Vaibhav

  • Hi,

    Do you see the red led blinking 3 times quickly ? If yes, this means that the image was refused by MCUboot. Could you send me your firmware in private messages so I can debug it on my side ?

    Kind regards,
    Maxence

  • Hi, 

    I don't see RED led blinking but its ON continuously. Let me know how to share application code privately?

    Regards

    Vaibhav

  • Hi,

    You can add me as a friend on E2E forums and then send a private message.

    Kind regards,
    Maxence

  • Hi Maxence,

    Any updates please?

    Regards

    Vaibhav

  • Hi,

    I'm still looking into it

  • Hi !

    I have found the solution to the MCUboot not booting into your firmware problem. By default, your image is linked in a way to have 0x32000 as its base address. However, in MCUboot you specify the secondary image address to be 0x43000 instead of 0x32000. While MCUboot will not have a problem booting into this image, the firmware itself will not work since it is placed incorrectly.

    The solution in your case is to change the MCUboot SysConfig settings to these, and to flash using UniFlash with these offsets :

    With those settings I was able to boot into your image.

    Kind regards,
    Maxence

  • Hi Maxence,

    Thanks for the solution. Now Application is loading. BUT now facing problem while doing OAD, the link is getting terminated before pairing while doing OAD. This is happing repeatedly. I am using SDK 8.40.02.

    Regards

    Vaibhav

  • Hi,

    Any updates? Please

    Regards

    Vaibhav

  • Hi,

    I'm really sorry I completely missed your message. It's expected for your link to be terminated when doing OAD since the app has to reset and switch to the persistent app, but it should reconnect quickly when it starts advertising since the central remembers the pairing data, and initialize OAD. Could you send the complete logs from BTool when doing OAD ? Have you tried doing OAD another way, like for example with the simplelink app ?

    Kind regards,
    Maxence

  • Hi Maxence,

    Exactly, it should reset and switch and reconnect quickly but it seems it isn't, i am getting error "bleNoResources".. I have used example code from given in SDK : 8.40.02. i am sending you private message of all the examples files as well as BTool Log.

    I am attaching 2 logs files    1. OAD_FAIL_3.log which is failure log

    2. OAD_POST_FAIL.log which is when i am retrying.

    I have used

    1. "host_test_app.hex" from example (precompiled).

    2. "mcuboot_onchip_LP_EM_CC2340R5_nortos_ticlang.hex" from example (precompiled)

    3. Both OAD_on_chip and persistent example code projects

    Regards

    Vaibhav

  • Hi !

    The gapInit_connect function only returns bleNoResources when the host app has surpassed its max number of active connections. Do you remember changing this value somewhere ? Are you connected to multiple devices in BTool ? If yes, could you try to proceed with OAD with only the device you're trying to update.

    If you're using the default unchanged files for host test, mcuboot onchip, oad_on_chip and persistent example, you should not have any problem, since it is the expected default setup. You can try following or re-following from the start the SLA about MCUboot here, maybe you might have missed a step in your first try.

    Kind regards,
    Maxence