Skip to content

Conversation

@kapi-no
Copy link
Contributor

@kapi-no kapi-no commented Nov 19, 2025

Side PRs:

Other potential improvements:

  • Create and finalise a PR moving the main linker script nrf_desktop.ld to the newly created linker directory so that we can have all linker scripts in one place

@kapi-no kapi-no requested review from a team as code owners November 19, 2025 08:19
@NordicBuilder NordicBuilder added the changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. label Nov 19, 2025
@NordicBuilder
Copy link
Contributor

NordicBuilder commented Nov 19, 2025

CI Information

To view the history of this post, click the 'edited' button above
Build number: 4

Inputs:

Sources:

sdk-nrf: PR head: e4d08c06c05b6817b33717c97a9e1dd0904ab1c4

more details

sdk-nrf:

PR head: e4d08c06c05b6817b33717c97a9e1dd0904ab1c4
merge base: 15efef3f4f99bd43cc7b7dcba28d1db5ead7eeb6
target head (main): 8c57fe56d393c39bd9af8944787f55181b02760c
Diff

Github labels

Enabled Name Description
ci-disabled Disable the ci execution
ci-all-test Run all of ci, no test spec filtering will be done
ci-force-downstream Force execution of downstream even if twister fails
ci-run-twister Force run twister
ci-run-zephyr-twister Force run zephyr twister
List of changed files detected by CI (19)
applications
│  ├── nrf_desktop
│  │  ├── CMakeLists.txt
│  │  ├── configuration
│  │  │  ├── nrf54lm20dk_nrf54lm20a_cpuapp
│  │  │  │  ├── app_common.dtsi
│  │  │  │  ├── images
│  │  │  │  │  ├── mcuboot
│  │  │  │  │  │  ├── app.overlay
│  │  │  │  │  │  ├── prj.conf
│  │  │  │  │  │  ├── prj_llvm.conf
│  │  │  │  │  │  │ prj_release.conf
│  │  │  │  ├── memory_map.dtsi
│  │  │  │  ├── pm_static.yml
│  │  │  │  ├── pm_static_llvm.yml
│  │  │  │  ├── pm_static_release.yml
│  │  │  │  ├── prj.conf
│  │  │  │  ├── prj_llvm.conf
│  │  │  │  ├── prj_release.conf
│  │  │  │  ├── sysbuild.conf
│  │  │  │  ├── sysbuild_llvm.conf
│  │  │  │  │ sysbuild_release.conf
│  │  ├── linker
│  │  │  │ config_channel_dfu_ram_load.ld
│  │  ├── src
│  │  │  ├── modules
│  │  │  │  ├── Kconfig.config_channel
│  │  │  │  │ dfu.c

Outputs:

Toolchain

Version: df3cc9d822
Build docker image: docker-dtr.nordicsemi.no/sw-production/ncs-build:df3cc9d822_e595b21c39

Test Spec & Results: ✅ Success; ❌ Failure; 🟠 Queued; 🟡 Progress; ◻️ Skipped; ⚠️ Quarantine

  • ◻️ Toolchain - Skipped: existing toolchain is used
  • ✅ Build twister
    • sdk-nrf test count: 49
  • ✅ Integration tests
    • ✅ desktop52_verification
Disabled integration tests
    • test-fw-nrfconnect-nrf_lrcs_positioning
    • test_ble_nrf_config
    • test-fw-nrfconnect-apps
    • test-fw-nrfconnect-ble_mesh
    • test-fw-nrfconnect-ble_samples
    • test-fw-nrfconnect-chip
    • test-fw-nrfconnect-fem
    • test-fw-nrfconnect-nfc
    • test-fw-nrfconnect-nrf-iot_libmodem-nrf
    • test-fw-nrfconnect-nrf-iot_lwm2m
    • test-fw-nrfconnect-nrf-iot_samples
    • test-fw-nrfconnect-nrf-iot_thingy91
    • test-fw-nrfconnect-nrf-iot_zephyr_lwm2m
    • test-fw-nrfconnect-nrf_crypto
    • test-fw-nrfconnect-ps-main
    • test-fw-nrfconnect-rpc
    • test-fw-nrfconnect-rs
    • test-fw-nrfconnect-tfm
    • test-fw-nrfconnect-thread-main
    • test-low-level
    • test-sdk-audio
    • test-sdk-dfu
    • test-sdk-find-my
    • test-sdk-mcuboot
    • test-sdk-wifi
    • test-secdom-samples-public

