Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/nrf/links.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1074,6 +1074,7 @@
.. _`Erasing the device`: https://docs.nordicsemi.com/bundle/nrfutil/page/nrfutil-device/guides/programming_erasing.html
.. _`Recovering the device`: https://docs.nordicsemi.com/bundle/nrfutil/page/nrfutil-device/guides/programming_recovery.html
.. _`Configuring readback protection`: https://docs.nordicsemi.com/bundle/nrfutil/page/nrfutil-device/guides/programming_readback_protection.html
.. _`nRF Util mcu-manager serial`: https://docs.nordicsemi.com/bundle/nrfutil/page/nrfutil-mcu-manager/nrfutil-mcu-manager.html

.. _`anomaly 19`: https://docs.nordicsemi.com/bundle/errata_nRF5340_EngA/page/ERR/nRF5340/EngineeringA/latest/anomaly_340_19.html

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,19 @@ DECT NR+ samples
* Scheduler - Dynamic flow control based on load tier to prevent modem out-of-memory errors.
* Settings - Continuous Wave (CW) support and possibility to disable Synchronization Training Field (STF) on TX and RX.

DFU samples
-----------

* Updated the :ref:`single_slot_sample` sample configuration for demonstrating DFU on the :zephyr:board:`nrf54lm20dk` board target using the :ref:`fw_loader_ble_mcumgr` firmware loader.

* Added:

* The :ref:`fw_loader_usb_mcumgr` sample, which provides a minimal configuration for firmware loading using SMP over the USB CDC ACM virtual serial port.
The sample serves as a starting point for developing custom firmware loader applications that work with the MCUboot bootloader.
To enable this firmware loader implementation, use the :kconfig:option:`SB_CONFIG_FIRMWARE_LOADER_IMAGE_USB_MCUMGR` Kconfig option.
* Support for using the :ref:`fw_loader_usb_mcumgr` sample with the :ref:`single_slot_sample`.
You can test this configuration on the :zephyr:board:`nrf54lm20dk` board.

Edge Impulse samples
--------------------

Expand Down
11 changes: 11 additions & 0 deletions samples/dfu/fw_loader/usb_mcumgr/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#
# Copyright (c) 2026 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(usb_mcumgr)

target_sources(app PRIVATE ${ZEPHYR_BASE}/samples/subsys/mgmt/mcumgr/smp_svr/src/main.c)
55 changes: 55 additions & 0 deletions samples/dfu/fw_loader/usb_mcumgr/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
.. _fw_loader_usb_mcumgr:

Minimal USB virtual serial port SMP firmware loader
###################################################

.. contents::
:local:
:depth: 2

This sample provides the minimal and recommended configuration for the Firmware Loader application to run on the :zephyr:board:`nrf54lm20dk`.
Comment thread
nvlsianpu marked this conversation as resolved.
It uses code from Zephyr's :zephyr:code-sample:`smp-svr` sample to enable the USB serial Simple Management Protocol (SMP) server functionality.

This sample is not intended to function as a standalone sample.
Instead, it serves as a starting point for developing a custom Firmware Loader application that works with the MCUboot bootloader.
Comment thread
nvlsianpu marked this conversation as resolved.

.. _fw_loader_usb_minimal_overview:

Requirements
************

The sample supports the following development kit:

.. table-from-sample-yaml::

.. _fw_loader_usb_minimal_build_run:

Overview
********

The application uses the SMP over Bluetooth LE to perform firmware updates and manage device operations.
Comment thread
nvlsianpu marked this conversation as resolved.
It is optimized for minimal memory usage and contains only the essential functionalities required for firmware loading.

The firmware loader over USB CDC ACM virtual serial port accepts SMP commands for:

* Image upload and management
* Device information queries
* Bootloader information

.. _fw_loader_usb_minimal_reqs:

Building and running
********************

This sample is not intended for standalone building.
It is automatically included and built when the following Kconfig options are enabled in a project configuration:

* :kconfig:option:`SB_CONFIG_BOOTLOADER_MCUBOOT`
* :kconfig:option:`SB_CONFIG_MCUBOOT_MODE_FIRMWARE_UPDATER`
* :kconfig:option:`SB_CONFIG_FIRMWARE_LOADER_IMAGE_USB_MCUMGR`


Testing
=======

This sample is not intended for standalone testing.
17 changes: 17 additions & 0 deletions samples/dfu/fw_loader/usb_mcumgr/app.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright (c) 2026 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

/ {
chosen {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems this file won't be necessary at all in case of the dongle due to the line (this will already be done by default on the dongle):

#include <../boards/common/usb/cdc_acm_serial.dtsi>

This all will happen automatically there.

Perhaps here you should also simply include the file from zephyr: boards/common/usb/cdc_acm_serial.dtsi for the DK

Also - take a look at

source "boards/common/usb/Kconfig.cdc_acm_serial.defconfig"
- perhaps some of the configuration from prj.conf won't be needed (although I doubt it)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case of the dongle configuration will be more complex (firmware_loader) that this and what you pointed:

  • dedicated cdc_acm_uart assigned for SMP MCUmgr
  • dedicated cdc_acm_uart assigned for LOG

zephyr,uart-mcumgr = &cdc_acm_uart0;
};
};

&zephyr_udc0 {
cdc_acm_uart0: cdc_acm_uart0 {
compatible = "zephyr,cdc-acm-uart";
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright (c) 2026 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

/delete-node/ &boot_partition;
/delete-node/ &slot0_partition;
/delete-node/ &slot1_partition;
/delete-node/ &storage_partition;

&cpuapp_rram {
reg = <0x0 DT_SIZE_K(1940)>;

partitions {
boot_partition: partition@0 {
label = "mcuboot";
reg = <0x0 DT_SIZE_K(24)>;
};

slot0_partition: partition@6000 {
label = "image-0";
reg = <0x6000 DT_SIZE_K(1784)>;
};

slot1_partition: partition@1c4000 {
label = "image-1";
reg = <0x1c4000 DT_SIZE_K(116)>;
};

storage_partition: partition@1e1000 {
label = "storage";
reg = <0x1e1000 DT_SIZE_K(16)>;
};
};
};

#include "../app.overlay"
92 changes: 92 additions & 0 deletions samples/dfu/fw_loader/usb_mcumgr/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Enable MCUmgr and dependencies.
CONFIG_NET_BUF=y
CONFIG_ZCBOR=y
CONFIG_CRC=y
CONFIG_MCUMGR=y
CONFIG_STREAM_FLASH=y
CONFIG_FLASH_MAP=y

# Some command handlers require a large stack.
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2304
CONFIG_MAIN_STACK_SIZE=2176

# Ensure an MCUboot-compatible binary is generated.
CONFIG_BOOTLOADER_MCUBOOT=y

# Enable flash operations.
CONFIG_FLASH=y

# Enable most core commands.
CONFIG_IMG_MANAGER=y
CONFIG_MCUMGR_GRP_IMG=y
CONFIG_MCUMGR_GRP_OS=y
CONFIG_MCUMGR_GRP_OS_BOOTLOADER_INFO=y
CONFIG_MCUMGR_GRP_OS_ECHO=n
CONFIG_MCUMGR_GRP_OS_INFO=n

# Enable the Shell mcumgr transport.
CONFIG_BASE64=y
CONFIG_CRC=y

CONFIG_MCUMGR_TRANSPORT_NETBUF_SIZE=1220
CONFIG_MCUMGR_GRP_OS_MCUMGR_PARAMS=y
CONFIG_MCUMGR_TRANSPORT_WORKQUEUE_STACK_SIZE=4608

# Enable the storage erase command.
CONFIG_MCUMGR_GRP_ZBASIC=y
CONFIG_MCUMGR_GRP_ZBASIC_STORAGE_ERASE=y

# Disable shell commands that are not needed
CONFIG_CLOCK_CONTROL_NRF_SHELL=n
CONFIG_DEVICE_SHELL=n
CONFIG_DEVMEM_SHELL=n
CONFIG_FLASH_SHELL=n

# Disable unneeded drivers, peripherals and features to optimize for size
CONFIG_SIZE_OPTIMIZATIONS=y

# Enable LTO
CONFIG_LTO=y
CONFIG_ISR_TABLES_LOCAL_DECLARATION=y

CONFIG_I2C=n
CONFIG_WATCHDOG=n
CONFIG_SPI_NOR=n
CONFIG_GPIO=n

CONFIG_FPU=n

CONFIG_BOOT_BANNER=n
CONFIG_NCS_BOOT_BANNER=n
CONFIG_BOOT_DELAY=0
CONFIG_PRINTK=n

CONFIG_ARM_MPU=n

CONFIG_TIMESLICING=n
CONFIG_COMMON_LIBC_MALLOC=y
CONFIG_LOG=n

CONFIG_UART_CONSOLE=n
CONFIG_ASSERT=n

# Enable USB subsystem
CONFIG_SERIAL=y
CONFIG_UART_LINE_CTRL=y
CONFIG_CONSOLE=y
CONFIG_USB_DEVICE_STACK_NEXT=y
CONFIG_CDC_ACM_SERIAL_INITIALIZE_AT_BOOT=y
# USB backend is serial device
CONFIG_MCUMGR_TRANSPORT_UART=y


CONFIG_PSA_USE_CRACEN_CIPHER_DRIVER=n
CONFIG_PSA_USE_CRACEN_AEAD_DRIVER=n
CONFIG_PSA_USE_CRACEN_MAC_DRIVER=n
CONFIG_PSA_USE_CRACEN_KEY_AGREEMENT_DRIVER=n
CONFIG_PSA_USE_CRACEN_ASYMMETRIC_ENCRYPTION_DRIVER=n
CONFIG_PSA_USE_CRACEN_KEY_MANAGEMENT_DRIVER=n
CONFIG_PSA_USE_CRACEN_KEY_DERIVATION_DRIVER=n
CONFIG_PSA_USE_CRACEN_PAKE_DRIVER=n
CONFIG_PSA_USE_CRACEN_ASYMMETRIC_SIGNATURE_DRIVER=n
CONFIG_PSA_USE_CRACEN_HASH_DRIVER=n
13 changes: 13 additions & 0 deletions samples/dfu/fw_loader/usb_mcumgr/sample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
sample:
name: Minimal USB CDC-ACM SMP firmware loader sample
common:
sysbuild: true
build_only: true
tests:
sample.fw_loader_usb_mcumgr:
tags:
- ci_samples_dfu
platform_allow:
- nrf54lm20dk/nrf54lm20a/cpuapp
integration_platforms:
- nrf54lm20dk/nrf54lm20a/cpuapp
3 changes: 3 additions & 0 deletions samples/dfu/fw_loader/usb_mcumgr/sysbuild.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Enable MCUboot bootloader support
SB_CONFIG_BOOTLOADER_MCUBOOT=y
SB_CONFIG_PARTITION_MANAGER=n
32 changes: 25 additions & 7 deletions samples/dfu/single_slot/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,21 @@ Overview
********

This sample contains a simple main application with no firmware update capabilities.
The firmware loader image is used to perform the DFU over Bluetooth® Low Energy.
See :ref:`ug_bootloader_using_firmware_loader_mode` for more details.
The firmware loader image is used to perform the DFU over Bluetooth® Low Energy or USB CDC ACM serial.
See :ref:`ug_bootloader_using_firmware_loader_mode` and :ref:`fw_loader_usb_mcumgr` for more details.

This sample employs the :ref:`fw_loader_ble_mcumgr` firmware loader image, which uses the Simple Management Protocol (SMP) over Bluetooth LE.
This sample employs one of alternatives:
* The :ref:`fw_loader_ble_mcumgr` firmware loader image, which uses the Simple Management Protocol (SMP) over Bluetooth LE.
* The :ref:`fw_loader_usb_mcumgr` firmware loader image, which uses the USB CDC ACM serial.

Building and running
********************

.. |sample path| replace:: :file:`samples/dfu/single_slot`

By default, the sample builds with the :ref:`fw_loader_ble_mcumgr` firmware loader image.
To build with the :ref:`fw_loader_usb_mcumgr` firmware loader image, append ``FILE_SUFFIX=usb`` to the build command.

.. include:: /includes/build_and_run.txt

Testing
Expand All @@ -47,10 +52,22 @@ After programming the sample to your development kit, perform the following step

#. Build a second version of the sample.
#. Enter the firmware loader mode by holding the **Button 0** on your development kit while you reset the device.
#. Open the `nRF Connect Device Manager`_ mobile app to perform DFU over Bluetooth LE.
The firmware loader advertises itself as **FW loader** and accepts MCUmgr image upload.
#. Send the generated update package for the second version of the sample.
See :ref:`ug_nrf54l_developing_ble_fota_steps_testing` for details on how to use the mobile app to perform the DFU.

a. Bluetooth firmware loader:

Open the `nRF Connect Device Manager`_ mobile app to perform DFU over Bluetooth® LE.

* The firmware loader advertises itself as *FW loader* and accepts MCUmgr image upload.
* Send the generated update package for the second version of the sample.
See :ref:`ug_nrf54l_developing_ble_fota_steps_testing` for details on how to use the mobile app to perform the DFU.

b. USB CDC ACM serial firmware loader:

Use `nRF Util mcu-manager serial` to perform DFU over serial port.

* Send the generated update package for the second version of the sample.
See `nRF Util mcu-manager serial`_ for details on how to use the command to perform the DFU.

#. Verify that the printed build time corresponds to the new version once the update is complete and the device reboots into the main application.

Dependencies
Expand All @@ -60,3 +77,4 @@ This sample uses the following |NCS| components:

* :ref:`MCUboot <mcuboot_index_ncs>`
* :ref:`fw_loader_ble_mcumgr` (as the firmware loader image built by sysbuild)
* :ref:`fw_loader_usb_mcumgr` (as the firmware loader image built by sysbuild)
10 changes: 10 additions & 0 deletions samples/dfu/single_slot/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,13 @@ tests:
- nrf54lm20dk/nrf54lm20a/cpuapp
- nrf54ls05dk/nrf54ls05b/cpuapp
- nrf54lm20dk/nrf54lm20b/cpuapp
sample.dfu.single_slot.usb:
tags:
- dfu_single_slot
- ci_samples_dfu
platform_allow:
- nrf54lm20dk/nrf54lm20a/cpuapp
integration_platforms:
- nrf54lm20dk/nrf54lm20a/cpuapp
extra_args:
- DFILE_SUFFIX=usb
10 changes: 10 additions & 0 deletions samples/dfu/single_slot/sysbuild_usb.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#
# Copyright (c) 2026 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

SB_CONFIG_BOOTLOADER_MCUBOOT=y
SB_CONFIG_MCUBOOT_MODE_FIRMWARE_UPDATER=y
SB_CONFIG_FIRMWARE_LOADER_IMAGE_USB_MCUMGR=y
SB_CONFIG_BOOT_SIGNATURE_TYPE_PURE=y
14 changes: 14 additions & 0 deletions sysbuild/Kconfig.firmware_loader
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ config SUPPORT_FIRMWARE_LOADER_BLE_MCUMGR
bool
default y

config SUPPORT_FIRMWARE_LOADER_USB_MCUMGR
bool
depends on SOC_NRF54LM20A_CPUAPP || SOC_NRF54LM20B_CPUAPP
default y
Comment thread
nordicjm marked this conversation as resolved.

choice FIRMWARE_LOADER

config FIRMWARE_LOADER_IMAGE_BLE_MCUMGR
Expand All @@ -17,10 +22,19 @@ config FIRMWARE_LOADER_IMAGE_BLE_MCUMGR
Include the minified firmware loader ``ble_mcumgr`` sample as the firmware loader image
to use.

config FIRMWARE_LOADER_IMAGE_USB_MCUMGR
bool "usb_mcumgr"
depends on SUPPORT_FIRMWARE_LOADER_USB_MCUMGR
help
Include the minified firmware loader ``usb_mcumgr`` sample as the firmware loader image
to use.

endchoice

config FIRMWARE_LOADER_IMAGE_NAME
default "ble_mcumgr" if FIRMWARE_LOADER_IMAGE_BLE_MCUMGR
default "usb_mcumgr" if FIRMWARE_LOADER_IMAGE_USB_MCUMGR

config FIRMWARE_LOADER_IMAGE_PATH
default "$(ZEPHYR_NRF_MODULE_DIR)/samples/dfu/fw_loader/ble_mcumgr" if FIRMWARE_LOADER_IMAGE_BLE_MCUMGR
default "$(ZEPHYR_NRF_MODULE_DIR)/samples/dfu/fw_loader/usb_mcumgr" if FIRMWARE_LOADER_IMAGE_USB_MCUMGR
Loading