This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Manual firmware upload to trigger MCUBoot swap

Hey,

I have implemented BT FOTA process for my zephyr based application. DFU over Bluetooth works fine.
But now I struggle to implement manual upload of image (it will be done via spi in future).

What I'm trying to do?
I want to generate .hex or .bin file shifted to slot1 address space and flash this file via west to trigger mcuboot swap.

As far as I know, west build does not generate .hex file with shifted addresses that can trigger DFU procedure.
There is app_update.bin - it is working fine when i upload via bluetooth with NCS application. But i would like to upload this file via west,
then reboot my MCU and see that mcu boot swaps images - but this didn't happen for now Disappointed

I tried with all .hex files generated by west, I also translated app_update.bin to .hex with this tool:
arm-none-eabi-objcopy --change-addresses  0x3E000 -I binary -O ihex build/zephyr/app_update.bin app_update.hex
But flashing this hex via west also does not trigger swap and always old image is booted.

Maybe you guys are able to point what I am missing here. Official BT DFU was warking excellent, but my app has to handle OTA over interfaces not supported by zephyr.
This is why I have to implement manual upload.

Thanks!

  • OK, I did this and flash this either via nrfjprog and west, but after reboot still old image is loading.
    So, after your instructions I have .hex file signed and linked to SLOT1 address, but I still need to add trailer basing on smp_svr example?



    In documentation i see that you use mcumgr tool like here:

    sudo mcumgr <connection string> image test <hash of slot-1 image>

    But how can I use mcumgr from my application? I mean marking new image for swap or rebooting?

     

  • Hung, 

    Hex generated your way succesfully worked Slight smile

    The problem was I didn't called boot_request_upgrade(BOOT_UPGRADE_TEST) between transfer done and system reboot.
    After reboot boot_write_img_confirmed() should be called from freshly booted app to prevent revert.

    Thanks :)

Related