Skip to content

Commit

Permalink
[nrf noup] boards: nordic: nrf7002dk: Bring back NS variants
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
anangl committed Jan 8, 2025
1 parent de9366b commit 793b54e
Show file tree
Hide file tree
Showing 12 changed files with 283 additions and 3 deletions.
11 changes: 11 additions & 0 deletions boards/nordic/nrf7002dk/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright (c) 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

if((CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP OR
CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NS OR
CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 OR
CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS) AND
CONFIG_BOARD_ENABLE_CPUNET)
zephyr_library()
zephyr_library_sources(nrf5340_cpunet_reset.c)
endif()
6 changes: 5 additions & 1 deletion boards/nordic/nrf7002dk/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ config MBOX_NRFX_IPC
default MBOX

if BOARD_NRF7002DK_NRF5340_CPUAPP || \
BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001
BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \
BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \
BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS

config BT_HCI_IPC
default y if BT
Expand Down Expand Up @@ -38,7 +40,9 @@ config BT_ECC
config DOMAIN_CPUAPP_BOARD
string
default "nrf7002dk/nrf5340/cpuapp" if BOARD_NRF7002DK_NRF5340_CPUAPP
default "nrf7002dk/nrf5340/cpuapp/ns" if BOARD_NRF7002DK_NRF5340_CPUAPP_NS
default "nrf7002dk/nrf5340/cpuapp/nrf7001" if BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001
default "nrf7002dk/nrf5340/cpuapp/nrf7001/ns" if BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS
help
The board which will be used for CPUAPP domain when creating a multi
image application where one or more images should be located on
Expand Down
76 changes: 76 additions & 0 deletions boards/nordic/nrf7002dk/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# nRF5340 DK nRF5340 board configuration

# Copyright (c) 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

if BOARD_NRF7002DK_NRF5340_CPUAPP || \
BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \
BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \
BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS

# By default, if we build for a Non-Secure version of the board,
# force building with TF-M as the Secure Execution Environment.
config BUILD_WITH_TFM
default y if BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \
BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS

if BUILD_WITH_TFM

# By default, if we build with TF-M, instruct build system to
# flash the combined TF-M (Secure) & Zephyr (Non Secure) image
config TFM_FLASH_MERGED_BINARY
bool
default y

endif # BUILD_WITH_TFM

# Code Partition:
#
# For the secure version of the board the firmware is linked at the beginning
# of the flash, or into the code-partition defined in DT if it is intended to
# be loaded by MCUboot. If the secure firmware is to be combined with a non-
# secure image (TRUSTED_EXECUTION_SECURE=y), the secure FW image shall always
# be restricted to the size of its code partition.
#
# For the non-secure version of the board, the firmware
# must be linked into the code-partition (non-secure) defined in DT, regardless.
# Apply this configuration below by setting the Kconfig symbols used by
# the linker according to the information extracted from DT partitions.

# SRAM Partition:
#
# If the secure firmware is to be combined with a non-secure image
# (TRUSTED_EXECUTION_SECURE=y), the secure FW image SRAM shall always
# be restricted to the secure image SRAM partition (sram-secure-partition).
# Otherwise (if TRUSTED_EXECUTION_SECURE is not set) the whole zephyr,sram
# may be used by the image.
#
# For the non-secure version of the board, the firmware image SRAM is
# always restricted to the allocated non-secure SRAM partition.
#
# Workaround for not being able to have commas in macro arguments
DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition
DT_CHOSEN_Z_SRAM_PARTITION := zephyr,sram-secure-partition

if (BOARD_NRF7002DK_NRF5340_CPUAPP || BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001) && \
TRUSTED_EXECUTION_SECURE

config FLASH_LOAD_SIZE
default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION))

config SRAM_SIZE
default $(dt_chosen_reg_size_int,$(DT_CHOSEN_Z_SRAM_PARTITION),0,K)

endif

if BOARD_NRF7002DK_NRF5340_CPUAPP_NS || BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS

config FLASH_LOAD_OFFSET
default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION))

config FLASH_LOAD_SIZE
default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION))

endif

endif
4 changes: 3 additions & 1 deletion boards/nordic/nrf7002dk/Kconfig.nrf7002dk
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@
config BOARD_NRF7002DK
select SOC_NRF5340_CPUNET_QKAA if BOARD_NRF7002DK_NRF5340_CPUNET
select SOC_NRF5340_CPUAPP_QKAA if BOARD_NRF7002DK_NRF5340_CPUAPP || \
BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001
BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \
BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \
BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS
13 changes: 12 additions & 1 deletion boards/nordic/nrf7002dk/board.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
# Copyright (c) 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

if(CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NS OR
CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS)
set(TFM_PUBLIC_KEY_FORMAT "full")
endif()

if(CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP OR
CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001)
CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NS OR
CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 OR
CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS)
board_runner_args(jlink "--device=nrf5340_xxaa_app" "--speed=4000")
endif()

