Skip to content

Commit 69c9276

Browse files
ArekBalysNordicLuDuda
authored andcommitted
tests: dfu_target: Add tests for SUIT dfu_target implementation.
You can generate the new manifests and C files that contains manifests and chache partition binary data using generate_dfu_cache.sh. The tests includes dfu_target_suit initialization, and uploading the manifests and dfu cache partition. Test are prepared for nRF54H20 and native_posix targets. Signed-off-by: Arkadiusz Balys <[email protected]>
1 parent 53b0962 commit 69c9276

22 files changed

+1109
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#
2+
# Copyright (c) 2024 Nordic Semiconductor
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
cmake_minimum_required(VERSION 3.20.0)
8+
9+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
10+
project(dfu_target_suit_test)
11+
include(${ZEPHYR_NRF_MODULE_DIR}/tests/subsys/suit/cmake/test_template.cmake)
12+
13+
FILE(GLOB app_sources src/*.c)
14+
target_sources(app PRIVATE ${app_sources})
15+
16+
target_include_directories(app
17+
PRIVATE
18+
${ZEPHYR_NRF_MODULE_DIR}/subsys/dfu/include
19+
"src"
20+
)
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 ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
menuconfig TESTS_SUIT_DFU_TARGET_SUIT_CACHE_PROCESSING
8+
bool "Run tests for processing of SUIT cache partition by the SUIT DFU target"
9+
imply DFU_TARGET_SUIT_CACHE_PROCESSING
10+
default n
11+
12+
menuconfig TESTS_SUIT_DFU_TARGET_SUIT_SINGLE_PARTITION
13+
bool "Run tests for processing of the dfu_partition only by the DFU target"
14+
default n
15+
16+
source "Kconfig.zephyr"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#
2+
# Copyright (c) 2024 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
CONFIG_ZCBOR=y
8+
CONFIG_ZCBOR_CANONICAL=y
9+
CONFIG_FLASH_SIMULATOR=y
10+
CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y
11+
CONFIG_FLASH=y
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright (c) 2024 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
&flash0 {
8+
partitions {
9+
compatible = "fixed-partitions";
10+
#address-cells = < 0x1 >;
11+
#size-cells = < 0x1 >;
12+
13+
dfu_partition: partition@100000 {
14+
reg = < 0x100000 DT_SIZE_K(128) >;
15+
};
16+
17+
dfu_cache_partition_1: partition@120000 {
18+
reg = <0x120000 DT_SIZE_K(128)>;
19+
};
20+
21+
dfu_cache_partition_2: partition@140000 {
22+
reg = <0x140000 DT_SIZE_K(128)>;
23+
};
24+
25+
dfu_cache_partition_3: partition@160000 {
26+
reg = <0x160000 DT_SIZE_K(128)>;
27+
};
28+
};
29+
};
30+
31+
/ {
32+
sram0: memory@20000000 {
33+
compatible = "mmio-sram";
34+
reg = <0x20000000 DT_SIZE_K(256)>;
35+
};
36+
};
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#
2+
# Copyright (c) 2024 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
# Enable logging
8+
CONFIG_LOG=y
9+
CONFIG_LOG_BACKEND_UART=y
10+
CONFIG_LOG_MODE_DEFERRED=y
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Copyright (c) 2024 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
/ {
8+
chosen {
9+
zephyr,entropy = &psa_rng;
10+
};
11+
12+
psa_rng: psa-rng {
13+
compatible = "zephyr,psa-crypto-rng";
14+
status = "okay";
15+
};
16+
};
17+
18+
/* Split DFU partition into a smaller one and DFU caches. */
19+
/delete-node/ &dfu_partition;
20+
/delete-node/ &storage_partition;
21+
22+
&mram1x {
23+
cpuapp_rw_partitions: cpuapp-rw-partitions {
24+
compatible = "nordic,owned-partitions", "fixed-partitions";
25+
status = "okay";
26+
perm-read;
27+
perm-write;
28+
perm-secure;
29+
#address-cells = < 0x1 >;
30+
#size-cells = < 0x1 >;
31+
32+
dfu_partition: partition@100000 {
33+
reg = < 0x100000 DT_SIZE_K(128) >;
34+
};
35+
36+
dfu_cache_partition_1: partition@120000 {
37+
reg = <0x120000 DT_SIZE_K(128)>;
38+
};
39+
40+
dfu_cache_partition_2: partition@140000 {
41+
reg = <0x140000 DT_SIZE_K(128)>;
42+
};
43+
44+
dfu_cache_partition_3: partition@160000 {
45+
reg = <0x160000 DT_SIZE_K(128)>;
46+
};
47+
48+
storage_partition: partition@1df000 {
49+
reg = < 0x1df000 0x6000 >;
50+
};
51+
};
52+
};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#
2+
# Copyright (c) 2024 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
CONFIG_TESTS_SUIT_DFU_TARGET_SUIT_CACHE_PROCESSING=y
8+
CONFIG_SUIT_DFU_CANDIDATE_PROCESSING_PUSH_TO_CACHE=y
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
SUIT_Envelope_Tagged:
2+
suit-authentication-wrapper:
3+
SuitDigest:
4+
suit-digest-algorithm-id: cose-alg-sha-256
5+
suit-manifest:
6+
suit-manifest-version: 1
7+
suit-manifest-sequence-number: 1
8+
suit-common:
9+
suit-components:
10+
# Place the destination image address after
11+
# the 3rd DFU cache partition defined in the DTS file.
12+
- - MEM
13+
- 0x02
14+
- 0x0E160000
15+
- 0x00020000
16+
suit-shared-sequence:
17+
- suit-directive-override-parameters:
18+
suit-parameter-vendor-identifier:
19+
RFC4122_UUID: nordicsemi.com
20+
suit-parameter-class-identifier:
21+
RFC4122_UUID:
22+
namespace: nordicsemi.com
23+
name: dfu_target_suit_test
24+
suit-parameter-image-digest:
25+
suit-digest-algorithm-id: cose-alg-sha-256
26+
suit-digest-bytes:
27+
file: file.bin
28+
suit-parameter-image-size:
29+
file: file.bin
30+
- suit-condition-vendor-identifier:
31+
- suit-send-record-success
32+
- suit-send-record-failure
33+
- suit-send-sysinfo-success
34+
- suit-send-sysinfo-failure
35+
- suit-condition-class-identifier:
36+
- suit-send-record-success
37+
- suit-send-record-failure
38+
- suit-send-sysinfo-success
39+
- suit-send-sysinfo-failure
40+
suit-validate:
41+
- suit-condition-image-match:
42+
- suit-send-record-success
43+
- suit-send-record-failure
44+
- suit-send-sysinfo-success
45+
- suit-send-sysinfo-failure
46+
suit-invoke:
47+
- suit-directive-invoke:
48+
- suit-send-record-failure
49+
suit-install:
50+
- suit-directive-override-parameters:
51+
suit-parameter-uri: '#file.bin'
52+
- suit-directive-fetch:
53+
- suit-send-record-failure
54+
- suit-condition-image-match:
55+
- suit-send-record-success
56+
- suit-send-record-failure
57+
- suit-send-sysinfo-success
58+
- suit-send-sysinfo-failure
59+
suit-manifest-component-id:
60+
- INSTLD_MFST
61+
- RFC4122_UUID:
62+
namespace: nordicsemi.com
63+
name: nRF54H20_sample_app
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
SUIT_Envelope_Tagged:
2+
suit-authentication-wrapper:
3+
SuitDigest:
4+
suit-digest-algorithm-id: cose-alg-sha-256
5+
suit-manifest:
6+
suit-manifest-version: 1
7+
suit-manifest-sequence-number: 1
8+
suit-common:
9+
suit-components:
10+
- - CAND_MFST
11+
- 0
12+
- - INSTLD_MFST
13+
- RFC4122_UUID:
14+
namespace: nordicsemi.com
15+
name: nRF54H20_sample_app
16+
suit-shared-sequence:
17+
- suit-directive-set-component-index: 1
18+
- suit-directive-override-parameters:
19+
suit-parameter-vendor-identifier:
20+
RFC4122_UUID: nordicsemi.com
21+
suit-parameter-class-identifier:
22+
RFC4122_UUID:
23+
namespace: nordicsemi.com
24+
name: nRF54H20_sample_app
25+
26+
- suit-directive-set-component-index: [1]
27+
- suit-condition-vendor-identifier:
28+
- suit-send-record-success
29+
- suit-send-record-failure
30+
- suit-send-sysinfo-success
31+
- suit-send-sysinfo-failure
32+
- suit-condition-class-identifier:
33+
- suit-send-record-success
34+
- suit-send-record-failure
35+
- suit-send-sysinfo-success
36+
- suit-send-sysinfo-failure
37+
suit-dependencies:
38+
# Key is the index of suit-components that describe the dependency manifest
39+
"0": {}
40+
"1": {}
41+
42+
suit-validate:
43+
- suit-directive-set-component-index: [1]
44+
- suit-condition-dependency-integrity:
45+
- suit-send-record-success
46+
- suit-send-record-failure
47+
- suit-send-sysinfo-success
48+
- suit-send-sysinfo-failure
49+
- suit-directive-process-dependency:
50+
- suit-send-record-success
51+
- suit-send-record-failure
52+
- suit-send-sysinfo-success
53+
- suit-send-sysinfo-failure
54+
55+
suit-invoke:
56+
- suit-directive-set-component-index: [1]
57+
- suit-condition-dependency-integrity:
58+
- suit-send-record-success
59+
- suit-send-record-failure
60+
- suit-send-sysinfo-success
61+
- suit-send-sysinfo-failure
62+
- suit-directive-process-dependency:
63+
- suit-send-record-success
64+
- suit-send-record-failure
65+
- suit-send-sysinfo-success
66+
- suit-send-sysinfo-failure
67+
68+
suit-install:
69+
- suit-directive-set-component-index: 0
70+
- suit-directive-override-parameters:
71+
suit-parameter-uri: '#app.suit'
72+
suit-parameter-image-digest:
73+
suit-digest-algorithm-id: cose-alg-sha-256
74+
suit-digest-bytes:
75+
file: sample.suit
76+
- suit-directive-fetch:
77+
- suit-send-record-failure
78+
- suit-condition-image-match:
79+
- suit-send-record-success
80+
- suit-send-record-failure
81+
- suit-send-sysinfo-success
82+
- suit-send-sysinfo-failure
83+
- suit-condition-dependency-integrity:
84+
- suit-send-record-success
85+
- suit-send-record-failure
86+
- suit-send-sysinfo-success
87+
- suit-send-sysinfo-failure
88+
- suit-directive-process-dependency:
89+
- suit-send-record-success
90+
- suit-send-record-failure
91+
- suit-send-sysinfo-success
92+
- suit-send-sysinfo-failure
93+
- suit-directive-override-parameters:
94+
suit-parameter-uri: '#app.suit'
95+
suit-parameter-image-digest:
96+
suit-digest-algorithm-id: cose-alg-sha-256
97+
suit-digest-bytes:
98+
file: sample.suit
99+
- suit-directive-fetch:
100+
- suit-send-record-failure
101+
- suit-condition-image-match:
102+
- suit-send-record-success
103+
- suit-send-record-failure
104+
- suit-send-sysinfo-success
105+
- suit-send-sysinfo-failure
106+
- suit-condition-dependency-integrity:
107+
- suit-send-record-success
108+
- suit-send-record-failure
109+
- suit-send-sysinfo-success
110+
- suit-send-sysinfo-failure
111+
- suit-directive-process-dependency:
112+
- suit-send-record-success
113+
- suit-send-record-failure
114+
- suit-send-sysinfo-success
115+
- suit-send-sysinfo-failure
116+
suit-manifest-component-id:
117+
- INSTLD_MFST
118+
- RFC4122_UUID:
119+
namespace: nordicsemi.com
120+
name: nRF54H20_sample_root
121+
suit-integrated-payloads:
122+
'#app.suit': sample.suit

0 commit comments

Comments
 (0)