Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nrf noup] samples: mgmt: mcumgr: smp_svr: Add nrf5340dk-optimised sample #2269

Merged
merged 1 commit into from
Feb 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions samples/subsys/mgmt/mcumgr/smp_svr/app_nrf5340_bt.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/ {
chosen {
nordic,pm-ext-flash = &mx25r64;
};
};
55 changes: 55 additions & 0 deletions samples/subsys/mgmt/mcumgr/smp_svr/pm_static_nrf5340_bt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
app:
address: 0x10200
region: flash_primary
size: 0xdfe00
mcuboot:
address: 0x0
region: flash_primary
size: 0x10000
mcuboot_pad:
address: 0x10000
region: flash_primary
size: 0x200
mcuboot_primary:
address: 0x10000
orig_span: &id001
- mcuboot_pad
- app
region: flash_primary
size: 0xe0000
span: *id001
mcuboot_primary_app:
address: 0x10200
orig_span: &id002
- app
region: flash_primary
size: 0xdfe00
span: *id002
settings_storage:
address: 0xf0000
region: flash_primary
size: 0x10000
mcuboot_primary_1:
address: 0x0
size: 0x40000
device: flash_ctrl
region: ram_flash
mcuboot_secondary:
address: 0x00000
size: 0xe0000
device: MX25R64
region: external_flash
mcuboot_secondary_1:
address: 0xe0000
size: 0x40000
device: MX25R64
region: external_flash
external_flash:
address: 0x120000
size: 0x6e0000
device: MX25R64
region: external_flash
pcd_sram:
address: 0x20000000
size: 0x2000
region: sram_primary
88 changes: 88 additions & 0 deletions samples/subsys/mgmt/mcumgr/smp_svr/prj_nrf5340_bt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Enable MCUmgr and dependencies.
CONFIG_NET_BUF=y
CONFIG_ZCBOR=y
CONFIG_CRC=y
CONFIG_MCUMGR=y
CONFIG_STREAM_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y

# Some command handlers require a large stack.
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2304
CONFIG_MAIN_STACK_SIZE=2176

# Ensure an MCUboot-compatible binary is generated.
CONFIG_BOOTLOADER_MCUBOOT=y

# Enable flash operations.
CONFIG_FLASH=y

# Required by the `taskstat` command.
CONFIG_THREAD_MONITOR=y

# Support for taskstat command
CONFIG_MCUMGR_GRP_OS_TASKSTAT=y

# Enable statistics and statistic names.
CONFIG_STATS=y
CONFIG_STATS_NAMES=y

# Enable most core commands.
CONFIG_FLASH=y
CONFIG_IMG_MANAGER=y
CONFIG_MCUMGR_GRP_IMG=y
CONFIG_MCUMGR_GRP_OS=y
CONFIG_MCUMGR_GRP_STAT=y

# Enable logging
CONFIG_LOG=y
CONFIG_MCUBOOT_UTIL_LOG_LEVEL_WRN=y

# Disable debug logging
CONFIG_LOG_MAX_LEVEL=3

# Allow for large Bluetooth data packets.
CONFIG_BT_L2CAP_TX_MTU=498
CONFIG_BT_BUF_ACL_RX_SIZE=502
CONFIG_BT_BUF_ACL_TX_SIZE=502
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251

# Enable the Bluetooth mcumgr transport (unauthenticated).
CONFIG_MCUMGR_TRANSPORT_BT=y
CONFIG_MCUMGR_TRANSPORT_BT_CONN_PARAM_CONTROL=y

# Enable the Shell mcumgr transport.
CONFIG_BASE64=y
CONFIG_CRC=y
CONFIG_SHELL=y
CONFIG_SHELL_BACKEND_SERIAL=y
CONFIG_MCUMGR_TRANSPORT_SHELL=y

# Enable the mcumgr Packet Reassembly feature over Bluetooth and its configuration dependencies.
# MCUmgr buffer size is optimized to fit one SMP packet divided into five Bluetooth Write Commands,
# transmitted with the maximum possible MTU value: 498 bytes.
CONFIG_MCUMGR_TRANSPORT_BT_REASSEMBLY=y
CONFIG_MCUMGR_TRANSPORT_NETBUF_SIZE=2475
CONFIG_MCUMGR_GRP_OS_MCUMGR_PARAMS=y
CONFIG_MCUMGR_TRANSPORT_WORKQUEUE_STACK_SIZE=4608

# Enable the LittleFS file system.
CONFIG_FILE_SYSTEM=y
CONFIG_FILE_SYSTEM_LITTLEFS=y

# Enable file system commands
CONFIG_MCUMGR_GRP_FS=y

# Enable the storage erase command.
CONFIG_MCUMGR_GRP_ZBASIC=y
CONFIG_MCUMGR_GRP_ZBASIC_STORAGE_ERASE=y

# Disable Bluetooth ping support
CONFIG_BT_CTLR_LE_PING=n

# Disable shell commands that are not needed
CONFIG_CLOCK_CONTROL_NRF_SHELL=n
CONFIG_DEVICE_SHELL=n
CONFIG_DEVMEM_SHELL=n
CONFIG_FLASH_SHELL=n
8 changes: 8 additions & 0 deletions samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,11 @@ tests:
- nrf52840dk/nrf52840
integration_platforms:
- nrf52840dk/nrf52840
sample.mcumgr.smp_svr.bt.nrf5340dk.ext_flash:
sysbuild: true
extra_args:
- FILE_SUFFIX=nrf5340_bt
platform_allow:
- nrf5340dk/nrf5340/cpuapp
integration_platforms:
- nrf5340dk/nrf5340/cpuapp
16 changes: 16 additions & 0 deletions samples/subsys/mgmt/mcumgr/smp_svr/sysbuild.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#
# Copyright (c) 2024 Nordic Semiconductor
#
# SPDX-License-Identifier: Apache-2.0
#

if(FILE_SUFFIX STREQUAL "nrf5340_bt")
if(SB_CONFIG_SOC_NRF5340_CPUAPP)
# nRF5340 with Bluetooth configuration, add partition manager configuration to MCUboot image
list(APPEND mcuboot_EXTRA_DTC_OVERLAY_FILE ${CMAKE_CURRENT_LIST_DIR}/app_nrf5340_bt.overlay)
list(REMOVE_DUPLICATES mcuboot_EXTRA_DTC_OVERLAY_FILE)
set(mcuboot_EXTRA_DTC_OVERLAY_FILE ${mcuboot_EXTRA_DTC_OVERLAY_FILE} CACHE INTERNAL "" FORCE)
else()
message(FATAL_ERROR "File suffix 'nrf5340_bt' can only be used on an nRF5340 CPUAPP board target")
endif()
endif()
8 changes: 8 additions & 0 deletions samples/subsys/mgmt/mcumgr/smp_svr/sysbuild_nrf5340_bt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Enable MCUboot bootloader support
SB_CONFIG_BOOTLOADER_MCUBOOT=y
SB_CONFIG_MCUBOOT_MODE_OVERWRITE_ONLY=y
SB_CONFIG_NETCORE_HCI_IPC=y
SB_CONFIG_SECURE_BOOT_NETCORE=y
SB_CONFIG_NETCORE_APP_UPDATE=y
SB_CONFIG_MCUBOOT_NRF53_MULTI_IMAGE_UPDATE=y
SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y
Loading