if(CONFIG_TFM_FLASH_MERGED_BINARY)
set_property(TARGET runners_yaml_props_target PROPERTY hex_file "${CMAKE_BINARY_DIR}/zephyr/tfm_merged.hex")
endif()

if(CONFIG_BOARD_NRF7002DK_NRF5340_CPUNET)
board_runner_args(jlink "--device=nrf5340_xxaa_net" "--speed=4000")
endif()
Expand Down
4 changes: 4 additions & 0 deletions boards/nordic/nrf7002dk/board.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@ board:
socs:
- name: nrf5340
variants:
- name: ns
cpucluster: cpuapp
- name: nrf7001
cpucluster: cpuapp
variants:
- name: ns
40 changes: 40 additions & 0 deletions boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright (c) 2024 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/

/dts-v1/;
#include <nordic/nrf5340_cpuappns_qkaa.dtsi>
#include "nrf5340_cpuapp_common.dtsi"

/ {
model = "Nordic NRF5340 DK NRF5340 Application";
compatible = "nordic,nrf5340-dk-nrf5340-cpuapp";

chosen {
zephyr,sram = &sram0_ns;
zephyr,flash = &flash0;
zephyr,code-partition = &slot0_ns_partition;
zephyr,entropy = &psa_rng;
zephyr,wifi = &wlan0;
};

psa_rng: psa-rng {
compatible = "zephyr,psa-crypto-rng";
status = "okay";
};
};

&qspi {
nrf70: nrf7001@1 {
compatible = "nordic,nrf7001-qspi";
status = "okay";
reg = <1>;
qspi-frequency = <24000000>;
qspi-quad-mode;

#include "nrf70_common.dtsi"
#include "nrf70_common_coex.dtsi"
};
};
19 changes: 19 additions & 0 deletions boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
identifier: nrf7002dk/nrf5340/cpuapp/nrf7001/ns
name: NRF7002-DK-NRF7001-NRF5340-application-MCU-Non-Secure
type: mcu
arch: arm
toolchain:
- gnuarmemb
- xtools
- zephyr
ram: 192
flash: 192
supported:
- gpio
- i2c
- pwm
- watchdog
- usbd
- usb_device
- netif:openthread
vendor: nordic
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright (c) 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

# Enable MPU
CONFIG_ARM_MPU=y

# Enable hardware stack protection
CONFIG_HW_STACK_PROTECTION=y

# Enable TrustZone-M
CONFIG_ARM_TRUSTZONE_M=y

# This Board implies building Non-Secure firmware
CONFIG_TRUSTED_EXECUTION_NONSECURE=y

# enable GPIO
CONFIG_GPIO=y

# enable PINCTRL
CONFIG_PINCTRL=y

# Enable uart driver
CONFIG_SERIAL=y

# enable console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
41 changes: 41 additions & 0 deletions boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (c) 2024 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/

/dts-v1/;
#include <nordic/nrf5340_cpuappns_qkaa.dtsi>
#include "nrf5340_cpuapp_common.dtsi"

/ {
model = "Nordic NRF5340 DK NRF5340 Application";
compatible = "nordic,nrf5340-dk-nrf5340-cpuapp";

chosen {
zephyr,sram = &sram0_ns_app;
zephyr,flash = &flash0;
zephyr,code-partition = &slot0_ns_partition;
zephyr,entropy = &psa_rng;
zephyr,wifi = &wlan0;
};

psa_rng: psa-rng {
compatible = "zephyr,psa-crypto-rng";
status = "okay";
};
};

&qspi {
nrf70: nrf7002@1 {
compatible = "nordic,nrf7002-qspi";
status = "okay";
reg = <1>;
qspi-frequency = <24000000>;
qspi-quad-mode;

#include "nrf70_common.dtsi"
#include "nrf70_common_coex.dtsi"
#include "nrf70_common_5g.dtsi"
};
};
19 changes: 19 additions & 0 deletions boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
identifier: nrf7002dk/nrf5340/cpuapp/ns
name: NRF7002-DK-NRF5340-application-MCU-Non-Secure
type: mcu
arch: arm
toolchain:
- gnuarmemb
- xtools
- zephyr
ram: 192
flash: 192
supported:
- gpio
- i2c
- pwm
- watchdog
- usbd
- usb_device
- netif:openthread
vendor: nordic
26 changes: 26 additions & 0 deletions boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# SPDX-License-Identifier: Apache-2.0

# Enable MPU
CONFIG_ARM_MPU=y

# Enable hardware stack protection
CONFIG_HW_STACK_PROTECTION=y

# Enable TrustZone-M
CONFIG_ARM_TRUSTZONE_M=y

# This Board implies building Non-Secure firmware
CONFIG_TRUSTED_EXECUTION_NONSECURE=y

# enable GPIO
CONFIG_GPIO=y

# enable PINCTRL
CONFIG_PINCTRL=y

# Enable uart driver
CONFIG_SERIAL=y

# enable console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y

0 comments on commit 793b54e

Please sign in to comment.