Skip to content

Commit 9c5bf9f

Browse files
committed
[nrf noup] samples/mgmt/smp_svr: Add nrf5340dk_nrf5340 support
Add nrf5340dk_nrf5340 board specific configuration that allows for APP and NET updates. NCSDK-16882 Signed-off-by: Dominik Ermel <[email protected]>
1 parent e4975cf commit 9c5bf9f

File tree

9 files changed

+246
-10
lines changed

9 files changed

+246
-10
lines changed

samples/subsys/mgmt/mcumgr/smp_svr/CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,21 @@ cmake_minimum_required(VERSION 3.20.0)
99
# mcumgr. It can be used as a starting point for new applications.
1010

1111
# Standard Zephyr application boilerplate.
12+
13+
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}")
14+
message(WARNING
15+
"Board specific configuration will be used for ${BOARD} "
16+
"When providing -DOVERLAY_CONFIG= remember that all overlay "
17+
"configuration paths are relative to "
18+
"${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}")
19+
set(APPLICATION_CONFIG_DIR "configuration/\${BOARD}")
20+
else()
21+
message(NOTICE
22+
"Board ${BOARD} does not have board specific configuration.\n")
23+
endif()
24+
1225
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
26+
1327
project(smp_svr)
1428

1529
target_sources(app PRIVATE src/main.c)

samples/subsys/mgmt/mcumgr/smp_svr/README.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@ Building the sample application
8181
The below steps describe how to build and run the ``smp_svr`` sample in
8282
Zephyr. The ``smp_svr`` sample comes in different flavours.
8383

