nrf_desktop bootloader help

Hi!

I could really use some help with bootloaders.

I'm trying to add bootloader support to nrf_desktop using nRF Connect v2.1 (I could upgrade if needed but the changes to nrf_desktop between 2.1 and 2.3 look extensive and I'm a bit concerned about how much work upgrading might take) - I thought this would be simple but I'm getting confused with all of the options on B0/NSIB vs MCUBoot.

I'm currently working with an nRF52840 devkit.

I got B0 to work to where I can program in b0_container.hex, provision.hex, signed_by_b0_s0_image.hex, and signed_by_b0_s1_image.hex, and the bootloader will select and load the newer one between the images. (Though I would like to know how to enable readback protection for production)

Now I'm trying to figure out what I need to do receive and save off my new image. The links I've found talk about a configuration channel, but I'm not sure how to use that, or if B0 has any way to read in an image, or if B0 is *just* the little bit of code that selects the image at startup.

I guess for both B0 and MCUBoot I'm confused about the "get a new image from somewhere" aspect of a bootloader and the "run at startup and launch the application" aspect. I've done bootloaders in my life that do both things in the same code, where if there's a special value that the app has saved off in flash or if someone's holding down a certain button then you enter the bootloader and it includes the code needed to receive the new file, put it in memory, and then launch it. I've also done bootloaders where the "receiving and saving the file" stuff happens in the application, and then you reboot and the bootloader code is just responsible for copying over the new file and launching it. Which of those two bootloader types are B0 and MCUBoot?

The docs say MCUBoot can receive an image via Bluetooth with SMP, but I don't know if I need to use MCUBoot as a primary bootloader or if I need to have B0 as the primary and MCUBoot as the secondary, and how to get all the configuration options right to do that.

I tried just building the unmodified nrf_desktop sample with the prj_mcuboot_smp.conf file selected and I got a compile error:

\testing\nrf_desktop\src\util\bt_le_adv_prov_uuid16.c:15:18: error: 'const struct bt_le_adv_prov_adv_state' has no member named 'bond_cnt

Also, is the code for these bootloaders in the SDK directory somewhere or is it a precompiled library? I have another project using nRF Connect v2.3 that needs a bootloader with data coming in over Ethernet or possibly a serial port, so I'd like to figure out if I can hack out the SMP code and put in my own front end. I'm assuming that code just receives data and sticks it into flash at the right location, right?

I'd appreciate any advice to get me going in the right direction.

Thanks!

Glen

Parents
  • Hi, 

    I would like to know how to enable readback protection for production

    See  Working with the nRF52 Series' improved APPROTECT  

    The docs say MCUBoot can receive an image via Bluetooth with SMP, but I don't know if I need to use MCUBoot as a primary bootloader or if I need to have B0 as the primary and MCUBoot as the secondary, and how to get all the configuration options right to do that.

    In general, the nRF Connect SDK uses MCUboot for its bootloader. If you need an Upgradable Bootloader, the Nordic Secure Immutable Bootloader (NSIB) is generally used in addition to MCUboot. For more information on this, see Bootloaders and Device Firmware Upgrade

    I tried just building the unmodified nrf_desktop sample with the prj_mcuboot_smp.conf file selected and I got a compile error:

    Is it v2.1.0? I have built the v2.1.0 nrf_desktop sample with the following west command, but cannot reproduce the issue. 

    west build -p -b nrf52840dk_nrf52840 -d nrf52840dk_nrf52840 -- -DCONF_FILE=prj_mcuboot_smp.conf

    Try to run "west update" or update SDK via ToolChnin Manager: 

    is the code for these bootloaders in the SDK directory somewhere or is it a precompiled library?

    You could enable CONFIG_SECURE_BOOT/CONFIG_BOOTLOADER_MCUBOOT to build nRF Secure Immutable Bootloader and mcuboot as the child images. 

    I have another project using nRF Connect v2.3 that needs a bootloader with data coming in over Ethernet or possibly a serial port, so I'd like to figure out if I can hack out the SMP code and put in my own front end.

    See my colleague's example https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/tree/main/bootloader_samples/smp 

    Regards,
    Amanda H.

  • Thanks Amanda!

    It looks like I should focus on MCUBoot and I probably don't need B0/NSIB. I'll let you know if I hit any snags - and if not I'll come back and close this ticket when I'm finished.

    By the way I found this comment at one of the links you provided which answers my question about the "download the image" vs "load/launch the image" aspects of bootloading:

    DFU is not the same as a bootloader

    DFU is to send new firmware to a slot in flash. This is often handeled by the application.
    The bootloader do not need to be involved in the DFU.
    The bootloader will read what is in its slots on boot, but does not care about how the slots were populated.

Reply
  • Thanks Amanda!

    It looks like I should focus on MCUBoot and I probably don't need B0/NSIB. I'll let you know if I hit any snags - and if not I'll come back and close this ticket when I'm finished.

    By the way I found this comment at one of the links you provided which answers my question about the "download the image" vs "load/launch the image" aspects of bootloading:

    DFU is not the same as a bootloader

    DFU is to send new firmware to a slot in flash. This is often handeled by the application.
    The bootloader do not need to be involved in the DFU.
    The bootloader will read what is in its slots on boot, but does not care about how the slots were populated.

Children
No Data
Related