NCS 2.5.1 sample application with MCUBoot updates from external flash

Is there a sample application that shows how to get a hello world application going with the mcuboot able to do updates from extermal flash?

I am looking at the app with mcu boot sample, building for the nrf52840dk board, but don't understand what needs to be done to configure the mcuboot to work.

I can't find the docuemntation that shows how to actually set up a concrete example,

I have updated prj.conf with

'``

CONFIG_BOOTLOADER_MCUBOOT=y
```
and the sysbuild/mcuboot.conf with
```
CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y
CONFIG_PM_EXTERNAL_FLASH_BASE=0x0
```
and am seeing the following error

```
In file included from E:/ncs/v2.5.1/bootloader/mcuboot/boot/zephyr/include/sysflash/sysflash.h:10,
from E:/ncs/v2.5.1/bootloader/mcuboot/boot/bootutil/src/bootutil_priv.h:33,
from E:/ncs/v2.5.1/bootloader/mcuboot/boot/bootutil/src/swap_scratch.c:25:
E:/ncs/v2.5.1/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h: In function '__flash_area_ids_for_slot':
E:/ncs/v2.5.1/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h:47:60: error: 'PM_MCUBOOT_SECONDARY_ID' undeclared (first use in this function); did you mean 'PM_MCUBOOT_PRIMARY_ID'?
47 | #define FLASH_AREA_IMAGE_0_SLOTS PM_MCUBOOT_PRIMARY_ID, PM_MCUBOOT_SECONDARY_ID
| ^~~~~~~~~~~~~~~~~~~~~~~
E:/ncs/v2.5.1/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h:52:29: note: in expansion of macro 'FLASH_AREA_IMAGE_0_SLOTS'
52 | #define ALL_AVAILABLE_SLOTS FLASH_AREA_IMAGE_0_SLOTS
| ^~~~~~~~~~~~~~~~~~~~~~~~
E:/ncs/v2.5.1/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h:67:9: note: in expansion of macro 'ALL_AVAILABLE_SLOTS'
67 | ALL_AVAILABLE_SLOTS
| ^~~~~~~~~~~~~~~~~~~
E:/ncs/v2.5.1/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h:47:60: note: each undeclared identifier is reported only once for each function it appears in
47 | #define FLASH_AREA_IMAGE_0_SLOTS PM_MCUBOOT_PRIMARY_ID, PM_MCUBOOT_SECONDARY_ID
| ^~~~~~~~~~~~~~~~~~~~~~~
E:/ncs/v2.5.1/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h:52:29: note: in expansion of macro 'FLASH_AREA_IMAGE_0_SLOTS'
52 | #define ALL_AVAILABLE_SLOTS FLASH_AREA_IMAGE_0_SLOTS
| ^~~~~~~~~~~~~~~~~~~~~~~~
E:/ncs/v2.5.1/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h:67:9: note: in expansion of macro 'ALL_AVAILABLE_SLOTS'
67 | ALL_AVAILABLE_SLOTS
| ^~~~~~~~~~~~~~~~~~~
```


Parents Reply
  • I've put together a demo sample based on 'hello world' which supports the following:

    - Serial recover mode in bootlodader. This allows you to perform DFU trough the USB interface. You can press button 0 ('mcuboot-button0') on startup to make the bootloader this mode.

    - FOTA over BLE via the application. 

    - VERSION file in the project root directory to define the version number for the app image. https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.5.2/zephyr/build/version/index.html 

    - Added the 'child_image' folder to apply configuration changes to the mcuboot build. https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.5.2/nrf/config_and_build/multi_image.html#permanent-configuration-changes-to-child-images 

    Demo sample

    8475.hello_world_dfu.zip

    Testing the sample

    Build and flash the project onto your board. Next, update the version number in the VERSION file and rebuild the application to create an update image. I also recommend connecting a serial emulator to the Segger VCOM to monitor the DFU process.

    Serial recovery:

    1. Connect you PC to the nRF USB port on the side of the DK.

    2. Press the reset button while keeping button 1 on the DK pressed. Then confirm from the Debug log that the bootloader enters serial recovery mode.

    3. Initiate serial DFU. For example, with the 'mcumgr' tool: 

    $ mcumgr --conntype serial --connstring "COMx,baud=115200,mtu=4096" image upload build/zephyr/app_update.bin 
    # Perform reset to activate and boot new FW image
    $ mcumgr --conntype serial --connstring "COMx,baud=115200,mtu=4096" reset

    FOTA over BLE:

    1. Connect to the device using the Device Manager app on Android or iOS. The device name is 'Zephyr'

    2. Upload the app_update.bin from your build directory.

    Confirm from that the debug log that the app is printing the new version number after the update is complete.

Children
No Data
Related