Skip to content

Commit a9a44ea

Browse files
Vge0rgetomi-font
authored andcommitted
[nrf fromtree] boards: Add non-secure target for nrf54L15dk
This adds the nrf54l15dk/nrf54l15/cpuapp/ns board variant to Zephyr. It allows to build applications for this target. This is an initial support for the non secure target which allows building and running tfm_ipc and config_build. This is NOT full support of the non secure target in upstream Zephyr. There are important limitations, such as: - The hardware Crypto accelerator is not supported and thus the non secur target is NOT secure for production applicatiions in upstream Zephyr. - The BL2 is not supported, so no DFU is supported with this support Most of the code chagnes here are taken from nRF Connect SDK in order to avoid having noups there. Signed-off-by: Georgios Vasilakis <[email protected]> (cherry picked from commit 47c71e3)
1 parent 56d3fe0 commit a9a44ea

15 files changed

+309
-3
lines changed

boards/nordic/nrf54l15dk/Kconfig

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright (c) 2025 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# nRF54L15 DK board configuration
5+
6+
if BOARD_NRF54L15DK_NRF54L15_CPUAPP_NS
7+
8+
DT_NRF_MPC := $(dt_nodelabel_path,nrf_mpc)
9+
10+
config NRF_TRUSTZONE_FLASH_REGION_SIZE
11+
hex
12+
default $(dt_node_int_prop_hex,$(DT_NRF_MPC),override-granularity)
13+
help
14+
This defines the flash region size from the TrustZone perspective.
15+
It is used when configuring the TrustZone and when setting alignments
16+
requirements for the partitions.
17+
This abstraction allows us to configure TrustZone without depending
18+
on peripheral-specific symbols.
19+
20+
config NRF_TRUSTZONE_RAM_REGION_SIZE
21+
hex
22+
default $(dt_node_int_prop_hex,$(DT_NRF_MPC),override-granularity)
23+
help
24+
This defines the RAM region size from the TrustZone perspective.
25+
It is used when configuring the TrustZone and when setting alignments
26+
requirements for the partitions.
27+
This abstraction allows us to configure TrustZone without depending
28+
on peripheral specific symbols.
29+
30+
endif # BOARD_NRF54L15DK_NRF54L15_CPUAPP_NS

boards/nordic/nrf54l15dk/Kconfig.defconfig

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

4+
# Workaround for not being able to have commas in macro arguments
5+
DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition
6+
DT_CHOSEN_Z_SRAM_PARTITION := zephyr,sram-secure-partition
7+
48
if BOARD_NRF54L15DK_NRF54L05_CPUAPP || BOARD_NRF54L15DK_NRF54L10_CPUAPP || \
59
BOARD_NRF54L15DK_NRF54L15_CPUAPP
610

@@ -10,3 +14,21 @@ config ROM_START_OFFSET
1014

1115
endif # BOARD_NRF54L15DK_NRF54L05_CPUAPP || BOARD_NRF54L15DK_NRF54L10_CPUAPP || \
1216
# BOARD_NRF54L15DK_NRF54L15_CPUAPP
17+
18+
if BOARD_NRF54L15DK_NRF54L15_CPUAPP_NS
19+
20+
config BT_CTLR
21+
default BT
22+
23+
config FLASH_LOAD_OFFSET
24+
default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION))
25+
26+
config FLASH_LOAD_SIZE
27+
default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION))
28+
29+
# By default, if we build for a Non-Secure version of the board,
30+
# enable building with TF-M as the Secure Execution Environment.
31+
config BUILD_WITH_TFM
32+
default y
33+
34+
endif # BOARD_NRF54L15DK_NRF54L15_CPUAPP_NS

boards/nordic/nrf54l15dk/Kconfig.nrf54l15dk

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
config BOARD_NRF54L15DK
55
select SOC_NRF54L05_CPUAPP if BOARD_NRF54L15DK_NRF54L05_CPUAPP
66
select SOC_NRF54L10_CPUAPP if BOARD_NRF54L15DK_NRF54L10_CPUAPP
7-
select SOC_NRF54L15_CPUAPP if BOARD_NRF54L15DK_NRF54L15_CPUAPP
7+
select SOC_NRF54L15_CPUAPP if BOARD_NRF54L15DK_NRF54L15_CPUAPP || BOARD_NRF54L15DK_NRF54L15_CPUAPP_NS
88
select SOC_NRF54L15_CPUFLPR if BOARD_NRF54L15DK_NRF54L15_CPUFLPR || \
99
BOARD_NRF54L15DK_NRF54L15_CPUFLPR_XIP

boards/nordic/nrf54l15dk/board.cmake

+8
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,13 @@ elseif(CONFIG_SOC_NRF54L05_CPUFLPR OR CONFIG_SOC_NRF54L10_CPUFLPR OR CONFIG_SOC_
88
board_runner_args(jlink "--device=RISC-V" "--speed=4000" "-if SW" "--tool-opt=-jlinkscriptfile ${JLINKSCRIPTFILE}")
99
endif()
1010

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

boards/nordic/nrf54l15dk/board.yml

+2
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ board:
99
variants:
1010
- name: xip
1111
cpucluster: cpuflpr
12+
- name: ns
13+
cpucluster: cpuapp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
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 <nordic/nrf54l15_cpuapp.dtsi>
12+
#include "nrf54l_05_10_15_cpuapp_common.dtsi"
13+
14+
/ {
15+
compatible = "nordic,nrf54l15dk_nrf54l15-cpuapp";
16+
model = "Nordic nRF54L15 DK nRF54L15 Application MCU";
17+
18+
chosen {
19+
zephyr,code-partition = &slot0_ns_partition;
20+
zephyr,sram = &sram0_ns;
21+
zephyr,entropy = &psa_rng;
22+
};
23+
24+
/delete-node/ rng;
25+
26+
psa_rng: psa-rng {
27+
status = "okay";
28+
};
29+
};
30+
31+
/ {
32+
/*
33+
* Default SRAM planning when building for nRF54L15 with ARM TrustZone-M support
34+
* - Lowest 80 kB SRAM allocated to Secure image (sram0_s).
35+
* - Upper 80 kB SRAM allocated to Non-Secure image (sram0_ns).
36+
*
37+
* nRF54L15 has 256 kB of volatile memory (SRAM) but the last 96kB are reserved for
38+
* the FLPR MCU.
39+
* This static layout needs to be the same with the upstream TF-M layout in the
40+
* header flash_layout.h of the relevant platform. Any updates in the layout
41+
* needs to happen both in the flash_layout.h and in this file at the same time.
42+
*/
43+
reserved-memory {
44+
#address-cells = <1>;
45+
#size-cells = <1>;
46+
ranges;
47+
48+
sram0_s: image_s@20000000 {
49+
/* Secure image memory */
50+
reg = <0x20000000 DT_SIZE_K(80)>;
51+
};
52+
53+
sram0_ns: image_ns@20014000 {
54+
/* Non-Secure image memory */
55+
reg = <0x20014000 DT_SIZE_K(80)>;
56+
};
57+
};
58+
};
59+
60+
&cpuapp_rram {
61+
partitions {
62+
compatible = "fixed-partitions";
63+
#address-cells = <1>;
64+
#size-cells = <1>;
65+
66+
/* nRF54L15 has 1524 kB of non volatile memory (RRAM) but the
67+
* last 96kB are reserved for the FLPR MCU.
68+
*
69+
* This static layout needs to be the same with the upstream TF-M layout in the
70+
* header flash_layout.h of the relevant platform. Any updates in the layout
71+
* needs to happen both in the flash_layout.h and in this file at the same time.
72+
*/
73+
slot0_partition: partition@0 {
74+
label = "image-0";
75+
reg = <0x0000000 DT_SIZE_K(512)>;
76+
};
77+
78+
tfm_ps_partition: partition@80000 {
79+
label = "tfm-ps";
80+
reg = <0x00080000 DT_SIZE_K(16)>;
81+
};
82+
83+
tfm_its_partition: partition@84000 {
84+
label = "tfm-its";
85+
reg = <0x00084000 DT_SIZE_K(16)>;
86+
};
87+
88+
tfm_otp_partition: partition@88000 {
89+
label = "tfm-otp";
90+
reg = <0x00088000 DT_SIZE_K(8)>;
91+
};
92+
93+
slot0_ns_partition: partition@8A000 {
94+
label = "image-0-nonsecure";
95+
reg = <0x0008A000 DT_SIZE_K(844)>;
96+
};
97+
98+
storage_partition: partition@15D000 {
99+
label = "storage";
100+
reg = <0x00015D000 DT_SIZE_K(32)>;
101+
};
102+
};
103+
};
104+
105+
&uart30 {
106+
/* Disable so that TF-M can use this UART */
107+
status = "disabled";
108+
109+
current-speed = <115200>;
110+
pinctrl-0 = <&uart30_default>;
111+
pinctrl-1 = <&uart30_sleep>;
112+
pinctrl-names = "default", "sleep";
113+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright (c) 2025 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
3+
4+
identifier: nrf54l15dk/nrf54l15/cpuapp/ns
5+
name: nRF54l15-DK-nRF54l15-Application-Non-Secure
6+
type: mcu
7+
arch: arm
8+
toolchain:
9+
- gnuarmemb
10+
- zephyr
11+
ram: 256
12+
flash: 1524
13+
supported:
14+
- adc
15+
- gpio
16+
- i2c
17+
- spi
18+
- counter
19+
- watchdog
20+
- adc
21+
- i2s
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Copyright (c) 2025 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
3+
4+
CONFIG_ARM_MPU=y
5+
CONFIG_HW_STACK_PROTECTION=y
6+
CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y
7+
CONFIG_ARM_TRUSTZONE_M=y
8+
9+
# This Board implies building Non-Secure firmware
10+
CONFIG_TRUSTED_EXECUTION_NONSECURE=y
11+
12+
# Don't enable the cache in the non-secure image as it is a
13+
# secure-only peripheral on 54l
14+
CONFIG_CACHE_MANAGEMENT=n
15+
CONFIG_EXTERNAL_CACHE=n
16+
17+
CONFIG_UART_CONSOLE=y
18+
CONFIG_CONSOLE=y
19+
CONFIG_SERIAL=y
20+
CONFIG_GPIO=y
21+
22+
# Start SYSCOUNTER on driver init
23+
CONFIG_NRF_GRTC_START_SYSCOUNTER=y
24+
25+
# Disable TFM BL2 since it is not supported
26+
CONFIG_TFM_BL2=n
27+
28+
# Support for silence logging is not supported at the moment
29+
# Tracked by: NCSDK-31930
30+
CONFIG_TFM_LOG_LEVEL_SILENCE=n
31+
32+
# The oscillators are configured as secure and cannot be configured
33+
# from the non secure application directly. This needs to be set
34+
# otherwise nrfx will try to configure them, resulting in a bus
35+
# fault.
36+
CONFIG_SOC_NRF54LX_SKIP_CLOCK_CONFIG=y

modules/trusted-firmware-m/Kconfig.tfm

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ config TFM_BOARD
2525
default "${ZEPHYR_BASE}/modules/trusted-firmware-m/nordic/nrf9160" if SOC_NRF9160
2626
default "${ZEPHYR_BASE}/modules/trusted-firmware-m/nordic/nrf9120" if SOC_NRF9120
2727
default "${ZEPHYR_BASE}/modules/trusted-firmware-m/nordic/nrf5340_cpuapp" if SOC_NRF5340_CPUAPP
28+
default "${ZEPHYR_BASE}/modules/trusted-firmware-m/nordic/nrf54l15_cpuapp" if SOC_NRF54L15_CPUAPP
2829
help
2930
The board name used for building TFM. Building with TFM requires that
3031
TFM has been ported to the given board/SoC.

modules/trusted-firmware-m/nordic/include/RTE_Device.h

+16-2
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929
) \
3030
}
3131

32-
#endif
32+
#else
3333

3434
/* Configuration settings for Driver_USART1. */
35-
#if DT_PINCTRL_HAS_NAME(DT_NODELABEL(uart1), default) && DOMAIN_NS != 1U
35+
#if DT_PINCTRL_HAS_NAME(DT_NODELABEL(uart1), default)
3636

3737
#define RTE_USART1 1
3838

@@ -44,6 +44,20 @@
4444
) \
4545
}
4646

47+
#elif DT_PINCTRL_HAS_NAME(DT_NODELABEL(uart30), default)
48+
49+
#define RTE_USART30 1
50+
51+
#define RTE_USART30_PINS \
52+
{ \
53+
DT_FOREACH_CHILD_VARGS( \
54+
DT_PINCTRL_BY_NAME(DT_NODELABEL(uart30), default, 0), \
55+
DT_FOREACH_PROP_ELEM, psels, UART_PIN_INIT \
56+
) \
57+
}
58+
59+
#endif
60+
4761
#endif
4862

4963
/* Configuration settings for Driver_FLASH0. */

modules/trusted-firmware-m/nordic/include/tfm_peripherals_config.h

+8
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,15 @@ extern "C" {
1212
#endif
1313

1414
#ifdef SECURE_UART1
15+
16+
#if defined(NRF54L15_XXAA)
17+
#define TFM_PERIPHERAL_UARTE30_SECURE 1
18+
#else
1519
#define TFM_PERIPHERAL_UARTE1_SECURE 1
1620
#endif
1721

22+
#endif /* SECURE_UART1 */
23+
1824
#if TEST_NS_SLIH_IRQ || TEST_NS_FLIH_IRQ
1925
#define TFM_PERIPHERAL_TIMER0_SECURE 1
2026
#endif
@@ -29,6 +35,8 @@ extern "C" {
2935
#include <tfm_peripherals_config_nrf91.h>
3036
#elif defined(NRF5340_XXAA_APPLICATION)
3137
#include <tfm_peripherals_config_nrf5340_application.h>
38+
#elif defined(NRF54L15_XXAA)
39+
#include <tfm_peripherals_config_nrf54l15.h>
3240
#else
3341
#error "Unknown device."
3442
#endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#
2+
# Copyright (c) 2025, Nordic Semiconductor ASA.
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
set(NRF_BOARD_SELECTED True)
8+
9+
add_subdirectory(${Trusted\ Firmware\ M_SOURCE_DIR}/platform/ext/target/nordic_nrf/common/nrf54l15 nrf54l15)
10+
11+
add_subdirectory(.. common)
12+
13+
install(FILES ${CMAKE_CURRENT_LIST_DIR}/ns/cpuarch_ns.cmake
14+
DESTINATION ${INSTALL_PLATFORM_NS_DIR}
15+
RENAME cpuarch.cmake)
16+
17+
install(FILES config.cmake
18+
DESTINATION ${INSTALL_PLATFORM_NS_DIR})
19+
20+
install(DIRECTORY ${Trusted\ Firmware\ M_SOURCE_DIR}/platform/ext/target/nordic_nrf/nrf54l15dk_nrf54l15_cpuapp/tests
21+
22+
DESTINATION ${INSTALL_PLATFORM_NS_DIR}
23+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#
2+
# Copyright (c) 2025, Nordic Semiconductor ASA.
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
set(NRF_SOC_VARIANT nrf54l15 CACHE STRING "nRF SoC Variant")
8+
9+
include(${PLATFORM_PATH}/common/nrf54l15/config.cmake)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#
2+
# Copyright (c) 2025, Nordic Semiconductor ASA.
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
set(PLATFORM_PATH platform/ext/target/nordic_nrf)
8+
9+
include(${PLATFORM_PATH}/common/nrf54l15/cpuarch.cmake)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#
2+
# Copyright (c) 2025, Nordic Semiconductor ASA.
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
set(PLATFORM_DIR ${CMAKE_CURRENT_LIST_DIR})
8+
set(PLATFORM_PATH ${CMAKE_CURRENT_LIST_DIR})
9+
10+
include(${CMAKE_CURRENT_LIST_DIR}/common/nrf54l15/cpuarch.cmake)

0 commit comments

Comments
 (0)