Skip to content

Commit 8f271ef

Browse files
committed
suit: Add AB update sample
Add sample that demonstrates how to perform A/B updates using SUIT. Ref: NCSDK-32185 Signed-off-by: Tomasz Chyrowicz <[email protected]>
1 parent 60dd6aa commit 8f271ef

24 files changed

+2575
-0
lines changed

samples/suit/ab/CMakeLists.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
cmake_minimum_required(VERSION 3.13.1)
8+
9+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
10+
11+
project(suit_ab)
12+
13+
target_sources(app PRIVATE src/main.c)
14+
target_sources(app PRIVATE src/suit_manifests_state.c)
15+
target_sources(app PRIVATE src/suit_components_state.c)
16+
target_sources(app PRIVATE src/device_management.c)
17+
zephyr_library_include_directories(src)
18+
19+
zephyr_library_link_libraries(suit_manifest_variables)
20+
zephyr_library_link_libraries(suit_ipuc)
21+
22+
# This project uses orginal sdk-zephyr C source code
23+
target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/samples/subsys/mgmt/mcumgr/smp_svr/src)
24+
target_sources_ifdef(CONFIG_MCUMGR_TRANSPORT_BT app PRIVATE $ENV{ZEPHYR_BASE}/samples/subsys/mgmt/mcumgr/smp_svr/src/bluetooth.c)

samples/suit/ab/Kconfig

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
config N_BLINKS
8+
int "Number of fast blinks"
9+
default 1
10+
11+
config ID_VAR_BOOT_STATUS
12+
int "Id of Manfiest-controlled variable representing a boot status"
13+
default 256
14+
15+
config ID_VAR_BOOT_PREFERENCE
16+
int "Id of Manfiest-controlled variable representing a boot prefrence"
17+
default 0
18+
19+
config ID_VAR_SET_TO_UPDATE
20+
int "Id of Manfiest-controlled variable representing image set to be updated"
21+
default 1
22+
23+
config ID_VAR_CONFIRM_SET_A
24+
int "Id of Manfiest-controlled variable representing after-update confirmation state for image set A"
25+
default 2
26+
27+
config ID_VAR_CONFIRM_SET_B
28+
int "Id of Manfiest-controlled variable representing after-update confirmation state for image set B"
29+
default 3
30+
31+
config EMULATE_APP_HEALTH_CHECK_FAILURE
32+
bool "Blocks confirmation of being healthy after the update"
33+
34+
source "Kconfig.zephyr"

samples/suit/ab/VERSION

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
VERSION_MAJOR = 0
2+
VERSION_MINOR = 1
3+
PATCHLEVEL = 0
4+
VERSION_TWEAK = 0
5+
6+
7+
APP_ROOT_SEQ_NUM = 1
8+
APP_ROOT_VERSION = 0.1.0
9+
10+
APP_LOCAL_1_SEQ_NUM = 1
11+
APP_LOCAL_1_VERSION = 0.1.0
12+
13+
APP_RECOVERY_SEQ_NUM = 1
14+
APP_RECOVERY_VERSION = 0.1.0
15+
16+
RAD_LOCAL_1_SEQ_NUM = 1
17+
RAD_LOCAL_1_VERSION = 0.1.0
18+
19+
MIN_NORDIC_TOP_VERSION = 0.9.1
20+
21+
MIN_COMPATIBLE_APP_VERSION_FOR_NORDIC_TOP=0.1.0
22+
MIN_COMPATIBLE_RAD_VERSION_FOR_NORDIC_TOP=0.1.0
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
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.dtsi"
8+
9+
/* Enable partitions, belonging to the application domain. */
10+
&cpuapp_rx_partitions {
11+
status = "okay";
12+
};
13+
14+
&cpuapp_rw_partitions {
15+
status = "okay";
16+
};
17+
18+
/* Enable IPC: Application <-> Secure */
19+
&cpusec_cpuapp_ipc {
20+
status = "okay";
21+
};
22+
23+
&cpuapp_ram0x_region {
24+
status = "okay";
25+
};
26+
27+
&cpusec_bellboard {
28+
status = "okay";
29+
};
30+
31+
/* Enable IPC: Application <-> Radio */
32+
&cpuapp_cpurad_ipc {
33+
status = "okay";
34+
};
35+
36+
&cpurad_bellboard {
37+
status = "okay";
38+
};
39+
40+
&cpuapp_bellboard {
41+
status = "okay";
42+
};
43+
44+
/* Disable HW flow control on the UART 0 */
45+
&uart136 {
46+
/delete-property/ hw-flow-control;
47+
};
48+
49+
/ {
50+
psa_rng: psa-rng {
51+
compatible = "zephyr,psa-crypto-rng";
52+
status = "okay";
53+
};
54+
55+
aliases {
56+
suit-active-code-partition = &cpuapp_slot_a_partition;
57+
suit-inactive-code-partition = &cpuapp_slot_b_partition;
58+
};
59+
60+
chosen {
61+
zephyr,code-partition = &cpuapp_slot_a_partition;
62+
zephyr,bt-hci-ipc = &cpuapp_cpurad_ipc;
63+
zephyr,entropy = &psa_rng;
64+
zephyr,uart-mcumgr = &uart136;
65+
};
66+
};
67+
68+
/* UART 1 is configured for App Core console output. In order to use it for other
69+
* purpose, i.e. to output logs form the Radio core, remove section below.
70+
*/
71+
&uart135 {
72+
status = "okay";
73+
memory-regions = <&cpuapp_dma_region>;
74+
current-speed = <115200>;
75+
pinctrl-0 = <&uart135_default>;
76+
pinctrl-1 = <&uart135_sleep>;
77+
pinctrl-names = "default", "sleep";
78+
79+
/delete-property/ hw-flow-control;
80+
};
81+
82+
/ {
83+
chosen {
84+
zephyr,console = &uart135;
85+
};
86+
};

