Skip to content

Commit a6dc848

Browse files
committed
applications: nrf_desktop: doc: describe MCUboot RAM load mode
Updated the nRF Desktop documentation page related to the bootloaders and DFU to describe the MCUboot RAM load mode. Ref: NCSDK-36374 Signed-off-by: Kamil Piszczek <[email protected]>
1 parent 17fd650 commit a6dc848

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

applications/nrf_desktop/bootloader_dfu.rst

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,77 @@ For an example of a bootloader Kconfig configuration file defined by the applica
189189
Both mentioned firmware upgrade methods are not used simultaneously by any of the configurations.
190190
For example, the ``nrf52840dk/nrf52840`` board in ``mcuboot_smp`` file suffix uses only the background DFU and does not enable the serial recovery feature.
191191

192+
RAM load mode
193+
~~~~~~~~~~~~~
194+
195+
The RAM load mode is used for the :ref:`background DFU <nrf_desktop_bootloader_background_dfu>`.
196+
In this mode, the MCUboot bootloader uses the same NVM partitioning as the direct-xip mode (the dual-bank DFU solution).
197+
Similarly to the direct-xip mode, the RAM load mode also relies on the image version to select the application image slot to be booted.
198+
However, instead of booting the image from the NVM slot, the bootloader in the RAM load mode copies the image from the non-volatile memory (NVM) to the RAM and boots it from there.
199+
The application image is always built for the RAM address space in only one variant.
200+
201+
.. caution::
202+
The RAM load mode of the MCUboot bootloader is not officially supported in |NCS|.
203+
However, the mode is available in the |NCS| as the support for this feature has been developed as part of the Zephyr RTOS project.
204+
This feature is only used in a limited context for the ``nrf54lm20dk/nrf54lm20a/cpuapp`` board target configuration to improve performance.
205+
206+
You can use the RAM load mode of the MCUboot bootloader to speed up the code execution for the application image, as code execution from the RAM is generally faster than from the NVM.
207+
This can improve the device performance during the activities that require high CPU usage.
208+
As an example, the nRF Desktop application uses the RAM load mode for the ``nrf54lm20dk/nrf54lm20a/cpuapp`` board target to achieve 8 kHz report rate over USB in the ``release_ram_load`` configuration variant (the second configuration variant - ``ram_load`` - is used for debugging purposes only).
209+
210+
To set the MCUboot mode of operations to the RAM load mode, enable the :kconfig:option:`SB_CONFIG_MCUBOOT_MODE_RAM_LOAD` Kconfig option in the sysbuild configuration.
211+
212+
To support the RAM load mode, you must use DTS as the partitioning method, as the Partition Manager (PM) is not supported in this mode.
213+
To satisfy this requirement, disable explicitly the :kconfig:option:`SB_CONFIG_PARTITION_MANAGER` Kconfig option in your sysbuild configuration.
214+
Additionally, you must define the custom memory layout for the RAM in your target board configuration.
215+
Your RAM layout must define the following DTS child nodes as part of the ``cpuapp_sram`` DTS node in the address order listed below:
216+
217+
* ``cpuapp_sram_app_rxm_region`` - This DTS node defines the hard limits for the executable ROM section (with the application image) and must be aligned with the :kconfig:option:`CONFIG_BOOT_IMAGE_EXECUTABLE_RAM_START` and the :kconfig:option:`CONFIG_BOOT_IMAGE_EXECUTABLE_RAM_SIZE` Kconfig options that are set in the MCUboot image configuration.
218+
This DTS node describes the region in which the build system places the executable ROM section (code) and RAM section (data) of the application image.
219+
The RAM section is located right after the ROM section - the RAM section may overflow the ``cpuapp_sram_app_rxm_region`` region and spill into the subsequent ``cpuapp_sram_mcuboot_ram_region`` region or even be entirely contained in this subsequent region.
220+
The ``cpuapp_sram_mcuboot_ram_region`` region can be filled with the RAM section of the application image, as the application and bootloader code cannot run simultaneously.
221+
* ``cpuapp_sram_mcuboot_ram_region`` - This DTS node defines the RAM region for the MCUboot image and must be assigned to the MCUboot image as its chosen SRAM DTS node.
222+
223+
For an example of the custom RAM layout that satisfies these requirements, see the :file:`nrf/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/memory_map_ram_load.dtsi` file.
224+
For an example of the RAM layout usage in the MCUboot bootloader image, see the :file:`nrf/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/images/mcuboot/app_ram_load.overlay` file.
225+
226+
.. note::
227+
The application image and the MCUboot image configuration must use the same memory layout.
228+
229+
The RAM load mode requires using the Zephyr retention subsystem with the bootloader information sharing system.
230+
This subsystem is used by the MCUboot bootloader to provide image metadata to the application image.
231+
To enable the Zephyr retention subsystem, enable the following Kconfig options in your application image configuration and the MCUboot image configuration:
232+
233+
* :kconfig:option:`CONFIG_RETENTION`
234+
* :kconfig:option:`CONFIG_RETAINED_MEM`
235+
* :kconfig:option:`CONFIG_RETAINED_MEM_ZEPHYR_RAM`
236+
237+
In the application image configuration, enable the following Kconfig options:
238+
239+
* :kconfig:option:`CONFIG_RETENTION_BOOTLOADER_INFO`
240+
* :kconfig:option:`CONFIG_RETENTION_BOOTLOADER_INFO_TYPE_MCUBOOT`
241+
* :kconfig:option:`CONFIG_RETENTION_BOOTLOADER_INFO_OUTPUT_FUNCTION`
242+
243+
In the MCUboot image configuration, enable the following Kconfig options:
244+
245+
* :kconfig:option:`CONFIG_BOOT_SHARE_DATA`
246+
* :kconfig:option:`CONFIG_BOOT_SHARE_DATA_BOOTINFO`
247+
* :kconfig:option:`CONFIG_BOOT_SHARE_BACKEND_RETENTION`
248+
249+
The Zephyr retention subsystem requires the retention partition to be defined in the devicetree.
250+
For an example of the retention partition definition, see the :file:`nrf/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/memory_map_ram_load.dtsi` file.
251+
You must also assign the retention partition to the chosen DTS node ``zephyr,bootloader-info`` in both the application image configuration and the MCUboot image configuration.
252+
253+
.. note::
254+
If your board target uses the Key Management Unit (KMU) feature (:kconfig:option:`CONFIG_CRACEN_LIB_KMU`), you must additionally define the ``nrf_kmu_reserved_push_area`` DTS node in your custom memory layout.
255+
Place this RAM section at the very beginning of the physical RAM due to the dependency on the ``nrfutil device`` tool and its KMU provisioning functionality.
256+
For an example of the ``nrf_kmu_reserved_push_area`` DTS node definition, see the :file:`nrf/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/memory_map_ram_load.dtsi` file.
257+
258+
The KMU feature (:kconfig:option:`CONFIG_CRACEN_LIB_KMU`) is enabled by default for the nRF54L series.
259+
260+
.. note::
261+
The RAM load mode of the MCUboot bootloader is not yet integrated in the :ref:`nrf_desktop_dfu_mcumgr`.
262+
192263
MCUboot bootloader on nRF54
193264
---------------------------
194265

0 commit comments

Comments
 (0)