Skip to content

Commit 8daea40

Browse files
committed
applications: nrf_desktop: nrf54lm20dk: increase USB HS report rate
Updated the nRF54LM20 DK configuration in the nRF Desktop application to increase the USB High Speed performance by executing application code from RAM. Due to this change, the application can now consistently maintain the 8000Hz report rate in the mouse release configuration. To execute code from RAM, the MCUboot mode has been changed from the direct-xip mode to the RAM load mode. The bootloader now copies the newer application image from one of two RRAM slots into the RAM region and then it starts the application from RAM. To support RAM load mode of the MCUboot bootloader, the partitioning method has been changed from the Partition Manager (PM) to devicetree (DTS). Currently, the PM is not properly supported in the RAM load mode. Ref: NCSDK-35506 Signed-off-by: Aleksander Strzebonski <[email protected]> Signed-off-by: Kamil Piszczek <[email protected]>
1 parent c6d0e27 commit 8daea40

File tree

15 files changed

+239
-157
lines changed

15 files changed

+239
-157
lines changed

applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/app_common.dtsi

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,16 @@
44
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
55
*/
66

7-
/* Application does not use cpuflpr core. Assign whole RRAM to cpuapp. */
8-
&cpuapp_rram {
9-
reg = < 0x0 DT_SIZE_K(2036) >;
10-
};
7+
#include "memory_map.dtsi"
118

