[Zigbee] FOTA mcuboot update

Setup
nRF Connect SDK 2.3.0
nRF52840

Hi all,

I would like to add mcuboot update over Zigbee FOTA to my application. 
I am aware of that the bootloader update over Zigbee is not currently supported by the nRF Connect SDK and it will require multiple steps to make it possible.

From my point of view the necessary steps are: 

  1. Generating the mcuboot FOTA image to be distributed by Zigbee FOTA server in a following way:
    1. build/mcuboot/zephyr.bin -> imgtool.py (with specific options like slot size, keys, etc.) -> dfu_multi_image.py -> zb_add_ota_header.py
  2. Determine the image type by image type field or image comment directly in the zigbee_fota subsys -> zigbee_fota_zcl_cb()
  3. Check the mcuboot fw versions in the s0 and s1 partition and choose lower one as current/active partition.
  4. Handle the incoming data: 
    1. Option A: Save the data directly to flash (current partition)
    2. Option B: Use DFU target library (?)
  5. Increase the version number of the mcuboot stored in current partition to be higher than mcuboot stored in alternative partition.
  6. Reboot 

The questions are: 

  1. Are there any other limitations of which I am not aware of ? 
  2. Is it possible to use DFU target library for handling the image flash saving ? By setting/changing some configs ? 

I am looking forward to hearing from you

Parents
  • Hello again,

    Thanks again for your patience.

    You seem to have covered the steps needed to adding an upgradable bootloader to your Zigbee application.

    I have a few comments on step 4:

    You can choose the option which suits you best (A or B).

    Choosing option A will give you the most control over what is happening and more of the development is on you. The generated pm_config.h defines the start addresses for the different sections of flash and the header file can be included in your project. From your build folder it can be found in zephyr/include/generated.

    If you opt for option B and choose the DFU target library, the functionality for firmware upgrade is already implemented. This option will include that you get familiar with the library and its complexity.

    Other than the above, I recommend that you take the instructions and documentation for Zigbee FOTA into account:
    Enabling Zigbee FOTA in an application
    Zigbee FOTA library

    Best regards,

    Maria

Reply
  • Hello again,

    Thanks again for your patience.

    You seem to have covered the steps needed to adding an upgradable bootloader to your Zigbee application.

    I have a few comments on step 4:

    You can choose the option which suits you best (A or B).

    Choosing option A will give you the most control over what is happening and more of the development is on you. The generated pm_config.h defines the start addresses for the different sections of flash and the header file can be included in your project. From your build folder it can be found in zephyr/include/generated.

    If you opt for option B and choose the DFU target library, the functionality for firmware upgrade is already implemented. This option will include that you get familiar with the library and its complexity.

    Other than the above, I recommend that you take the instructions and documentation for Zigbee FOTA into account:
    Enabling Zigbee FOTA in an application
    Zigbee FOTA library

    Best regards,

    Maria

Children
  • Hi Maria,

    Thank you so much for taking a look on that topic. 

    I did some further research regarding choosing option A or B, but I have not decided yet. From my understanding option A
    will require using Flash API, which seems like code duplication knowing that dfu target(stream) is already using that.
    At this moment I tend to use the dfu library. 
    I assume that if I will choose the DFU lib I will have to write the code which will be similar to dfu_target_mcuboot.c 
    is that right ? 

    I am looking forward to hearing from you.

Related