Skip to content

Commit e2bda34

Browse files
committed
samples: Add sample to verify bootloader requests
Add a sample variant that can be used to verify the bootloader request module. Signed-off-by: Tomasz Chyrowicz <[email protected]>
1 parent 84661e7 commit e2bda34

File tree

8 files changed

+168
-1
lines changed

8 files changed

+168
-1
lines changed

modules/mcuboot/Kconfig

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,29 @@ config MCUBOOT_USE_ALL_AVAILABLE_RAM
7272
By default MCUBoot uses only the secure RAM partition.
7373

7474
endmenu
75+
76+
config MCUBOOT_BOOT_REQUEST
77+
bool "MCUboot bootloader requests"
78+
help
79+
Handle bootloader requests.
80+
81+
if MCUBOOT_BOOT_REQUEST
82+
83+
choice MCUBOOT_BOOT_REQUEST_IMPL
84+
prompt "Shared memory backend"
85+
default MCUBOOT_BOOT_REQUEST_IMPL_RETENTION if RETENTION
86+
87+
config MCUBOOT_BOOT_REQUEST_IMPL_RETENTION
88+
bool "Retention"
89+
depends on RETENTION
90+
help
91+
Use zephyr,bootloader-request chosen node compatible with the
92+
zephyr,retention driver as the memory area to store and read from the
93+
bootloader requests.
94+
The built-in prefix property should be used to indicate the request
95+
structure version to ensure compatibility between the bootloader and
96+
the application.
97+
98+
endchoice
99+
100+
endif # MCUBOOT_BOOT_REQUEST
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
#include "../sysbuild/nrf54h20dk_nrf54h20_memory_map_requests.dtsi"
8+
9+
/ {
10+
chosen {
11+
zephyr,boot-mode = &boot_request;
12+
};
13+
};
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Enable MCUmgr and dependencies.
2+
CONFIG_NET_BUF=y
3+
CONFIG_ZCBOR=y
4+
CONFIG_CRC=y
5+
CONFIG_MCUMGR=y
6+
CONFIG_STREAM_FLASH=y
7+
CONFIG_FLASH_MAP=y
8+
9+
# Some command handlers require a large stack.
10+
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2304
11+
CONFIG_MAIN_STACK_SIZE=2176
12+
13+
# Ensure an MCUboot-compatible binary is generated.
14+
CONFIG_BOOTLOADER_MCUBOOT=y
15+
16+
# Enable flash operations.
17+
CONFIG_FLASH=y
18+
19+
# Required by the `taskstat` command.
20+
CONFIG_THREAD_MONITOR=y
21+
22+
# Support for taskstat command
23+
CONFIG_MCUMGR_GRP_OS_TASKSTAT=y
24+
25+
# Enable statistics and statistic names.
26+
CONFIG_STATS=y
27+
CONFIG_STATS_NAMES=y
28+
29+
# Enable most core commands.
30+
CONFIG_FLASH=y
31+
CONFIG_IMG_MANAGER=y
32+
CONFIG_MCUMGR_GRP_IMG=y
33+
CONFIG_MCUMGR_GRP_OS=y
34+
CONFIG_MCUMGR_GRP_STAT=y
35+
36+
# Enable logging
37+
CONFIG_LOG=y
38+
CONFIG_MCUBOOT_UTIL_LOG_LEVEL_WRN=y
39+
40+
# Disable debug logging
41+
CONFIG_LOG_MAX_LEVEL=3
42+
43+
# Enable boot requests through retained memory.
44+
CONFIG_RETAINED_MEM=y
45+
CONFIG_RETENTION=y
46+
CONFIG_MCUBOOT_BOOT_REQUEST=y
47+
48+
CONFIG_RETENTION_BOOT_MODE=y
49+
CONFIG_MCUMGR_GRP_OS_RESET_BOOT_MODE=y

samples/zephyr/subsys/mgmt/mcumgr/smp_svr/sample.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,17 @@ tests:
4242
- nrf54h20dk/nrf54h20/cpuapp
4343
integration_platforms:
4444
- nrf54h20dk/nrf54h20/cpuapp
45+
sample.mcumgr.smp_svr.bt.nrf54h20dk.direct_xip_withrequests:
46+
sysbuild: true
47+
extra_args:
48+
- FILE_SUFFIX="requests"
49+
- EXTRA_CONF_FILE="overlay-bt.conf"
50+
- SB_CONFIG_NETCORE_IPC_RADIO=y
51+
- SB_CONFIG_NETCORE_IPC_RADIO_BT_HCI_IPC=y
52+
- SB_CONFIG_MCUBOOT_MODE_DIRECT_XIP_WITH_REVERT=y
53+
- mcuboot_CONFIG_NRF_SECURITY=y
54+
- mcuboot_CONFIG_MULTITHREADING=y
55+
platform_allow:
56+
- nrf54h20dk/nrf54h20/cpuapp
57+
integration_platforms:
58+
- nrf54h20dk/nrf54h20/cpuapp
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Enable boot requests through retained memory.
2+
CONFIG_RETAINED_MEM=y
3+
CONFIG_RETENTION=y
4+
CONFIG_MCUBOOT_BOOT_REQUEST=y
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
#include "nrf54h20dk_nrf54h20_memory_map_requests.dtsi"
8+
9+
/ {
10+
chosen {
11+
zephyr,code-partition = &boot_partition;
12+
};
13+
};
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
/* On nRF54H20 the Direct XIP mode is supported in the merged slot configuration
8+
* Merge application and radio slots by extending the application parition.
9+
*/
10+
&cpuapp_slot0_partition {
11+
reg = <0x40000 DT_SIZE_K(656)>;
12+
};
13+
14+
&cpuapp_slot1_partition {
15+
reg = <0x100000 DT_SIZE_K(656)>;
16+
};
17+
18+
/ {
19+
chosen {
20+
zephyr,bootloader-request = &boot_request;
21+
};
22+
};
23+
24+
/ {
25+
reserved-memory {
26+
cpuapp_retained_mem: memory@e1ad000 {
27+
compatible = "zephyr,memory-region";
28+
reg = <0xe1ad000 DT_SIZE_K(4)>;
29+
zephyr,memory-region = "RetainedMem";
30+
status = "okay";
31+
32+
retainedmem {
33+
compatible = "zephyr,retained-ram";
34+
status = "okay";
35+
#address-cells = <1>;
36+
#size-cells = <1>;
37+
38+
boot_request: boot_request@0 {
39+
compatible = "zephyr,retention";
40+
status = "okay";
41+
reg = <0x0 16>;
42+
prefix = [0B 01];
43+
checksum = <4>;
44+
};
45+
};
46+
};
47+
};
48+
};

west.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ manifest:
128128
compare-by-default: true
129129
- name: mcuboot
130130
repo-path: sdk-mcuboot
131-
revision: d24b28f652e2eeb6117b9c60fca0277db3d4e226
131+
revision: pull/477/head
132132
path: bootloader/mcuboot
133133
- name: qcbor
134134
url: https://github.com/laurencelundblade/QCBOR

0 commit comments

Comments
 (0)