Note: This message is automatically posted and updated by the CI

@kapi-no kapi-no force-pushed the nrf_desktop_nrf54lm20dk_ram_load branch from 25781ba to 8daea40 Compare November 19, 2025 08:23
@github-actions
Copy link

github-actions bot commented Nov 19, 2025

You can find the documentation preview for this PR here.

Preview links for modified nRF Connect SDK documents:

https://ncsdoc.z6.web.core.windows.net/PR-25661/nrf/applications/nrf_desktop/doc/dfu.html

@NordicBuilder
Copy link
Contributor

NordicBuilder commented Nov 19, 2025

Memory footprint analysis revealed the following potential issues

applications.nrf_desktop.zdebug.uart[nrf54lm20dk/nrf54lm20a/cpuapp]: RAM size increased by 344725[B] in comparison to the main[3524638] branch. - link (cc: @nrfconnect/ncs-si-bluebagel)
applications.nrf_desktop.zdebug[nrf52833dk/nrf52820]: ROM size increased by 540[B] in comparison to the main[3524638] branch. - link (cc: @nrfconnect/ncs-si-bluebagel)
applications.nrf_desktop.zdebug_dongle.uart[nrf54h20dk@0.9.0/nrf54h20/cpuapp]: ROM size increased by 752[B] in comparison to the main[3524638] branch. - link (cc: @nrfconnect/ncs-si-bluebagel)
applications.nrf_desktop.zrelease.usb_next[nrf52840dk/nrf52840]: ROM size increased by 768[B] in comparison to the main[3524638] branch. - link (cc: @nrfconnect/ncs-si-bluebagel)
applications.nrf_desktop.zrelease[nrf52840dongle/nrf52840]: ROM size increased by 1632[B] in comparison to the main[3524638] branch. - link (cc: @nrfconnect/ncs-si-bluebagel)
applications.nrf_desktop.zrelease[nrf52840gmouse/nrf52840]: ROM size increased by 1064[B] in comparison to the main[3524638] branch. - link (cc: @nrfconnect/ncs-si-bluebagel)
applications.nrf_desktop.zrelease[nrf5340dk/nrf5340/cpuapp]: ROM size increased by 1820[B] in comparison to the main[3524638] branch. - link (cc: @nrfconnect/ncs-si-bluebagel)
applications.nrf_desktop.zrelease[nrf54h20dk@0.9.0/nrf54h20/cpuapp]: ROM size increased by 804[B] in comparison to the main[3524638] branch. - link (cc: @nrfconnect/ncs-si-bluebagel)
applications.nrf_desktop.zrelease[nrf54l15dk/nrf54l15/cpuapp]: ROM size increased by 724[B] in comparison to the main[3524638] branch. - link (cc: @nrfconnect/ncs-si-bluebagel)
applications.nrf_desktop.zrelease[nrf54lm20dk/nrf54lm20a/cpuapp]: RAM size increased by 247397[B] in comparison to the main[3524638] branch. - link (cc: @nrfconnect/ncs-si-bluebagel)
applications.nrf_desktop.zrelease[nrf54lm20dk/nrf54lm20a/cpuapp]: ROM size increased by 3789[B] in comparison to the main[3524638] branch. - link (cc: @nrfconnect/ncs-si-bluebagel)
applications.nrf_desktop.zrelease_dongle[nrf54h20dk@0.9.0/nrf54h20/cpuapp]: ROM size increased by 1396[B] in comparison to the main[3524638] branch. - link (cc: @nrfconnect/ncs-si-bluebagel)

Note: This message is automatically posted and updated by the CI (latest/sdk-nrf/PR-25661/4)


