Skip to content

Commit 2bc512f

Browse files
ananglArekBalysNordic
authored andcommitted
[nrf noup] boards: nordic: nrf7002dk: Bring back NS variants
Non-secure variants for nRF7002 DK were removed from upstream in commit 10d4973. Revert these changes downstream, so that the NS variants are still available. Signed-off-by: Andrzej Głąbek <[email protected]>
1 parent d583074 commit 2bc512f

12 files changed

+282
-3
lines changed

Diff for: boards/nordic/nrf7002dk/CMakeLists.txt

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright (c) 2024 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if((CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP OR
5+
CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NS OR
6+
CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 OR
7+
CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS) AND
8+
CONFIG_BOARD_ENABLE_CPUNET)
9+
zephyr_library()
10+
zephyr_library_sources(nrf5340_cpunet_reset.c)
11+
endif()

Diff for: boards/nordic/nrf7002dk/Kconfig

+5-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ config MBOX_NRFX_IPC
1010
default MBOX
1111

1212
if BOARD_NRF7002DK_NRF5340_CPUAPP || \
13-
BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001
13+
BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \
14+
BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \
15+
BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS
1416

1517
config BT_HCI_IPC
1618
default y if BT
@@ -38,7 +40,9 @@ config BT_ECC
3840
config DOMAIN_CPUAPP_BOARD
3941
string
4042
default "nrf7002dk/nrf5340/cpuapp" if BOARD_NRF7002DK_NRF5340_CPUAPP
43+
default "nrf7002dk/nrf5340/cpuapp/ns" if BOARD_NRF7002DK_NRF5340_CPUAPP_NS
4144
default "nrf7002dk/nrf5340/cpuapp/nrf7001" if BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001
45+
default "nrf7002dk/nrf5340/cpuapp/nrf7001/ns" if BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS
4246
help
4347
The board which will be used for CPUAPP domain when creating a multi
4448
image application where one or more images should be located on

Diff for: boards/nordic/nrf7002dk/Kconfig.defconfig

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# nRF5340 DK nRF5340 board configuration
2+
3+
# Copyright (c) 2024 Nordic Semiconductor ASA
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
if BOARD_NRF7002DK_NRF5340_CPUAPP || \
7+
BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \
8+
BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \
9+
BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS
10+
11+
# By default, if we build for a Non-Secure version of the board,
12+
# force building with TF-M as the Secure Execution Environment.
13+
config BUILD_WITH_TFM
14+
default y if BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \
15+
BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS
16+
17+
if BUILD_WITH_TFM
18+
19+
# By default, if we build with TF-M, instruct build system to
20+
# flash the combined TF-M (Secure) & Zephyr (Non Secure) image
21+
config TFM_FLASH_MERGED_BINARY
22+
bool
23+
default y
24+
25+
endif # BUILD_WITH_TFM
26+
27+
# Code Partition:
28+
#
29+
# For the secure version of the board the firmware is linked at the beginning
30+
# of the flash, or into the code-partition defined in DT if it is intended to
31+
# be loaded by MCUboot. If the secure firmware is to be combined with a non-
32+
# secure image (TRUSTED_EXECUTION_SECURE=y), the secure FW image shall always
33+
# be restricted to the size of its code partition.
34+
#
35+
# For the non-secure version of the board, the firmware
36+
# must be linked into the code-partition (non-secure) defined in DT, regardless.
37+
# Apply this configuration below by setting the Kconfig symbols used by
38+
# the linker according to the information extracted from DT partitions.
39+
40+
# SRAM Partition:
41+
#
42+
# If the secure firmware is to be combined with a non-secure image
43+
# (TRUSTED_EXECUTION_SECURE=y), the secure FW image SRAM shall always
44+
# be restricted to the secure image SRAM partition (sram-secure-partition).
45+
# Otherwise (if TRUSTED_EXECUTION_SECURE is not set) the whole zephyr,sram
46+
# may be used by the image.
47+
#
48+
# For the non-secure version of the board, the firmware image SRAM is
49+
# always restricted to the allocated non-secure SRAM partition.
50+
#
51+
# Workaround for not being able to have commas in macro arguments
52+
DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition
53+
DT_CHOSEN_Z_SRAM_PARTITION := zephyr,sram-secure-partition
54+
55+
if (BOARD_NRF7002DK_NRF5340_CPUAPP || BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001) && \
56+
TRUSTED_EXECUTION_SECURE
57+
58+
config FLASH_LOAD_SIZE
59+
default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION))
60+
61+
config SRAM_SIZE
62+
default $(dt_chosen_reg_size_int,$(DT_CHOSEN_Z_SRAM_PARTITION),0,K)
63+
64+
endif
65+
66+
if BOARD_NRF7002DK_NRF5340_CPUAPP_NS || BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS
67+
68+
config FLASH_LOAD_OFFSET
69+
default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION))
70+
71+
config FLASH_LOAD_SIZE
72+
default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION))
73+
74+
endif
75+
76+
endif