129
/ {
10+
chosen {
11+
/* We need to point where we want to place the retained memory region that
12+
* is shared with the application image and contains the image metadata.
13+
*/
14+
zephyr,bootloader-info = &boot_info0;
15+
};
16+
1317
/* Disable pwmleds and redefine them to align configuration with CAF LEDs requirements. */
1418
/delete-node/ pwmleds;
1519

applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/images/mcuboot/app.overlay

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,17 @@
44
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
55
*/
66

7-
/* Application does not use cpuflpr core. Assign whole RRAM to cpuapp. */
8-
&cpuapp_rram {
9-
reg = < 0x0 DT_SIZE_K(2036) >;
7+
#include "../../memory_map.dtsi"
8+
9+
/ {
10+
chosen {
11+
/* We need to point where we want to place MCUboot code. */
12+
zephyr,code-partition = &boot_partition;
13+
/* We need to point where we want to place MCUboot RAM region. */
14+
zephyr,sram = &cpuapp_sram_mcuboot_ram_region;
15+
/* We need to point where we want to place the retained memory region that
16+
* is shared with the application image and contains the image metadata.
17+
*/
18+
zephyr,bootloader-info = &boot_info0;
19+
};
1020
};

applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/images/mcuboot/prj.conf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ CONFIG_BOOT_VERSION_CMP_USE_BUILD_NUMBER=y
1515

1616
CONFIG_FLASH=y
1717

18+
# Enable retained memory and retention to support the MCUboot RAM load mode.
19+
CONFIG_RETAINED_MEM=y
20+
CONFIG_RETENTION=y
21+
CONFIG_RETAINED_MEM_ZEPHYR_RAM=y
22+
CONFIG_BOOT_SHARE_DATA=y
23+
CONFIG_BOOT_SHARE_DATA_BOOTINFO=y
24+
CONFIG_BOOT_SHARE_BACKEND_RETENTION=y
25+
1826
# Reduce memory consumption
1927
CONFIG_BOOT_BANNER=n
2028
CONFIG_NCS_BOOT_BANNER=n
@@ -36,3 +44,7 @@ CONFIG_ISR_TABLES_LOCAL_DECLARATION=y
3644

3745
# Improve debugging experience by disabling reset on fatal error
3846
CONFIG_RESET_ON_FATAL_ERROR=n
47+
48+
# Set according to the configuration of the cpuapp_sram_app_rxm_region DTS node.
49+
CONFIG_BOOT_IMAGE_EXECUTABLE_RAM_START=0x20000000
50+
CONFIG_BOOT_IMAGE_EXECUTABLE_RAM_SIZE=517120

applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/images/mcuboot/prj_llvm.conf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ CONFIG_BOOT_VERSION_CMP_USE_BUILD_NUMBER=y
1515

1616
CONFIG_FLASH=y
1717

18+
# Enable retained memory and retention to support the MCUboot RAM load mode.
19+
CONFIG_RETAINED_MEM=y
20+
CONFIG_RETENTION=y
21+
CONFIG_RETAINED_MEM_ZEPHYR_RAM=y
22+
CONFIG_BOOT_SHARE_DATA=y
23+
CONFIG_BOOT_SHARE_DATA_BOOTINFO=y
24+
CONFIG_BOOT_SHARE_BACKEND_RETENTION=y
25+
1826
# Reduce memory consumption
1927
CONFIG_BOOT_BANNER=n
2028
CONFIG_NCS_BOOT_BANNER=n
@@ -36,3 +44,7 @@ CONFIG_ISR_TABLES_LOCAL_DECLARATION=n
3644

3745
# Improve debugging experience by disabling reset on fatal error
3846
CONFIG_RESET_ON_FATAL_ERROR=n
47+
48+
# Set according to the configuration of the cpuapp_sram_app_rxm_region DTS node.
49+
CONFIG_BOOT_IMAGE_EXECUTABLE_RAM_START=0x20000000
50+
CONFIG_BOOT_IMAGE_EXECUTABLE_RAM_SIZE=517120

applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/images/mcuboot/prj_release.conf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ CONFIG_BOOT_VERSION_CMP_USE_BUILD_NUMBER=y
1616

1717
CONFIG_FLASH=y
1818

19+
# Enable retained memory and retention to support the MCUboot RAM load mode.
20+
CONFIG_RETAINED_MEM=y
21+
CONFIG_RETENTION=y
22+
CONFIG_RETAINED_MEM_ZEPHYR_RAM=y
23+
CONFIG_BOOT_SHARE_DATA=y
24+
CONFIG_BOOT_SHARE_DATA_BOOTINFO=y
25+
CONFIG_BOOT_SHARE_BACKEND_RETENTION=y
26+
1927
CONFIG_RESET_ON_FATAL_ERROR=y
2028

2129
# Reduce memory consumption
@@ -36,3 +44,7 @@ CONFIG_USE_SEGGER_RTT=n
3644
# Activate Link Time Optimization (LTO)
3745
CONFIG_LTO=y
3846
CONFIG_ISR_TABLES_LOCAL_DECLARATION=y
47+
48+
# Set according to the configuration of the cpuapp_sram_app_rxm_region DTS node.
49+
CONFIG_BOOT_IMAGE_EXECUTABLE_RAM_START=0x20000000
50+
CONFIG_BOOT_IMAGE_EXECUTABLE_RAM_SIZE=517120
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
&cpuapp_rram {
8+
/* Application does not use cpuflpr core. Assign whole RRAM to cpuapp. */
9+
reg = < 0x0 DT_SIZE_K(2036) >;
10+
11+
/* Redefine the "partitions" DTS node. */
12+
/delete-node/ partitions;
13+
14+
partitions {
15+
compatible = "fixed-partitions";
16+
#address-cells = <1>;
17+
#size-cells = <1>;
18+
19+
/* Significantly increase the size of the MCUboot partition to make it fit
20+
* for the LLVM configuration variant.
21+
*/
22+
boot_partition: partition@0 {
23+
label = "mcuboot";
24+
reg = <0x0 DT_SIZE_K(48)>;
25+
};
26+
27+
slot0_partition: partition@c000 {
28+
label = "image-0";
29+
reg = <0xc000 DT_SIZE_K(984)>;
30+
};
31+
32+
slot1_partition: partition@102000 {
33+
label = "image-1";
34+
reg = <0x102000 DT_SIZE_K(984)>;
35+
};
36+
37+
storage_partition: partition@1f8000 {
38+
label = "storage";
39+
reg = <0x1f8000 DT_SIZE_K(20)>;
40+
};
41+
};
42+
};
43+
44+
/ {
45+
soc {
46+
/* Redefine the "cpuapp_sram" DTS node and specify the necessary RAM subregions
47+
* that can be used to configure the MCUboot image. This DTS node must be assigned
48+
* to the application image as its chosen SRAM DTS node. The build system places
49+
* the executable ROM section (code) at the beginning of this region and the RAM
50+
* section (data) right after the ROM section. The usage of this SRAM region should
51+
* not be close to the maximum size of this region (100%), as the System Heap is
52+
* located in the unused part of this region. It is recommended to have at least
53+
* 1kB of unused space.
54+
*/
55+
cpuapp_sram: memory@20000000 {
56+
compatible = "mmio-sram";
57+
reg = <0x20000000 DT_SIZE_K(510)>;
58+
#address-cells = <1>;
59+
#size-cells = <1>;
60+
ranges = <0x0 0x20000000 DT_SIZE_K(510)>;
61+
62+
/* SRAM region for storing the ROM section (code) and RAM section (data) of
63+
* the application image. The RAM section of the application image may also
64+
* partially or fully fill the subsequent SRAM region called
65+
* "cpuapp_sram_mcuboot_ram_region", but its ROM section must never fill
66+
* this region. It is recommended to use this DTS node for configuration
67+
* of the executable SRAM region in the MCUboot image. This RAM region
68+
* should be aligned with the following Kconfig options in MCUboot:
69+
* - CONFIG_BOOT_IMAGE_EXECUTABLE_RAM_START
70+
* - CONFIG_BOOT_IMAGE_EXECUTABLE_RAM_SIZE
71+
*/
72+
cpuapp_sram_app_rxm_region: memory@0 {
73+
compatible = "mmio-sram";
74+
reg = <0x0 DT_SIZE_K(490)>;
75+
#address-cells = <1>;
76+
#size-cells = <1>;
77+
ranges = <0x0 0x0 DT_SIZE_K(490)>;
78+
};
79+
80+
/* SRAM region for storing the RAM section (data) of the MCUboot image. The
81+
* RAM section of the application image may also partially or fully fill
82+
* this region, but the ROM section of the application image must never
83+
* fill this region. This DTS node must be assigned to the MCUboot image
84+
* as its chosen SRAM DTS node. The usage of this SRAM region should not
85+
* be close to the maximum size of this region (100%), as the System Heap
86+
* is located in the unused part of this region. It is recommended to have
87+
* at least 1kB of unused space.
88+
*/
89+
cpuapp_sram_mcuboot_ram_region: memory@7a800 {
90+
compatible = "mmio-sram";
91+
reg = <0x7a800 DT_SIZE_K(20)>;
92+
#address-cells = <1>;
93+
#size-cells = <1>;
94+
ranges = <0x0 0x7a800 DT_SIZE_K(20)>;
95+
};
96+
};
97+
98+
/* SRAM region that is retained across reboots. This region is shared by both the
99+
* MCUboot image and the application code. Currently, it is used to share the image
100+
* metadata between the bootloader and the application.
101+
*/
102+
cpuapp_sram_retained_mem_region: memory@2007f800 {
103+
compatible = "zephyr,memory-region", "mmio-sram";
104+
reg = <0x2007f800 DT_SIZE_K(1)>;
105+
zephyr,memory-region = "RetainedMem";
106+
status = "okay";
107+
108+
retainedmem {
109+
compatible = "zephyr,retained-ram";
110+
status = "okay";
111+
#address-cells = <1>;
112+
#size-cells = <1>;
113+
114+
boot_info0: boot_info@0 {
115+
compatible = "zephyr,retention";
116+
status = "okay";
117+
reg = <0x0 0x100>;
118+
};
119+
};
120+
};
121+
};
122+
};

applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/pm_static.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/pm_static_llvm.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/pm_static_release.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)