&cpuapp_rram {
/* Application does not use cpuflpr core. Assign whole RRAM to cpuapp. */
reg = < 0x0 DT_SIZE_K(2036) >;
Copy link
Contributor

Choose a reason for hiding this comment

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

<value value> style, no space after < and before >

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@kapi-no kapi-no force-pushed the nrf_desktop_nrf54lm20dk_ram_load branch from 8daea40 to 729480a Compare November 20, 2025 11:17
@kapi-no
Copy link
Contributor Author

kapi-no commented Nov 20, 2025

Pushed an update with the following additions:

  1. KMU support.
  2. Removal of the CONFIG_BOOT_MAX_IMG_SECTORS Kconfig, which throws a warning and is not necessary when using DTS for partitioning.

@kapi-no kapi-no force-pushed the nrf_desktop_nrf54lm20dk_ram_load branch from 729480a to e4d08c0 Compare November 20, 2025 14:09
* RAM due to the dependency on the nrfutil device tool and its KMU
* provisioning functionality.
*/
nrf_kmu_reserved_push_area: memory@0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

reserved memory is for hardware only, so KMU usage is fine, DMA usage is fine...

* both the MCUboot image and the application code. Currently, it is used
* to share the image metadata between the bootloader and the application.
*/
cpuapp_sram_retained_mem_region: memory@400 {
Copy link
Contributor

Choose a reason for hiding this comment

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

this though is not, this is normal RAM, it needs to be a child of the sram node, see the retention doc in zephyr for an example

#address-cells = <1>;
#size-cells = <1>;
ranges = <0x0 0x7a400 DT_SIZE_K(20)>;
};
Copy link
Contributor

Choose a reason for hiding this comment

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

so it can be moved here

SYMBOLS __start_config_channel_modules __stop_config_channel_modules
KEEP SORT NAME)
if(CONFIG_DESKTOP_CONFIG_CHANNEL_DFU_MCUBOOT_RAM_LOAD)
zephyr_linker_sources(RODATA linker/config_channel_dfu_ram_load.ld)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add zephyr_linker_section/zephyr_iterable_section too? This commit suggests that it's needed for IAR: b937d94

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think we have to, as we just perform validation as part of this linker section without creating any new symbols

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please check if the assertion is properly triggered for LLVM? (to ensure no silent errors in the future)

validate if the executable RAM region of the application image does not overlap with
the RAM region of the MCUboot image.

config DESKTOP_CONFIG_CHANNEL_DFU_MCUBOOT_UNSPECIFIED
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider listing the swap mode explicitly too. Then we might e.g. emit an error/warning log in case MCUboot mode unsupported by the module is selected


config DESKTOP_CONFIG_CHANNEL_DFU_MCUBOOT_RAM_LOAD
bool "Adjust the DFU module to be compatible with the RAM load mode of MCUboot"
depends on USE_DT_CODE_PARTITION
Copy link
Contributor

@MarekPieta MarekPieta Nov 21, 2025

Choose a reason for hiding this comment

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

Dependency on disabled Partition Manager might be even more relevant here (we might need a build assert here)

Copy link
Contributor

Choose a reason for hiding this comment

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

btw. Would it work also for other platforms (e.g. nRF52)? We might limit support to nRF54LM20 (temporarily) if needed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think so

prompt "Adjust the DFU module to be compatible with the specific mode of MCUboot"
depends on BOOTLOADER_MCUBOOT
default y if MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP
default DESKTOP_CONFIG_CHANNEL_DFU_MCUBOOT_DIRECT_XIP if MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider using depends on for bootloader modes instead of setting default (that should allow to skip the newly introduced build asserts)

Copy link
Contributor

Choose a reason for hiding this comment

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

Or maybe we could even use MCUBOOT_BOOTLOADER_MODE_XYZ options directly?

* Currently, the revert feature is only supported by the MCUboot bootloader that
* is not configured for the standard direct-xip or RAM load mode.
*/
#define DFU_REVERT_FEATURE_IS_SUPPORTED \
Copy link
Contributor

Choose a reason for hiding this comment

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

