Upgradable bootloader with sysbuild

Hello,

I'm sorry to ask a maybe stupid question, but I'm a bit lost with the available boot loader options right now.

I want to setup an updatable and secure bootloader.

I know how to do it using child and parent images, but this approach is now deprecated.

The problem, I'm struggling with right now is, that I was not able to read the restrictions of the sysbuild's bootloader chain from the documentation.

Is there an example project somewhere related to the description at

https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/app_dev/bootloaders_dfu/mcuboot_nsib/bootloader_adding_sysbuild.html

?

I have found the example for https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/app_dev/bootloaders_dfu/mcuboot_image_compression.html,

but there are too many restrictions (no network-core update, no image encryption, ...) for my application.

Could you please explain which sysbuild bootloader options are available right now, which are planned for the future and when they will be available?

Many thanks in advance.

Kind regards,

Christian

  • Hi Christian,

    Could you add information about which version of nRF Connect SDK you're using and verify if you're working with the nRF5340?

    but I'm a bit lost with the available boot loader options right now.

    I understand. There's a lot of information to sort through, specially when you're going from one procedure to a new one. But luckily it is not too complicated once you've done it once. And relatively shortly this lesson in our academy course regarding bootloaders will be updated to support sysbuild.

    The link you're referring to should include everything you need and the explaining for how to add the bootloader chain to your application. It will largely be identical to how you did it with child and parent images.

    Before you enabled your configuration and bootloader chain through

    • prj.conf 
    • pm_static.yml
    • child_image/mcuboot.overlay and /mcuboot.conf
    • child_image/any other relevant child_images

    Now you do it through

    • prj.conf
    • partition_manager or .dts (if you need a static partition)
    • sysbuild/sysbuild.conf, .overlay
    • child_image/any other relevant child_images

    You can also have a look at the sample mentioned here: https://docs.nordicsemi.com/bundle/ncs-latest/page/zephyr/samples/sysbuild/sysbuild.html (or here in the SDK git: https://github.com/nrfconnect/sdk-zephyr/tree/main/samples/sysbuild) to see a minimal sample that showcases how to set up mcuboot through sysbuild.

    Let me know if this narrows down your search and feel free to ask follow up questions.

    Kind regard,
    Andreas

  • Hello,

    I basically followed https://academy.nordicsemi.com/courses/nrf-connect-sdk-intermediate/lessons/lesson-8-bootloaders-and-dfu-fota/topic/exercise-2-dfu-over-usb-adding-external-flash/ but got some troubles when I tried to add the external flash support:

    /opt/nordic/ncs/toolchains/f8037e9b83/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/zephyr_pre0.elf section `rodata' will not fit in region `FLASH'
    /opt/nordic/ncs/toolchains/f8037e9b83/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: region `FLASH' overflowed by 4406 bytes

    Therefore, I tried this example:

    https://github.com/nrfconnect/sdk-nrf/tree/main/tests/modules/mcuboot/external_flash

    and removed the child_image folder.

    The result was the same as above. 

    Could you please give me some advice how to use MCUBOOT with external flash and sysbuild?

    Furthermore, I tested

    https://docs.nordicsemi.com/bundle/ncs-latest/page/zephyr/samples/subsys/mgmt/mcumgr/smp_svr/README.html

    without external flash using sysbuild.

    But if I want to list the use the command 

    ./mcumgr-client -d /dev/tty.usbmodem144101 list

    The serial monitor shows:

    ---- Opened the serial port /dev/tty.usbmodem144101 ----
    *** Booting nRF Connect SDK v2.7.0-5cb85570ca43 ***
    *** Using Zephyr OS v3.6.99-100befc70c74 ***
    [00:00:00.000,885] <inf> smp_sample: build time: Dec 10 2024 01:21:07
    AJABAACGAAF5AL9maW1hZ2Vzn79kc2xvdABndmVyc2lvbmUwLjAuMGRoYXNoWCCYUx+pSRKXePmlSlqVjRxOKLhUkRFnI/o4zGCZjbtdEGhib290YWJsZfVncGVu
    hZ2Vzn79kc2xvdABndmVyc2lvbmUwLjAuMGRoYXNoWCCYUx+pSRKXePmlSlqVjRxOKLhUkRFnI/o4zGCZjbtdEGhib290YWJsZfVncGVu
    ZGluZ/RpY29uZmlybWVk9WZhY3RpdmX1aXBlcm1hbmVudPT//2tzcGxpdFN0YXR

    and the firmware hangs.

    Could you please give me an advice what needs to be changed to avoid this behaviour?

    Many thanks and kind regards,

    Christian

  • Hi Christian,

    Rantanplan said:
    Could you please give me some advice how to use MCUBOOT with external flash and sysbuild?

    I will see if I can find something for you or put together a minimal sample with full bootloader chain and external flash tomorrow (Wednesday) so you don't have to wait for the course I mentioned to be updated.

    Kind regards,
    Andreas

  • Hello Andreas,

    this will be great.

    At the moment, a single-stage MCUBOOT using external flash will also be fine.

    Many thanks and kind regards,

    Christian

  • Hi Christian,

    Here's a minimal sample that showcases how to set up the bootloader chain with the secondary application slot placed on the external flash. Do note it does not have any transport layers enabled, so you will have to for instance add BLE transport if you want to test it for DFU.

    Tested for nRF52840, NCS 2.8.0. I see that you're using a nRF5340, but the principles should be the same, but it might need some configurations. Let me know if this is enough to get you going for now

    chain_ft_ext_flash.zip

    Kind regards,
    Andreas

Related