84+
85+
.. note::
86+
Note that when providing `-DOVERLAY_CONFIG=` option to builds for boards with
87+
board specific configuration, stored in `configuration/<board> sub-directory,
88+
you need to either provide full absolute path to overlay file or path relative
89+
to that sub-directory, for example: `-DOVERLAY_CONFIG=../../overlay-bt.conf`.
90+
8491
.. tabs::
8592

8693
.. group-tab:: Bluetooth

samples/subsys/mgmt/mcumgr/smp_svr/child_image/hci_rpmsg.conf

Lines changed: 0 additions & 10 deletions
This file was deleted.
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: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#
2+
# Copyright (c) 2022 Nordic Semiconductor
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
CONFIG_IPC_SERVICE=y
8+
CONFIG_IPC_SERVICE_BACKEND_RPMSG=y
9+
CONFIG_MBOX=y
10+
11+
CONFIG_HEAP_MEM_POOL_SIZE=8192
12+
13+
CONFIG_MAIN_STACK_SIZE=512
14+
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512
15+
CONFIG_BT=y
16+
CONFIG_BT_MAX_CONN=10
17+
CONFIG_BT_HCI_RAW=y
18+
CONFIG_BT_CTLR_ASSERT_HANDLER=y
19+
CONFIG_BT_HCI_RAW_RESERVE=1
20+
CONFIG_BT_BUF_CMD_TX_COUNT=10
21+
22+
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
23+
CONFIG_BT_BUF_ACL_TX_SIZE=251
24+
CONFIG_BT_BUF_ACL_RX_SIZE=502
25+
26+
#CONFIG_ASSERT=y
27+
#CONFIG_DEBUG_INFO=y
28+
#CONFIG_EXCEPTION_STACK_TRACE=y
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#
2+
# Copyright (c) 2022 Nordic Semiconductor
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
CONFIG_SIZE_OPTIMIZATIONS=y
8+
9+
CONFIG_SYSTEM_CLOCK_NO_WAIT=y
10+
CONFIG_PM=n
11+
12+
CONFIG_MAIN_STACK_SIZE=10240
13+
CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h"
14+
15+
CONFIG_BOOT_MAX_IMG_SECTORS=2048
16+
CONFIG_BOOT_SIGNATURE_TYPE_RSA=y
17+
18+
# Flash
19+
CONFIG_FLASH=y
20+
CONFIG_BOOT_ERASE_PROGRESSIVELY=y
21+
CONFIG_SOC_FLASH_NRF_EMULATE_ONE_BYTE_WRITE_ACCESS=y
22+
CONFIG_FPROTECT=y
23+
24+
# Serial
25+
CONFIG_SERIAL=y
26+
CONFIG_UART_LINE_CTRL=y
27+
28+
# MCUBoot serial
29+
CONFIG_GPIO=y
30+
CONFIG_MCUBOOT_SERIAL=y
31+
CONFIG_MCUBOOT_SERIAL_DIRECT_IMAGE_UPLOAD=y
32+
CONFIG_BOOT_SERIAL_UART=y
33+
CONFIG_BOOT_SERIAL_DETECT_PORT="GPIO_0"
34+
CONFIG_BOOT_SERIAL_DETECT_PIN=23
35+
36+
# Required by QSPI
37+
CONFIG_NORDIC_QSPI_NOR=y
38+
CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
39+
CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16
40+
41+
# Required by QSPI
42+
CONFIG_MULTITHREADING=y
43+
44+
# Decrease memory footprint
45+
CONFIG_CBPRINTF_NANO=y
46+
CONFIG_TIMESLICING=n
47+
CONFIG_BOOT_BANNER=n
48+
CONFIG_CONSOLE=n
49+
CONFIG_CONSOLE_HANDLER=n
50+
CONFIG_UART_CONSOLE=n
51+
CONFIG_USE_SEGGER_RTT=n
52+
CONFIG_LOG=n
53+
CONFIG_ERRNO=n
54+
CONFIG_PRINTK=n
55+
CONFIG_RESET_ON_FATAL_ERROR=n
56+
57+
# The following configurations are required to support simultaneous multi image update
58+
CONFIG_PCD_APP=y
59+
CONFIG_UPDATEABLE_IMAGE_NUMBER=2
60+
CONFIG_BOOT_UPGRADE_ONLY=y
61+
# The network core cannot access external flash directly. The flash simulator must be used to
62+
# provide a memory region that is used to forward the new firmware to the network core.
63+
CONFIG_FLASH_SIMULATOR=y
64+
CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y
65+
CONFIG_FLASH_SIMULATOR_STATS=n
66+
67+
# Enable custom command to erase settings partition.
68+
CONFIG_ENABLE_MGMT_PERUSER=y
69+
CONFIG_BOOT_MGMT_CUSTOM_STORAGE_ERASE=y
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: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#
2+
# Copyright (c) 2022 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
################################################################################
7+
# Application configuration
8+
9+
CONFIG_ISR_STACK_SIZE=1536
10+
CONFIG_MAIN_STACK_SIZE=1024
11+
CONFIG_IDLE_STACK_SIZE=512
12+
13+
CONFIG_HEAP_MEM_POOL_SIZE=2048
14+
15+
CONFIG_SPEED_OPTIMIZATIONS=y
16+
CONFIG_HW_STACK_PROTECTION=y
17+
18+
CONFIG_NUM_COOP_PRIORITIES=10
19+
CONFIG_NUM_PREEMPT_PRIORITIES=11
20+
21+
CONFIG_FLASH=y
22+
CONFIG_FLASH_MAP=y
23+
24+
# Enable MCUMGR
25+
CONFIG_MCUMGR=y
26+
27+
CONFIG_MCUMGR_CMD_IMG_MGMT=y
28+
CONFIG_MCUMGR_CMD_OS_MGMT=y
29+
30+
# Enable custom SMP request to erase settings partition.
31+
CONFIG_MCUMGR_GRP_ZEPHYR_BASIC=y
32+
CONFIG_MCUMGR_GRP_BASIC_CMD_STORAGE_ERASE=y
33+
34+
# Net CPU
35+
CONFIG_BT=y
36+
CONFIG_BT_SMP=y
37+
CONFIG_BT_SIGNING=y
38+
CONFIG_BT_BONDABLE=y
39+
40+
CONFIG_BT_PERIPHERAL=y
41+
CONFIG_BT_PERIPHERAL_PREF_MIN_INT=6
42+
CONFIG_BT_PERIPHERAL_PREF_MAX_INT=9
43+
CONFIG_BT_PERIPHERAL_PREF_LATENCY=99
44+
CONFIG_BT_PERIPHERAL_PREF_TIMEOUT=400
45+
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=y
46+
47+
################################################################################
48+
# Bootloader Configuration
49+
50+
CONFIG_BOOTLOADER_MCUBOOT=y
51+
CONFIG_UPDATEABLE_IMAGE_NUMBER=2
52+
53+
CONFIG_IMG_MANAGER=y
54+
CONFIG_MCUBOOT_IMG_MANAGER=y
55+
CONFIG_IMG_ERASE_PROGRESSIVELY=y
56+
57+
################################################################################
58+
# External flash configuration
59+
60+
CONFIG_NORDIC_QSPI_NOR=y
61+
CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
62+
CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ tests:
4747
- nrf52833dk/nrf52833
4848
- nrf52840dk/nrf52840
4949
- nrf5340dk/nrf5340/cpuapp
50+
sample.mcumg.smp_svr.cdc.nrf5340dk_nrf5340:
51+
extra_args: OVERLAY_CONFIG="../../overlay-cdc.conf"
52+
DTC_OVERLAY_FILE="usb.overlay"
53+
platform_allow: nrf5340dk_nrf5340_cpuapp
54+
integration_platforms:
55+
- nrf5340dk_nrf5340_cpuapp
5056
sample.mcumgr.smp_svr.serial:
5157
extra_args: OVERLAY_CONFIG="overlay-serial.conf"
5258
platform_allow:

0 commit comments

Comments
 (0)