Skip to content

Commit d2ca243

Browse files
nordicjmrlubos
authored andcommitted
[nrf noup] samples: mgmt: mcumgr: smp_svr: Add nrf5340dk-optimised sample
Adds a configuration to this sample that is optimised for testing/usage with the nRF5340 which enables the Bluetooth transport, enables most management groups, has a static partition manager file with secondary partitions on QSPI flash, configures MCUboot in overwrite only mode with network core update support Signed-off-by: Jamie McCrae <[email protected]> (cherry picked from commit 0151175)
1 parent b3b520b commit d2ca243

File tree

7 files changed

+181
-0
lines changed

7 files changed

+181
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/ {
2+
chosen {
3+
nordic,pm-ext-flash = &mx25r64;
4+
};
5+
};
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
app:
2+
address: 0x10200
3+
region: flash_primary
4+
size: 0xdfe00
5+
mcuboot:
6+
address: 0x0
7+
region: flash_primary
8+
size: 0x10000
9+
mcuboot_pad:
10+
address: 0x10000
11+
region: flash_primary
12+
size: 0x200
13+
mcuboot_primary:
14+
address: 0x10000
15+
orig_span: &id001
16+
- mcuboot_pad
17+
- app
18+
region: flash_primary
19+
size: 0xe0000
20+
span: *id001
21+
mcuboot_primary_app:
22+
address: 0x10200
23+
orig_span: &id002
24+
- app
25+
region: flash_primary
26+
size: 0xdfe00
27+
span: *id002
28+
settings_storage:
29+
address: 0xf0000
30+
region: flash_primary
31+
size: 0x10000
32+
mcuboot_primary_1:
33+
address: 0x0
34+
size: 0x40000
35+
device: flash_ctrl
36+
region: ram_flash
37+
mcuboot_secondary:
38+
address: 0x00000
39+
size: 0xe0000
40+
device: MX25R64
41+
region: external_flash
42+
mcuboot_secondary_1:
43+
address: 0xe0000
44+
size: 0x40000
45+
device: MX25R64
46+
region: external_flash
47+
external_flash:
48+
address: 0x120000
49+
size: 0x6e0000
50+
device: MX25R64
51+
region: external_flash
52+
pcd_sram:
53+
address: 0x20000000
54+
size: 0x2000
55+
region: sram_primary
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
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+
CONFIG_BT=y
9+
CONFIG_BT_PERIPHERAL=y
10+
11+
# Some command handlers require a large stack.
12+
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2304
13+
CONFIG_MAIN_STACK_SIZE=2176
14+
15+
# Ensure an MCUboot-compatible binary is generated.
16+
CONFIG_BOOTLOADER_MCUBOOT=y
17+
18+
# Enable flash operations.
19+
CONFIG_FLASH=y
20+
21+
# Required by the `taskstat` command.
22+
CONFIG_THREAD_MONITOR=y
23+
24+
# Support for taskstat command
25+
CONFIG_MCUMGR_GRP_OS_TASKSTAT=y
26+
27+
# Enable statistics and statistic names.
28+
CONFIG_STATS=y
29+
CONFIG_STATS_NAMES=y
30+
31+
# Enable most core commands.
32+
CONFIG_FLASH=y
33+
CONFIG_IMG_MANAGER=y
34+
CONFIG_MCUMGR_GRP_IMG=y
35+
CONFIG_MCUMGR_GRP_OS=y
36+
CONFIG_MCUMGR_GRP_STAT=y
37+
38+
# Enable logging
39+
CONFIG_LOG=y
40+
CONFIG_MCUBOOT_UTIL_LOG_LEVEL_WRN=y
41+
42+
# Disable debug logging
43+
CONFIG_LOG_MAX_LEVEL=3
44+
45+
# Allow for large Bluetooth data packets.
46+
CONFIG_BT_L2CAP_TX_MTU=498
47+
CONFIG_BT_BUF_ACL_RX_SIZE=502
48+
CONFIG_BT_BUF_ACL_TX_SIZE=502
49+
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
50+
51+
# Enable the Bluetooth mcumgr transport (unauthenticated).
52+
CONFIG_MCUMGR_TRANSPORT_BT=y
53+
CONFIG_MCUMGR_TRANSPORT_BT_CONN_PARAM_CONTROL=y
54+
55+
# Enable the Shell mcumgr transport.
56+
CONFIG_BASE64=y
57+
CONFIG_CRC=y
58+
CONFIG_SHELL=y
59+
CONFIG_SHELL_BACKEND_SERIAL=y
60+
CONFIG_MCUMGR_TRANSPORT_SHELL=y
61+
62+
# Enable the mcumgr Packet Reassembly feature over Bluetooth and its configuration dependencies.
63+
# MCUmgr buffer size is optimized to fit one SMP packet divided into five Bluetooth Write Commands,
64+
# transmitted with the maximum possible MTU value: 498 bytes.
65+
CONFIG_MCUMGR_TRANSPORT_BT_REASSEMBLY=y
66+
CONFIG_MCUMGR_TRANSPORT_NETBUF_SIZE=2475
67+
CONFIG_MCUMGR_GRP_OS_MCUMGR_PARAMS=y
68+
CONFIG_MCUMGR_TRANSPORT_WORKQUEUE_STACK_SIZE=4608
69+
70+
# Enable the LittleFS file system.
71+
CONFIG_FILE_SYSTEM=y
72+
CONFIG_FILE_SYSTEM_LITTLEFS=y
73+
74+
# Enable file system commands
75+
CONFIG_MCUMGR_GRP_FS=y
76+
77+
# Enable the storage erase command.
78+
CONFIG_MCUMGR_GRP_ZBASIC=y
79+
CONFIG_MCUMGR_GRP_ZBASIC_STORAGE_ERASE=y
80+
81+
# Disable Bluetooth ping support
82+
CONFIG_BT_CTLR_LE_PING=n
83+
84+
# Disable shell commands that are not needed
85+
CONFIG_CLOCK_CONTROL_NRF_SHELL=n
86+
CONFIG_DEVICE_SHELL=n
87+
CONFIG_DEVMEM_SHELL=n
88+
CONFIG_FLASH_SHELL=n

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,11 @@ tests:
222222
- nrf52840dk/nrf52840
223223
integration_platforms:
224224
- nrf52840dk/nrf52840
225+
sample.mcumgr.smp_svr.bt.nrf5340dk.ext_flash:
226+
sysbuild: true
227+
extra_args:
228+
- FILE_SUFFIX=nrf5340_bt
229+
platform_allow:
230+
- nrf5340dk/nrf5340/cpuapp
231+
integration_platforms:
232+
- nrf5340dk/nrf5340/cpuapp
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#
2+
# Copyright (c) 2024 Nordic Semiconductor
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
if(FILE_SUFFIX STREQUAL "nrf5340_bt")
8+
if(SB_CONFIG_SOC_NRF5340_CPUAPP)
9+
# nRF5340 with Bluetooth configuration, add partition manager configuration to MCUboot image
10+
list(APPEND mcuboot_EXTRA_DTC_OVERLAY_FILE ${CMAKE_CURRENT_LIST_DIR}/app_nrf5340_bt.overlay)
11+
list(REMOVE_DUPLICATES mcuboot_EXTRA_DTC_OVERLAY_FILE)
12+
set(mcuboot_EXTRA_DTC_OVERLAY_FILE ${mcuboot_EXTRA_DTC_OVERLAY_FILE} CACHE INTERNAL "" FORCE)
13+
else()
14+
message(FATAL_ERROR "File suffix 'nrf5340_bt' can only be used on an nRF5340 CPUAPP board target")
15+
endif()
16+
endif()
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_BOOT_MAX_IMG_SECTORS=240
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Enable MCUboot bootloader support
2+
SB_CONFIG_BOOTLOADER_MCUBOOT=y
3+
SB_CONFIG_MCUBOOT_MODE_OVERWRITE_ONLY=y
4+
SB_CONFIG_NETCORE_HCI_IPC=y
5+
SB_CONFIG_SECURE_BOOT_NETCORE=y
6+
SB_CONFIG_NETCORE_APP_UPDATE=y
7+
SB_CONFIG_MCUBOOT_NRF53_MULTI_IMAGE_UPDATE=y
8+
SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y

0 commit comments

Comments
 (0)