samples/suit/ab/prj.conf

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
# Enable DK LED library
8+
CONFIG_DK_LIBRARY=y
9+
10+
# Enable mcumgr
11+
CONFIG_NET_BUF=y
12+
CONFIG_ZCBOR=y
13+
CONFIG_ZCBOR_CANONICAL=y
14+
CONFIG_MCUMGR=y
15+
CONFIG_MCUMGR_SMP_LEGACY_RC_BEHAVIOUR=y
16+
CONFIG_CRC=y
17+
18+
# Enable SUIT services
19+
CONFIG_SUIT=y
20+
CONFIG_SUIT_DFU_CANDIDATE_PROCESSING_FULL=y
21+
CONFIG_MGMT_SUITFU=y
22+
CONFIG_FLASH=y
23+
CONFIG_FLASH_IPUC=y
24+
CONFIG_SUIT_NORDIC_TOP_INDEPENDENT_UPDATE_FORBIDDEN=y
25+
CONFIG_SUIT_CACHE_SDFW_IPUC=y
26+
27+
# Extended SUIT commands over USER group
28+
CONFIG_MGMT_SUITFU_GRP_SUIT=y
29+
30+
# Enable bootloader identification within OS Management group
31+
CONFIG_MCUMGR_GRP_OS=y
32+
CONFIG_MCUMGR_GRP_OS_BOOTLOADER_INFO=y
33+
CONFIG_MCUMGR_MGMT_NOTIFICATION_HOOKS=y
34+
CONFIG_MCUMGR_GRP_OS_BOOTLOADER_INFO_HOOK=y
35+
36+
CONFIG_BT=y
37+
CONFIG_BT_PERIPHERAL=y
38+
39+
# Allow for large Bluetooth data packets.
40+
CONFIG_BT_L2CAP_TX_MTU=498
41+
CONFIG_BT_BUF_ACL_RX_SIZE=502
42+
CONFIG_BT_BUF_ACL_TX_SIZE=502
43+
44+
# Enable the Bluetooth mcumgr transport (unauthenticated).
45+
CONFIG_MCUMGR_TRANSPORT_BT=y
46+
CONFIG_MCUMGR_TRANSPORT_BT_PERM_RW=y
47+
CONFIG_MCUMGR_TRANSPORT_BT_CONN_PARAM_CONTROL=y
48+
49+
# Enable logs over UART
50+
CONFIG_LOG=y
51+
CONFIG_SUIT_LOG_LEVEL_DBG=y
52+
CONFIG_SSF_SUIT_SERVICE_LOG_LEVEL_WRN=y
53+
CONFIG_MAIN_STACK_SIZE=4096
54+
CONFIG_LOG_BUFFER_SIZE=8192
55+
56+
# Enable the mcumgr Packet Reassembly feature over Bluetooth and its configuration dependencies.
57+
# MCUmgr buffer size is optimized to fit one SMP packet divided into five Bluetooth Write Commands,
58+
# transmitted with the maximum possible MTU value: 498 bytes.
59+
CONFIG_MCUMGR_TRANSPORT_BT_REASSEMBLY=y
60+
CONFIG_MCUMGR_TRANSPORT_NETBUF_SIZE=2475
61+
CONFIG_MCUMGR_TRANSPORT_WORKQUEUE_STACK_SIZE=4096
62+
63+
CONFIG_BT_DEVICE_NAME="SUIT AB Sample"
64+
65+
# Enable the serial mcumgr transport
66+
CONFIG_BASE64=y
67+
CONFIG_MCUMGR_TRANSPORT_UART=y
68+
CONFIG_UART_MCUMGR_RX_BUF_SIZE=1040
69+
CONFIG_MCUMGR_TRANSPORT_UART_MTU=1024

samples/suit/ab/sample.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
sample:
8+
name: SUIT A/B update through SMP sample
9+
description: Sample application that A/B updates firmware using SUIT and SMP protocol
10+
common:
11+
platform_allow: nrf54h20dk/nrf54h20/cpuapp
12+
build_only: true
13+
sysbuild: true
14+
tests:
15+
sample.suit.ab:
16+
extra_args:
17+
- SB_EXTRA_CONF_FILE="suit_mpi.conf"
18+
tags:
19+
- suit
20+
- bluetooth
21+
- ci_samples_suit

0 commit comments

Comments
 (0)