MCUBOOT_REVERT_FEATURE_IS_SUPPORTED (as we refer to MCUboot's revert feature)

Copy link
Contributor

Choose a reason for hiding this comment

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

Or maybe even MCUBOOT_IMAGE_CONFIRM_NEEDED (to indicate that we need to confirm the image after it's uploaded)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We also need to set the test bit with the boot_request_upgrade API

I will stick to the REVERT variant, it is easily associated with most mcuboot modes

CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT
CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD_WITH_REVERT

*/
cpuapp_sram_retained_mem_region: memory@400 {
compatible = "zephyr,memory-region", "mmio-sram";
reg = <0x400 DT_SIZE_K(1)>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we explain why we have a gap between nrf_kmu_reserved_push_area and RetainedMem?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also: maybe we could set size to 0x100 for now and expand when needed (currently part of the retained RAM seems unused)

* this region, but the ROM section of the application image must never
* fill this region. This DTS node must be assigned to the MCUboot image
* as its chosen SRAM DTS node. The usage of this SRAM region should not
* be close to the maximum size of this region (100%), as the System Heap
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be good to check what it the System Heap used for in MCUboot. Maybe we could simply disabled it: CONFIG_COMMON_LIBC_MALLOC=n?

Similarly for the application image (nRF Desktop relies on k_malloc)


slot0_partition: partition@c000 {
label = "image-0";
reg = <0xc000 DT_SIZE_K(984)>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense to use partition size greater than DK_SIZE_K(489) here? Maybe we could leave part of the memory unused (as it would not be possible to boot bigger image from SRAM anyway)?

Copy link
Contributor

Choose a reason for hiding this comment

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

Discussed offline, lowering partition size here would not trigger build errors related to partition memory overflows anyway (build system reports FLASH usage of 0).

@@ -0,0 +1,3 @@
/* Validate that the executable RAM region does not overlap with the MCUboot RAM region. */
ASSERT(__rom_region_end <= CONFIG_DESKTOP_CONFIG_CHANNEL_DFU_MCUBOOT_RAM_LOAD_MCUBOOT_RAM_START_ADDR,
Copy link
Contributor

@MarekPieta MarekPieta Nov 21, 2025

Choose a reason for hiding this comment

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

I am worried that the assertion might not always be valid (e.g. if user specifies MCUboot's RAM earlier in memory).

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we at least add a brief comment explaining our assumptions, please?

config DESKTOP_CONFIG_CHANNEL_DFU_MCUBOOT_RAM_LOAD
bool "Adjust the DFU module to be compatible with the RAM load mode of MCUboot"
depends on USE_DT_CODE_PARTITION
depends on $(dt_nodelabel_exists,cpuapp_sram_mcuboot_ram_region)
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider using BUILD_ASSERT instead of dependency here (now you might end up with accidentally set CONFIG_DESKTOP_CONFIG_CHANNEL_DFU_MCUBOOT_UNSPECIFIED)

bool "Adjust the DFU module to be compatible with the RAM load mode of MCUboot"
depends on USE_DT_CODE_PARTITION
depends on $(dt_nodelabel_exists,cpuapp_sram_mcuboot_ram_region)
select EXPERIMENTAL
Copy link
Contributor

Choose a reason for hiding this comment

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

Reminder: Make sure that some sort of experimental warning is emitted to the end-user if we remove these app-specific options.


SB_CONFIG_BOOTLOADER_MCUBOOT=y
SB_CONFIG_MCUBOOT_MODE_DIRECT_XIP=y
SB_CONFIG_MCUBOOT_MODE_RAM_LOAD=y
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we shouldn't leave one configuration that uses SB_CONFIG_MCUBOOT_MODE_DIRECT_XIP to have both DFU methods support for nRF54LM20. Thanks to that we could have configuration that is not "experimental" (but has report rate issues in USB HS mode).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can discuss it offline

@kapi-no kapi-no force-pushed the nrf_desktop_nrf54lm20dk_ram_load branch 2 times, most recently from b0749a4 to f7436ee Compare November 24, 2025 15:33
@kapi-no kapi-no requested a review from a team as a code owner November 24, 2025 15:33
Added support for the RAM load mode of the MCUboot bootloader to
the nRF Desktop application DFU module.

Added a linker script with the assert statement that prevents the
executable RAM region of the application image to overflow the
standard RAM region of the MCUboot image.

Ref: NCSDK-35506

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
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 <aleksander.strzebonski@nordicsemi.no>
Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
@NordicBuilder NordicBuilder added the doc-required PR must not be merged without tech writer approval. label Nov 24, 2025
Copy link
Contributor

@alstrzebonski alstrzebonski left a comment

Choose a reason for hiding this comment

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

LGTM - one comment to discuss tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. doc-required PR must not be merged without tech writer approval.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants