Skip to content

Commit 14c7de2

Browse files
rob-robinson-14nordicjm
authored andcommitted
boards: nordic: Add non-secure targets for nRF7120
This adds the nrf7120pdk/cpuapp/ns board variant to sdk-zephyr. It allows to build nrf7120pdk with TF-M in nRF Connect SDK. Once upstreamed to zephyr, commit will become a noup within sdk-zephyr. This is done as a noup as the out-of-tree board extension feature is not available. When zephyrproject-rtos/zephyr#69548 is completed this commit can be reverted and the variant be placed in sdk-nrf. Signed-off-by: Robert Robinson <[email protected]>
1 parent cea4f85 commit 14c7de2

File tree

9 files changed

+157
-2
lines changed

9 files changed

+157
-2
lines changed

boards/nordic/nrf7120pdk/Kconfig.defconfig

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,26 @@ if BOARD_NRF7120PDK_NRF7120_CPUAPP
66
config BT_CTLR
77
default BT
88

9+
config ROM_START_OFFSET
10+
default 0 if PARTITION_MANAGER_ENABLED
11+
default 0x800 if BOOTLOADER_MCUBOOT
12+
913
endif # BOARD_NRF7120PDK_NRF7120_CPUAPP
14+
15+
if BOARD_NRF7120PDK_NRF7120_CPUAPP_NS
16+
17+
config BT_CTLR
18+
default BT
19+
20+
# By default, if we build for a Non-Secure version of the board,
21+
# enable building with TF-M as the Secure Execution Environment.
22+
config BUILD_WITH_TFM
23+
default y
24+
25+
# By default, if we build with TF-M, instruct build system to
26+
# flash the combined TF-M (Secure) & Zephyr (Non Secure) image
27+
config TFM_FLASH_MERGED_BINARY
28+
default y
29+
depends on BUILD_WITH_TFM
30+
31+
endif # BOARD_NRF7120PDK_NRF7120_CPUAPP_NS
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Copyright (c) 2025 Nordic Semiconductor ASA
2-
# SPDX-License-Identifier: Apache-2.0
2+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
33
config BOARD_NRF7120PDK
4-
select SOC_NRF7120_ENGA_CPUAPP if BOARD_NRF7120PDK_NRF7120_CPUAPP
4+
select SOC_NRF7120_ENGA_CPUAPP if BOARD_NRF7120PDK_NRF7120_CPUAPP || \
5+
BOARD_NRF7120PDK_NRF7120_CPUAPP_NS
56
select SOC_NRF7120_ENGA_CPUFLPR if BOARD_NRF7120PDK_NRF7120_CPUFLPR || \
67
BOARD_NRF7120PDK_NRF7120_CPUFLPR_XIP

boards/nordic/nrf7120pdk/board.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ elseif(CONFIG_SOC_NRF7120_ENGA_CPUFLPR)
77
board_runner_args(jlink "--speed=4000")
88
endif()
99

10+
if(BOARD_NRF7120PDK_NRF7120_CPUAPP_NS)
11+
set(TFM_PUBLIC_KEY_FORMAT "full")
12+
endif()
13+
14+
if(CONFIG_TFM_FLASH_MERGED_BINARY)
15+
set_property(TARGET runners_yaml_props_target PROPERTY hex_file tfm_merged.hex)
16+
endif()
17+
1018
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
1119
include(${ZEPHYR_BASE}/boards/common/nrfutil.board.cmake)
1220
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)

