Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Bootloader no-transport dual-bank DFU and dependencies

I'm just a bit fuzzy on how all of the bootloader stuff comes together.

  • Our application is small (100K-ish), so a dual-bank strategy seems appropriate.
  • It uses a proprietary bus protocol that we'd rather not pack into the bootloader.
  • We need to upgrade potentially hundreds of devices unsupervised, so BLE DFU is not practical.
  • We also have a "revert to factory image" button; the bootloader must copy this image from an external SPI ROM IC.
  • Our next release will use Bluetooth (but not for upgrade), so we are using the S132 SmartDevice.

I imagine the best solution goes like this:

  1. Server sends upgrade image to the application during normal use
  2. Upgrade image is written to the second bank
  3. Device resets, maybe sending a flag to the bootloader
  4. Bootloader recognizes the upgrade image, validates the image and the signature and copies the image to the application bank
  5. Bootloader resets back to the application

I just don't really know what API is appropriate for the above (aside from step 1).

When I bring in even just nrf_bootloader_app_start, it seems to also depend on an overwhelming number of BLE services, so I'm not sure if I'm on the right track with that... I thought DFU doesn't necessarily require BLE?

I've also seen the experimental IoT background update API, but it seems to be exclusive to TFTP... or ANT (it's unclear - or is it both?)

I'm using VisualGDB and have configured the appropriate write to UICR.BOOTLOADERADDR and located the bootloader at 0x00078000.  The bootloader seems to start fine.

Any advice for getting started with this?

Parents
  • Hi,

    I think there are mainly two options to consider for this: 1 create a custom transport layer with your proprietary bus protocol and integrate it with the existing bootloader (create custom transport). 2. Let the application handle the DFU transfer and storing of image to bank 1, then make a custom bootloader that's responsible for validation and activation of the new image. The current bootloader implementation does not support background DFU (ie. app handled dfu transfer).

    When I bring in even just nrf_bootloader_app_start, it seems to also depend on an overwhelming number of BLE services, so I'm not sure if I'm on the right track with that... I thought DFU doesn't necessarily require BLE?

    BLE is only required if you use the BLE transport layer. The serial bootloaders in SDK 15.x.x do not require a Softdevice to be present.    

  • Thanks for the reply.

    By "custom bootloader," you mean we would have to implement our own validation of the received image, perform the direct FLASH writes to copy Bank 1 to Bank 0, and figure out our own way to reboot from the bootloader to the application?

    The serial bootloaders I assume still require a (serial?) transport - does this imply that they can't be leveraged for at least some of the above steps?

    If I were to completely hand-write a bootloader as described above, I think the only unknown at this point is how to get back to the application.

  • There are several modules from the bootloader which you can re-use in your bootloader, function to transfer execution to app and image validation for instance. So maybe not a custom bootloader, but rather a modified version of the one we provide. 

    I think you can get a basic overview of the bootloader by going through the nrf_bootloader_init() function in nrf_bootloader.c.

    1. Checks to see if should enter DFU mode or not

    2. Check if there are any new FW images to activate (could be an image that the app has stored).

    3. If dfu_enter == true, initialize transport and wait for DFU master to initiate a DFU

    3. if dfu_enter == false, verify CRC of app image and boot the app.  

    Which SDK version are you currently using? I'll try to check how you can use the validate function for an image stored by the application.  

Reply Children
No Data
Related