Diff for: boards/nordic/nrf7002dk/Kconfig.nrf7002dk

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@
44
config BOARD_NRF7002DK
55
select SOC_NRF5340_CPUNET_QKAA if BOARD_NRF7002DK_NRF5340_CPUNET
66
select SOC_NRF5340_CPUAPP_QKAA if BOARD_NRF7002DK_NRF5340_CPUAPP || \
7-
BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001
7+
BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \
8+
BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \
9+
BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS

Diff for: boards/nordic/nrf7002dk/board.cmake

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
11
# Copyright (c) 2024 Nordic Semiconductor ASA
22
# SPDX-License-Identifier: Apache-2.0
33

4-
if(CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP OR CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001)
4+
if(CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NS OR
5+
CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS)
6+
set(TFM_PUBLIC_KEY_FORMAT "full")
7+
endif()
8+
9+
if(CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP OR
10+
CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NS OR
11+
CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 OR
12+
CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS)
513
board_runner_args(nrfutil "--ext-mem-config-file=${BOARD_DIR}/nrf7002dk_spi_nrfutil_config.json")
614
board_runner_args(jlink "--device=nrf5340_xxaa_app" "--speed=4000")
715
endif()
816

17+
if(CONFIG_TFM_FLASH_MERGED_BINARY)
18+
set_property(TARGET runners_yaml_props_target PROPERTY hex_file "${CMAKE_BINARY_DIR}/zephyr/tfm_merged.hex")
19+
endif()
20+
921
if(CONFIG_BOARD_NRF7002DK_NRF5340_CPUNET)
1022
board_runner_args(jlink "--device=nrf5340_xxaa_net" "--speed=4000")
1123
endif()

Diff for: boards/nordic/nrf7002dk/board.yml

