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

Firmware update without DFU

Hi, I am new to the Nordic environment. So far I have done all the integration by going through your examples code which is very good.

Now, one thing I have no knowledge about is updating the firmware image(non-secure + TF-M) without using DFU.

I do not want FW update over DFU for some personal reasons.

Please guide me to any reference or documentation for how to build a bootloader and configure the application image to run with the bootloader and do OTA update.

I do not know from where to start for implementing the OTA update.

Thank you in advance.

My setup:

NRF SDK: v2.2.0

Board: nRF5340-DK

Parents
  • Hi,

    Can you clarify what you mean by not wanting to do fw update over DFU? DFU is device firmware update, so if you want to update your device, then this will be DFU, Do you mean that you do not want to update the device over serial (e.g. UART), but only over the air?

    Best regards,

    Marte

  • Hello, just to let you know that I need to implement this onto my project with high priority.

    Please let me know if I am missing anything to explain my need.

    Please help me with the integration ASAP.

  • Thank you so much for the reference


    I see it’s a lot of things to take in.
    Anyway after going through the bootloader reference you shared earlier, I have below 2 questions

    1. How to insert header and trailer metadata to my application image?

    2. How to write any data into the specific address in the flash?
    —> Currently I am using PSA protected storage APIs for accessing flash inside TF-M and I see I can not specify the destination address in any of PSA PS APIs.

    NOTE: I have TF-M partition in my application and anything I need to do with the flash are should be done inside TF-M partition.
    I can not use non-secure partition due to some security purposes.

    Please guide me through this.

    I appreciate your support.

  • Hi,

    Jithin A said:
    1. How to insert header and trailer metadata to my application image?

    You can use imgtool to sign images and add metadata, see the imgtool documentation. Additionally, you can generate private and public keys with imgtool. Make sure to add the --pad flag for the image trailer.

    For an example on how to use imgtool for manually signing you can check out one of my colleagues examples: mcuboot_manual_sign. Please not that in that example, mcumgr is used, so the necessary commands will differ somewhat from what you should use. See the documentation above for more information about the different flags and which you should use.

    Jithin A said:
    2. How to write any data into the specific address in the flash?

    If you use the function dfu_target_write(), the firmware image will be written into MCUboots secondary slot, see MCUboot-style upgrades for more information on this.

    Best regards,

    Marte

  • Thank you so much.

    I am on the right place.

    let me try it on my end and get back if any.

  • Hi Marte,

    Thank you so much for your support I ran a blinky application with mcuboot enabled and is working fine.

    Please see the below logs after the boot

    *** Booting Zephyr OS build v3.2.99-ncs1 ***
    Attempting to boot slot 0.
    Attempting to boot from address 0x8200.
    Verifying signature against key 0.
    Hash: 0x8d...d1
    Firmware signature verified.
    Firmware version 1
    Setting monotonic counter (version: 1, slot: 0)
    *** Booting Zephyr OS build v3.2.99-ncs1 ***
    I: Starting bootloader
    I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Swap type: none
    I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Swap type: none
    I: Bootloader chainload address offset: 0x28000
    *** Booting Zephyr OS build v3.2.99-ncs1 ***

    I see it has also generated hex file for FOTA "app_moved_test_update.hex"

    One last question, how can I program this hex file using your nRF Connect Desktop tool or if any other method.

    This is because our App is still on development and in the meanwhile I need to test OTA so I can confirm the image from the secondary slot is being booted on OTA.

    I appreciate your support.

    Thank you once again for guiding me all through

  • Hi,

    Great to hear that it works.

    Jithin A said:
    I see it has also generated hex file for FOTA "app_moved_test_update.hex"

    If you are interested, you can find more information about the generated build files in Output build files. If you scroll down you will also find information about MCUboot output build files.

    Jithin A said:
    One last question, how can I program this hex file using your nRF Connect Desktop tool or if any other method.

    You can program it using the nRF Connect Programmer in nRF Connect for Desktop, or you can use nrfjprog.

    Best regards,

    Marte

Reply
  • Hi,

    Great to hear that it works.

    Jithin A said:
    I see it has also generated hex file for FOTA "app_moved_test_update.hex"

    If you are interested, you can find more information about the generated build files in Output build files. If you scroll down you will also find information about MCUboot output build files.

    Jithin A said:
    One last question, how can I program this hex file using your nRF Connect Desktop tool or if any other method.

    You can program it using the nRF Connect Programmer in nRF Connect for Desktop, or you can use nrfjprog.

    Best regards,

    Marte

Children
  • Hi,

    I try programming the app_moved_test_update.hex image with nRF Connect Programmer and I see it does not boot the device and also I observe no logs.

    Attached the screenshot of the programmer window.

    In the above image you can see the Write option is disabled, I only have Erase & write option and which I think it is erasing mcuboot too.

    I did not find any mcuboot image to program along side the application image.

    Am I missing something here?

  • Hi,

    Please select Enable MCUboot in the Programmer.

    You can also try using nrfjprog. For a list of commands see nrfjprog commands.

    Best regards,

    Marte

  • Hi Marte,

    Thank you for the suggestion.

    I try using nrfjprog commands to program and confirm it is working.

    *** Booting Zephyr OS build v3.2.99-ncs1 ***
    Attempting to boot slot 0.
    Attempting to boot from address 0x8200.
    Verifying signature against key 0.
    Hash: 0x8d...d1
    Firmware signature verified.
    Firmware version 1
    *** Booting Zephyr OS build v3.2.99-ncs1 ***
    I: Starting bootloader
    I: Primary image: magic=good, swap_type=0x4, copy_done=0x1, image_ok=0x1
    I: Secondary image: magic=good, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Swap type: test
    I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Secondary image: magic=good, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Starting swap using move algorithm.
    I: Bootloader chainload address offset: 0x28000
    *** Booting Zephyr OS build v3.2.99-ncs1 ***

    Thank you for your support.

Related