boards/nordic/nrf7120pdk/board.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ board:
66
variants:
77
- name: xip
88
cpucluster: cpuflpr
9+
- name: ns
10+
cpucluster: cpuapp
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/dts-v1/;
8+
9+
#define USE_NON_SECURE_ADDRESS_MAP 1
10+
11+
#include "nrf7120_cpuapp_common.dtsi"
12+
13+
/ {
14+
compatible = "nordic,nrf7120pdk_nrf7120-cpuapp";
15+
model = "Nordic nRF7120 PDK nRF7120 Application MCU";
16+
17+
chosen {
18+
zephyr,sram = &cpuapp_sram;
19+
};
20+
};
21+
22+
&uart30 {
23+
/* Disable so that TF-M can use this UART */
24+
status = "disabled";
25+
};
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright (c) 2025 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
3+
4+
identifier: nrf7120pdk/nrf7120/cpuapp/ns
5+
name: nRF7120-PDK-nRF7120-Application-Non-Secure
6+
type: mcu
7+
arch: arm
8+
toolchain:
9+
- gnuarmemb
10+
- xtools
11+
- zephyr
12+
ram: 896
13+
flash: 4088
14+
supported:
15+
- adc
16+
- gpio
17+
- i2c
18+
- spi
19+
- counter
20+
- watchdog
21+
- adc
22+
- i2s
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright (c) 2025 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
3+
4+
# Enable MPU
5+
CONFIG_ARM_MPU=y
6+
7+
# Enable hardware stack protection
8+
CONFIG_HW_STACK_PROTECTION=y
9+
10+
CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y
11+
12+
# Enable TrustZone-M
13+
CONFIG_ARM_TRUSTZONE_M=y
14+
15+
# This Board implies building Non-Secure firmware
16+
CONFIG_TRUSTED_EXECUTION_NONSECURE=y
17+
18+
# Don't enable the cache in the non-secure image as it is a
19+
# secure-only peripheral on 71x series
20+
CONFIG_CACHE_MANAGEMENT=n
21+
CONFIG_EXTERNAL_CACHE=n
22+
23+
CONFIG_UART_CONSOLE=y
24+
CONFIG_CONSOLE=y
25+
CONFIG_SERIAL=y
26+
27+
# Enable GPIO
28+
CONFIG_GPIO=y
29+
30+
# Start SYSCOUNTER on driver init
31+
CONFIG_NRF_GRTC_START_SYSCOUNTER=y

soc/nordic/nrf71/Kconfig

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,25 @@ config SOC_NRF7120_ENGA_CPUAPP
2323

2424
config SOC_NRF7120_ENGA_CPUFLPR
2525
select RISCV_CORE_NORDIC_VPR
26+
27+
DT_MPC_REGION_SIZE := $(dt_nodelabel_path,nrf_mpc_region)
28+
29+
config NRF_TRUSTZONE_FLASH_REGION_SIZE
30+
hex
31+
default $(dt_node_int_prop_hex,$(DT_MPC_REGION_SIZE),protection-region-size)
32+
help
33+
This defines the flash region size from the TRUSTZONE perspective.
34+
It is used when configuring the TRUSTZONE and when setting alignments
35+
requirements for the partitions.
36+
This abstraction allows us to configure TRUSTZONE without depending
37+
on peripheral specific symbols.
38+
39+
config NRF_TRUSTZONE_RAM_REGION_SIZE
40+
hex
41+
default $(dt_node_int_prop_hex,$(DT_MPC_REGION_SIZE),protection-region-size)
42+
help
43+
This defines the RAM region size from the TRUSTZONE perspective.
44+
It is used when configuring the TRUSTZONE and when setting alignments
45+
requirements for the partitions.
46+
This abstraction allows us to configure TRUSTZONE without depending
47+
on peripheral specific symbols.

soc/nordic/nrf71/soc.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,19 @@
1212
* for the Nordic Semiconductor nRF71 family processor.
1313
*/
1414

15+
#ifdef __NRF_TFM__
16+
#include <zephyr/autoconf.h>
17+
#endif
18+
1519
#include <zephyr/kernel.h>
1620
#include <zephyr/devicetree.h>
1721
#include <zephyr/init.h>
1822
#include <zephyr/logging/log.h>
1923

24+
#ifndef __NRF_TFM__
25+
#include <zephyr/cache.h>
26+
#endif
27+
2028
#if defined(NRF_APPLICATION)
2129
#include <cmsis_core.h>
2230
#include <hal/nrf_glitchdet.h>
@@ -29,8 +37,22 @@ LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL);
2937

3038
void soc_early_init_hook(void)
3139
{
40+
/* Update the SystemCoreClock global variable with current core clock
41+
* retrieved from hardware state.
42+
*/
43+
#if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) || defined(__NRF_TFM__)
44+
/* Currently not supported for non-secure */
45+
SystemCoreClockUpdate();
46+
#endif
47+
48+
#ifdef __NRF_TFM__
49+
/* TF-M enables the instruction cache from target_cfg.c, so we
50+
* don't need to enable it here.
51+
*/
52+
#else
3253
/* Enable ICACHE */
3354
sys_cache_instr_enable();
55+
#endif
3456
}
3557

3658
void arch_busy_wait(uint32_t time_us)

0 commit comments

Comments
 (0)