+4
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,9 @@ board:
55
socs:
66
- name: nrf5340
77
variants:
8+
- name: ns
9+
cpucluster: cpuapp
810
- name: nrf7001
911
cpucluster: cpuapp
12+
variants:
13+
- name: ns
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright (c) 2024 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/dts-v1/;
8+
#include <nordic/nrf5340_cpuappns_qkaa.dtsi>
9+
#include "nrf5340_cpuapp_common.dtsi"
10+
11+
/ {
12+
model = "Nordic NRF5340 DK NRF5340 Application";
13+
compatible = "nordic,nrf5340-dk-nrf5340-cpuapp";
14+
15+
chosen {
16+
zephyr,sram = &sram0_ns;
17+
zephyr,flash = &flash0;
18+
zephyr,code-partition = &slot0_ns_partition;
19+
zephyr,entropy = &psa_rng;
20+
zephyr,wifi = &wlan0;
21+
};
22+
23+
psa_rng: psa-rng {
24+
compatible = "zephyr,psa-crypto-rng";
25+
status = "okay";
26+
};
27+
};
28+
29+
&qspi {
30+
nrf70: nrf7001@1 {
31+
compatible = "nordic,nrf7001-qspi";
32+
status = "okay";
33+
reg = <1>;
34+
qspi-frequency = <24000000>;
35+
qspi-quad-mode;
36+
37+
#include "nrf70_common.dtsi"
38+
};
39+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
identifier: nrf7002dk/nrf5340/cpuapp/nrf7001/ns
2+
name: NRF7002-DK-NRF7001-NRF5340-application-MCU-Non-Secure
3+
type: mcu
4+
arch: arm
5+
toolchain:
6+
- gnuarmemb
7+
- xtools
8+
- zephyr
9+
ram: 192
10+
flash: 192
11+
supported:
12+
- gpio
13+
- i2c
14+
- pwm
15+
- watchdog
16+
- usbd
17+
- usb_device
18+
- netif:openthread
19+
vendor: nordic
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright (c) 2024 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# Enable MPU
5+
CONFIG_ARM_MPU=y
6+
7+
# Enable hardware stack protection
8+
CONFIG_HW_STACK_PROTECTION=y
9+
10+
# Enable TrustZone-M
11+
CONFIG_ARM_TRUSTZONE_M=y
12+
13+
# This Board implies building Non-Secure firmware
14+
CONFIG_TRUSTED_EXECUTION_NONSECURE=y
15+
16+
# enable GPIO
17+
CONFIG_GPIO=y
18+
19+
# enable PINCTRL
20+
CONFIG_PINCTRL=y
21+
22+
# Enable uart driver
23+
CONFIG_SERIAL=y
24+
25+
# enable console
26+
CONFIG_CONSOLE=y
27+
CONFIG_UART_CONSOLE=y
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright (c) 2024 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/dts-v1/;
8+
#include <nordic/nrf5340_cpuappns_qkaa.dtsi>
9+
#include "nrf5340_cpuapp_common.dtsi"
10+
11+
/ {
12+
model = "Nordic NRF5340 DK NRF5340 Application";
13+
compatible = "nordic,nrf5340-dk-nrf5340-cpuapp";
14+
15+
chosen {
16+
zephyr,sram = &sram0_ns_app;
17+
zephyr,flash = &flash0;
18+
zephyr,code-partition = &slot0_ns_partition;
19+
zephyr,entropy = &psa_rng;
20+
zephyr,wifi = &wlan0;
21+
};
22+
23+
psa_rng: psa-rng {
24+
compatible = "zephyr,psa-crypto-rng";
25+
status = "okay";
26+
};
27+
};
28+
29+
&qspi {
30+
nrf70: nrf7002@1 {
31+
compatible = "nordic,nrf7002-qspi";
32+
status = "okay";
33+
reg = <1>;
34+
qspi-frequency = <24000000>;
35+
qspi-quad-mode;
36+
37+
#include "nrf70_common.dtsi"
38+
#include "nrf70_common_5g.dtsi"
39+
};
40+
};
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
identifier: nrf7002dk/nrf5340/cpuapp/ns
2+
name: NRF7002-DK-NRF5340-application-MCU-Non-Secure
3+
type: mcu
4+
arch: arm
5+
toolchain:
6+
- gnuarmemb
7+
- xtools
8+
- zephyr
9+
ram: 192
10+
flash: 192
11+
supported:
12+
- gpio
13+
- i2c
14+
- pwm
15+
- watchdog
16+
- usbd
17+
- usb_device
18+
- netif:openthread
19+
vendor: nordic
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
# Enable MPU
4+
CONFIG_ARM_MPU=y
5+
6+
# Enable hardware stack protection
7+
CONFIG_HW_STACK_PROTECTION=y
8+
9+
# Enable TrustZone-M
10+
CONFIG_ARM_TRUSTZONE_M=y
11+
12+
# This Board implies building Non-Secure firmware
13+
CONFIG_TRUSTED_EXECUTION_NONSECURE=y
14+
15+
# enable GPIO
16+
CONFIG_GPIO=y
17+
18+
# enable PINCTRL
19+
CONFIG_PINCTRL=y
20+
21+
# Enable uart driver
22+
CONFIG_SERIAL=y
23+
24+
# enable console
25+
CONFIG_CONSOLE=y
26+
CONFIG_UART_CONSOLE=y

0 commit comments

Comments
 (0)