MCUboot: Recovery entry
This sample demonstrates how to reboot into MCUboot’s recovery (firmware loader) mode using the retention boot mode subsystem via Bluetooth Low Energy and MCUmgr. See Running the DFU process for details on DFU support in Bare Metal.
Requirements
The sample supports the following development kits:
S115:
Hardware platform
PCA
Board target
PCA10156
bm_nrf54l15dk/nrf54l15/cpuapp/s115_softdevice/mcuboot
nRF54L15 DK (emulating nRF54L10)
PCA10156
bm_nrf54l15dk/nrf54l10/cpuapp/s115_softdevice/mcuboot
nRF54L15 DK (emulating nRF54L05)
PCA10156
bm_nrf54l15dk/nrf54l05/cpuapp/s115_softdevice/mcuboot
PCA10184
bm_nrf54lm20dk/nrf54lm20a/cpuapp/s115_softdevice/mcuboot
PCA10214
bm_nrf54ls05dk/nrf54ls05b/cpuapp/s115_softdevice/mcuboot
PCA10188
bm_nrf54lv10dk/nrf54lv10a/cpuapp/s115_softdevice/mcuboot
S145:
Hardware platform
PCA
Board target
PCA10156
bm_nrf54l15dk/nrf54l15/cpuapp/s145_softdevice/mcuboot
nRF54L15 DK (emulating nRF54L10)
PCA10156
bm_nrf54l15dk/nrf54l10/cpuapp/s145_softdevice/mcuboot
nRF54L15 DK (emulating nRF54L05)
PCA10156
bm_nrf54l15dk/nrf54l05/cpuapp/s145_softdevice/mcuboot
PCA10184
bm_nrf54lm20dk/nrf54lm20a/cpuapp/s145_softdevice/mcuboot
PCA10214
bm_nrf54ls05dk/nrf54ls05b/cpuapp/s145_softdevice/mcuboot
PCA10188
bm_nrf54lv10dk/nrf54lv10a/cpuapp/s145_softdevice/mcuboot
Overview
After the application boots, it begins advertising as nRF_BM_Entry, advertising the MCUmgr service.
A mobile device can then connect and issue the OS mgmt reset command with the optional boot_mode parameter provided and set to 1.
Before the reset, the mobile device can also set up the advertising name of the firmware loader using the MCUmgr settings management commands.
The command sets the retention register for entering the firmware loader mode and reboots the device.
It then starts advertising the MCUmgr service allowing for a firmware update to be loaded.
For more details on this workflow, see System reset in Zephyr documentation.
Building and running
This sample can be found under samples/boot/mcuboot_recovery_entry/ in the Bare Metal folder structure.
The sample supports the default configuration for evaluation purposes and the size-optimized configuration of the DFU component for reference.
To enable the size-optimized configuration, set FILE_SUFFIX to size_opt when building the sample.
For details on how to create, configure, and program a sample, see Getting Started with the samples.
Testing
Compile and program the application.
Connect the device to the computer to access the UART. If you use a development kit, the UART is forwarded as a COM port (Windows) or ttyACM device (Linux) after you connect the development kit over USB.
Connect to the DK with a terminal emulator (for example, the Serial Terminal app) to VCOM1.
Reset the DK.
Observe in the terminal that the device boots into application mode and then advertises with the default name
nRF_BM_Entry.Connect to your device using the nRF Connect Device Manager mobile application.
Under the image tab, tap Advanced.
In the reset control panel, select Switch to Firmware Loader mode. Optionally, specify the advertising name in the text field below and tap Send Reset Command.
Observe in the terminal that the device reboots into the Firmware Loader mode and advertises with the advertising name specified or the default Firmware Loader name
nRF_BM_MCUmgr.Using the nRF Connect Device Manager mobile application, go back to the device list and refresh it by swiping down. Connect to your device that now advertises with the advertising name specified or the default firmware loader name
nRF_BM_MCUmgr.Under the image tab, tap Advanced. Then, in the image control pane, tap Read. Observe that the details of the currently loaded application are displayed.
Build an application with a modified image version by changing the
CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSIONKconfig option. One way of changing the option is to addCONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION="1.0.0+0"to the sample’sprj.conffile to override the default version string.Transfer the
<build_dir>/installer_softdevice_firmware_loader.binand<build_dir>/<app_name>/zephyr/zephyr.signed.binfiles to your mobile device.In nRF Connect Device Manager application, tap the Image tab at the bottom to move to the image management tab. If you only see the basic image tab view, tap Advanced to switch to the advanced image tab view.
Under Firmware Upload select the update file to load:
Choose
installer_softdevice_firmware_loader.binto update the SoftDevice and Firmware Loader images. This is only needed if the SoftDevice or Firmware Loader images have been updated. This image must be loaded first if it is needed.Choose
zephyr.signed.binto load the application update.
Tap the Upload button, then select the Image 0 option to begin the firmware update process.
The mobile device will connect and load the firmware update to the device.
Once completed, reboot the device. If the Installer image was loaded, then it will apply the updates and reboot into Firmware Loader mode automatically and allow for loading the application firmware update using the same process. If an application update was loaded, then the new application will begin executing.
Dependencies
The sample uses the following Zephyr libraries: