Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

Feature request: Please allow APP+BL DFU upgrades in nrfutil

Hi! I have mentioned this already 9 month ago in another ticket (https://devzone.nordicsemi.com/f/nordic-q-a/75331/dfu-upgrade-of-only-bootloader-not-softdevice) but it was mixed up with another topic, so I would like to open a specific ticket for my feature request.

Please allow creating APP+BL (but not SD) DFU packages in nrfutil!

This is an issue especially on devices with less flash space, such as the nrf52810, where APP+BL+SD updates are not possible because the SD it too big. Sometimes we need to update the bootloader and the application of the device, in my ticket before it was the case of a BL bug being triggered by an application update (WDT related, my own error, but nevertheless needed to be fixed). Now the reason I need to do this, is that in order to add new features to my application, and still fit it into the flash space, I had to reduce the FDS pages to two, which I had left at the default of 3 pages before, without thinking about it. In order to do that I also have to update NRF_DFU_APP_DATA_AREA_SIZE in the BL, before I do the upgrade of the APP because otherwise the BL tells me that the APP doesn't fit into the available space. Anyways these are just examples what happened in my case, there may be many other reasons for updating the BL+APP.

The only reason why APP+BL packages can not be made is because it is not allowed in nrfutil.

As I have mentioned already in the ticket above, I have manually made an APP+BL package by "hacking" the .zip file, and by putting a BL only .bin and .dat file from a BL only package to a APP+SD+BL package as sd_bl.bin and sd_bl.dat, thus creating a APP+BL package. Then the tools did not have any problem updating first the BL and then the APP.

A Nordic Engineer mentioned in my older ticket that I could do a BL only update followed by a APP only update, yes, true, but for the same reasons as APP+SD+BL updates are very useful because they can upgrade everything in one go without having to start the upgrade process twice and with two different MAC addresses that would be very good for APP+BL upgrades as well.

Thank you

Parents
  • Hi Bruno, 
    Thanks for the information. 
    I just want to clarify here that after you have manipulated and created the .zip file containing APP+BL, when you do DFU update, did it perform in one go or under the hood it's actually 2 phases: The BL got updated first and then nrfutil sends the app after that ? Or both the app and the bootloader were sent at the same time ? (You may need to use a sniffer or use the log on the bootloader to detect that). As far as I know the bootloader doesn't support APP+BL in one image. 

    But even if it's sent in 2 phases or not, for the end customer it's still transparent, which is important. So I think your information is very useful and the request is legit. I will forward your request to the team. 



  • Yes, the update is actually done in two phases: first the BL and then the APP, just like with APP+SD+BL updates. Thank you!

Reply Children
  • Hi Bruno, 

    I have reported the request to the team internally. Hope that it would be updated soon. 

    In the meantime maybe you can just write a script to do the task of editing the .bin and .dat file automatically ?

  • In the mean time I have modified pc-nrfutil, and it was easier than expected:

    diff --git a/nordicsemi/__main__.py b/nordicsemi/__main__.py
    index f9697c1..be2afcb 100755
    --- a/nordicsemi/__main__.py
    +++ b/nordicsemi/__main__.py
    @@ -664,7 +664,7 @@ def generate(zipfile,

    * BL + SD: Supported.

    - * BL + APP: Not supported (use two packages instead).
    + * BL + APP: Supported.

    * BL + SD + APP: Supported.

    @@ -672,10 +672,6 @@ def generate(zipfile,
    """
    zipfile_path = zipfile

    - # Check combinations
    - if bootloader is not None and application is not None and softdevice is None:
    - raise click.UsageError("Invalid combination: use two .zip packages instead.")
    -
    if debug_mode is None:
    debug_mode = False

    diff --git a/nordicsemi/dfu/init_packet_pb.py b/nordicsemi/dfu/init_packet_pb.py
    index ad72202..7cc0b82 100644
    --- a/nordicsemi/dfu/init_packet_pb.py
    +++ b/nordicsemi/dfu/init_packet_pb.py
    @@ -132,10 +132,6 @@ class InitPacketPB:
    raise RuntimeError("sd_size is not set. It must be set when type is SOFTDEVICE")
    elif self.init_command.type == pb.BOOTLOADER and self.init_command.bl_size == 0:
    raise RuntimeError("bl_size is not set. It must be set when type is BOOTLOADER")
    - elif self.init_command.type == pb.SOFTDEVICE_BOOTLOADER and \
    - (self.init_command.sd_size == 0 or self.init_command.bl_size == 0):
    - raise RuntimeError("Either sd_size or bl_size is not set. Both must be set when type "
    - "is SOFTDEVICE_BOOTLOADER")

    if self.init_command.fw_version < 0 or self.init_command.fw_version > 0xffffffff or \
    self.init_command.hw_version < 0 or self.init_command.hw_version > 0xffffffff:

    ```

  • Thanks Bruno. Seems to be very simple. The question is if R&D have someone to look into this :) I'm still waiting for their update. 

Related