From 0151535b8f582a1193b0cc63053810b0e2a1dd65 Mon Sep 17 00:00:00 2001 From: Georgios Vasilakis Date: Wed, 26 Mar 2025 10:22:22 +0100 Subject: [PATCH] boards: nordic: Add initial support for nRF54L10 with TF-M This adds the nrf54l15dk/nrf54l10/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 applications in upstream Zephyr. - The BL2 is not supported, so no DFU is supported with this support Most of the code changes here are taken from nRF Connect SDK in order to avoid having noups there. Signed-off-by: Georgios Vasilakis --- boards/nordic/nrf54l15dk/Kconfig | 4 +- boards/nordic/nrf54l15dk/Kconfig.defconfig | 4 +- boards/nordic/nrf54l15dk/Kconfig.nrf54l15dk | 2 +- boards/nordic/nrf54l15dk/board.cmake | 2 +- boards/nordic/nrf54l15dk/board.yml | 3 + .../nrf54l15dk_nrf54l10_cpuapp_ns.dts | 107 ++++++++++++++++++ .../nrf54l15dk_nrf54l10_cpuapp_ns.yaml | 21 ++++ .../nrf54l15dk_nrf54l10_cpuapp_ns_defconfig | 36 ++++++ modules/trusted-firmware-m/Kconfig.tfm | 1 + .../nordic/nrf54l10_cpuapp/CMakeLists.txt | 23 ++++ .../nordic/nrf54l10_cpuapp/config.cmake | 9 ++ .../nordic/nrf54l10_cpuapp/cpuarch.cmake | 9 ++ .../nrf54l10_cpuapp/ns/cpuarch_ns.cmake | 10 ++ 13 files changed, 225 insertions(+), 6 deletions(-) create mode 100644 boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.dts create mode 100644 boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.yaml create mode 100644 boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns_defconfig create mode 100644 modules/trusted-firmware-m/nordic/nrf54l10_cpuapp/CMakeLists.txt create mode 100644 modules/trusted-firmware-m/nordic/nrf54l10_cpuapp/config.cmake create mode 100644 modules/trusted-firmware-m/nordic/nrf54l10_cpuapp/cpuarch.cmake create mode 100644 modules/trusted-firmware-m/nordic/nrf54l10_cpuapp/ns/cpuarch_ns.cmake diff --git a/boards/nordic/nrf54l15dk/Kconfig b/boards/nordic/nrf54l15dk/Kconfig index 29168aeb17e..bf64dd32293 100644 --- a/boards/nordic/nrf54l15dk/Kconfig +++ b/boards/nordic/nrf54l15dk/Kconfig @@ -3,7 +3,7 @@ # nRF54L15 DK board configuration -if BOARD_NRF54L15DK_NRF54L15_CPUAPP_NS +if BOARD_NRF54L15DK_NRF54L15_CPUAPP_NS || BOARD_NRF54L15DK_NRF54L10_CPUAPP_NS DT_NRF_MPC := $(dt_nodelabel_path,nrf_mpc) @@ -27,4 +27,4 @@ config NRF_TRUSTZONE_RAM_REGION_SIZE This abstraction allows us to configure TrustZone without depending on peripheral specific symbols. -endif # BOARD_NRF54L15DK_NRF54L15_CPUAPP_NS +endif # BOARD_NRF54L15DK_NRF54L15_CPUAPP_NS || BOARD_NRF54L15DK_NRF54L10_CPUAPP_NS diff --git a/boards/nordic/nrf54l15dk/Kconfig.defconfig b/boards/nordic/nrf54l15dk/Kconfig.defconfig index 7fcba4c7ea1..9628b1fdf96 100644 --- a/boards/nordic/nrf54l15dk/Kconfig.defconfig +++ b/boards/nordic/nrf54l15dk/Kconfig.defconfig @@ -14,7 +14,7 @@ config ROM_START_OFFSET endif # BOARD_NRF54L15DK_NRF54L05_CPUAPP || BOARD_NRF54L15DK_NRF54L10_CPUAPP || \ # BOARD_NRF54L15DK_NRF54L15_CPUAPP -if BOARD_NRF54L15DK_NRF54L15_CPUAPP_NS +if BOARD_NRF54L15DK_NRF54L15_CPUAPP_NS || BOARD_NRF54L15DK_NRF54L10_CPUAPP_NS config BT_CTLR default BT @@ -30,4 +30,4 @@ config FLASH_LOAD_SIZE config BUILD_WITH_TFM default y -endif # BOARD_NRF54L15DK_NRF54L15_CPUAPP_NS +endif # BOARD_NRF54L15DK_NRF54L15_CPUAPP_NS || BOARD_NRF54L15DK_NRF54L10_CPUAPP_NS diff --git a/boards/nordic/nrf54l15dk/Kconfig.nrf54l15dk b/boards/nordic/nrf54l15dk/Kconfig.nrf54l15dk index 57b90e2c516..c7ae2fff596 100644 --- a/boards/nordic/nrf54l15dk/Kconfig.nrf54l15dk +++ b/boards/nordic/nrf54l15dk/Kconfig.nrf54l15dk @@ -3,7 +3,7 @@ config BOARD_NRF54L15DK select SOC_NRF54L05_CPUAPP if BOARD_NRF54L15DK_NRF54L05_CPUAPP - select SOC_NRF54L10_CPUAPP if BOARD_NRF54L15DK_NRF54L10_CPUAPP + select SOC_NRF54L10_CPUAPP if BOARD_NRF54L15DK_NRF54L10_CPUAPP || BOARD_NRF54L15DK_NRF54L10_CPUAPP_NS select SOC_NRF54L15_CPUAPP if BOARD_NRF54L15DK_NRF54L15_CPUAPP || BOARD_NRF54L15DK_NRF54L15_CPUAPP_NS select SOC_NRF54L15_CPUFLPR if BOARD_NRF54L15DK_NRF54L15_CPUFLPR || \ BOARD_NRF54L15DK_NRF54L15_CPUFLPR_XIP diff --git a/boards/nordic/nrf54l15dk/board.cmake b/boards/nordic/nrf54l15dk/board.cmake index 8c1c0d1a224..03383155d98 100644 --- a/boards/nordic/nrf54l15dk/board.cmake +++ b/boards/nordic/nrf54l15dk/board.cmake @@ -10,7 +10,7 @@ elseif(CONFIG_SOC_NRF54L05_CPUFLPR OR CONFIG_SOC_NRF54L10_CPUFLPR) board_runner_args(jlink "--device=RISC-V" "--speed=4000" "-if SW" "--tool-opt=-jlinkscriptfile ${JLINKSCRIPTFILE}") endif() -if(CONFIG_BOARD_NRF54L15DK_NRF54L15_CPUAPP_NS) +if(CONFIG_BOARD_NRF54L15DK_NRF54L15_CPUAPP_NS OR CONFIG_BOARD_NRF54L15DK_NRF54L10_CPUAPP_NS) set(TFM_PUBLIC_KEY_FORMAT "full") endif() diff --git a/boards/nordic/nrf54l15dk/board.yml b/boards/nordic/nrf54l15dk/board.yml index 90642de6157..0ca8b728459 100644 --- a/boards/nordic/nrf54l15dk/board.yml +++ b/boards/nordic/nrf54l15dk/board.yml @@ -5,6 +5,9 @@ board: socs: - name: nrf54l05 - name: nrf54l10 + variants: + - name: ns + cpucluster: cpuapp - name: nrf54l15 variants: - name: xip diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.dts b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.dts new file mode 100644 index 00000000000..f1aa851ed2d --- /dev/null +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.dts @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#define USE_NON_SECURE_ADDRESS_MAP 1 + +#include +#include "nrf54l_05_10_15_cpuapp_common.dtsi" + +/ { + compatible = "nordic,nrf54l15dk_nrf54l10-cpuapp"; + model = "Nordic nRF54L15 DK nRF54L10 Application MCU"; + + chosen { + zephyr,code-partition = &slot0_ns_partition; + zephyr,sram = &sram0_ns; + zephyr,entropy = &psa_rng; + }; + + /delete-node/ rng; + + psa_rng: psa-rng { + status = "okay"; + }; +}; + +/ { + /* + * Default SRAM planning when building for nRF54L10 with ARM TrustZone-M support. + * - Lowest 96 kB SRAM allocated to Secure image (sram0_s). + * - Upper 96 kB SRAM allocated to Non-Secure image (sram0_ns). + * + * nRF54L10 has 192 kB of volatile memory (SRAM) but the last 42kB are reserved for + * the FLPR MCU. + * This static layout needs to be the same with the upstream TF-M layout in the + * header flash_layout.h of the relevant platform. Any updates in the layout + * needs to happen both in the flash_layout.h and in this file at the same time. + */ + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + sram0_s: image_s@20000000 { + /* Secure image memory */ + reg = <0x20000000 DT_SIZE_K(72)>; + }; + + sram0_ns: image_ns@20012000 { + /* Non-Secure image memory */ + reg = <0x20012000 DT_SIZE_K(72)>; + }; + }; +}; + +&cpuapp_rram { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + /* nRF54L10 has 1022 kB of non volatile memory (RRAM) but the + * last 62kB are reserved for the FLPR MCU. + * + * This static layout needs to be the same with the upstream TF-M layout in the + * header flash_layout.h of the relevant platform. Any updates in the layout + * needs to happen both in the flash_layout.h and in this file at the same time. + */ + slot0_partition: partition@0 { + label = "image-0"; + reg = <0x0000000 DT_SIZE_K(384)>; + }; + + tfm_ps_partition: partition@60000 { + label = "tfm-ps"; + reg = <0x00060000 DT_SIZE_K(16)>; + }; + + tfm_its_partition: partition@64000 { + label = "tfm-its"; + reg = <0x00064000 DT_SIZE_K(16)>; + }; + + tfm_otp_partition: partition@68000 { + label = "tfm-otp"; + reg = <0x00068000 DT_SIZE_K(8)>; + }; + + slot0_ns_partition: partition@6A000 { + label = "image-0-nonsecure"; + reg = <0x0006A000 DT_SIZE_K(504)>; + }; + + storage_partition: partition@E8000 { + label = "storage"; + reg = <0x000E8000 DT_SIZE_K(32)>; + }; + }; +}; + +&uart30 { + /* Disable so that TF-M can use this UART */ + status = "disabled"; +}; diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.yaml b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.yaml new file mode 100644 index 00000000000..c771aca2e38 --- /dev/null +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns.yaml @@ -0,0 +1,21 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +identifier: nrf54l15dk/nrf54l10/cpuapp/ns +name: nRF54l15-DK-nRF54l10-Application-Non-Secure +type: mcu +arch: arm +toolchain: + - gnuarmemb + - zephyr +ram: 192 +flash: 1022 +supported: + - adc + - gpio + - i2c + - spi + - counter + - watchdog + - adc + - i2s diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns_defconfig b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns_defconfig new file mode 100644 index 00000000000..1d759be671c --- /dev/null +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_ns_defconfig @@ -0,0 +1,36 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_ARM_MPU=y +CONFIG_HW_STACK_PROTECTION=y +CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y +CONFIG_ARM_TRUSTZONE_M=y + +# This Board implies building Non-Secure firmware +CONFIG_TRUSTED_EXECUTION_NONSECURE=y + +# Don't enable the cache in the non-secure image as it is a +# secure-only peripheral on 54l +CONFIG_CACHE_MANAGEMENT=n +CONFIG_EXTERNAL_CACHE=n + +CONFIG_UART_CONSOLE=y +CONFIG_CONSOLE=y +CONFIG_SERIAL=y +CONFIG_GPIO=y + +# Start SYSCOUNTER on driver init +CONFIG_NRF_GRTC_START_SYSCOUNTER=y + +# Disable TFM BL2 since it is not supported +CONFIG_TFM_BL2=n + +# Support for silence logging is not supported at the moment +# Tracked by: NCSDK-31930 +CONFIG_TFM_LOG_LEVEL_SILENCE=n + +# The oscillators are configured as secure and cannot be configured +# from the non secure application directly. This needs to be set +# otherwise nrfx will try to configure them, resulting in a bus +# fault. +CONFIG_SOC_NRF54LX_SKIP_CLOCK_CONFIG=y diff --git a/modules/trusted-firmware-m/Kconfig.tfm b/modules/trusted-firmware-m/Kconfig.tfm index 4d5925e1000..7a8e4592009 100644 --- a/modules/trusted-firmware-m/Kconfig.tfm +++ b/modules/trusted-firmware-m/Kconfig.tfm @@ -26,6 +26,7 @@ config TFM_BOARD default "${ZEPHYR_BASE}/modules/trusted-firmware-m/nordic/nrf9120" if SOC_NRF9120 default "${ZEPHYR_BASE}/modules/trusted-firmware-m/nordic/nrf5340_cpuapp" if SOC_NRF5340_CPUAPP default "${ZEPHYR_BASE}/modules/trusted-firmware-m/nordic/nrf54l15_cpuapp" if SOC_NRF54L15_CPUAPP + default "${ZEPHYR_BASE}/modules/trusted-firmware-m/nordic/nrf54l10_cpuapp" if SOC_NRF54L10_CPUAPP help The board name used for building TFM. Building with TFM requires that TFM has been ported to the given board/SoC. diff --git a/modules/trusted-firmware-m/nordic/nrf54l10_cpuapp/CMakeLists.txt b/modules/trusted-firmware-m/nordic/nrf54l10_cpuapp/CMakeLists.txt new file mode 100644 index 00000000000..c1bdb28c52c --- /dev/null +++ b/modules/trusted-firmware-m/nordic/nrf54l10_cpuapp/CMakeLists.txt @@ -0,0 +1,23 @@ +# +# Copyright (c) 2025, Nordic Semiconductor ASA. +# +# SPDX-License-Identifier: Apache-2.0 +# + +set(NRF_BOARD_SELECTED True) + +add_subdirectory(${Trusted\ Firmware\ M_SOURCE_DIR}/platform/ext/target/nordic_nrf/common/nrf54l10 nrf54l10) + +add_subdirectory(.. common) + +install(FILES ${CMAKE_CURRENT_LIST_DIR}/ns/cpuarch_ns.cmake + DESTINATION ${INSTALL_PLATFORM_NS_DIR} + RENAME cpuarch.cmake) + +install(FILES config.cmake + DESTINATION ${INSTALL_PLATFORM_NS_DIR}) + +install(DIRECTORY ${Trusted\ Firmware\ M_SOURCE_DIR}/platform/ext/target/nordic_nrf/nrf54l15dk_nrf54l10_cpuapp/tests + + DESTINATION ${INSTALL_PLATFORM_NS_DIR} +) diff --git a/modules/trusted-firmware-m/nordic/nrf54l10_cpuapp/config.cmake b/modules/trusted-firmware-m/nordic/nrf54l10_cpuapp/config.cmake new file mode 100644 index 00000000000..275295a164d --- /dev/null +++ b/modules/trusted-firmware-m/nordic/nrf54l10_cpuapp/config.cmake @@ -0,0 +1,9 @@ +# +# Copyright (c) 2025, Nordic Semiconductor ASA. +# +# SPDX-License-Identifier: Apache-2.0 +# + +set(NRF_SOC_VARIANT nrf54l10 CACHE STRING "nRF SoC Variant") + +include(${PLATFORM_PATH}/common/nrf54l10/config.cmake) diff --git a/modules/trusted-firmware-m/nordic/nrf54l10_cpuapp/cpuarch.cmake b/modules/trusted-firmware-m/nordic/nrf54l10_cpuapp/cpuarch.cmake new file mode 100644 index 00000000000..e6b6c70674e --- /dev/null +++ b/modules/trusted-firmware-m/nordic/nrf54l10_cpuapp/cpuarch.cmake @@ -0,0 +1,9 @@ +# +# Copyright (c) 2025, Nordic Semiconductor ASA. +# +# SPDX-License-Identifier: Apache-2.0 +# + +set(PLATFORM_PATH platform/ext/target/nordic_nrf) + +include(${PLATFORM_PATH}/common/nrf54l10/cpuarch.cmake) diff --git a/modules/trusted-firmware-m/nordic/nrf54l10_cpuapp/ns/cpuarch_ns.cmake b/modules/trusted-firmware-m/nordic/nrf54l10_cpuapp/ns/cpuarch_ns.cmake new file mode 100644 index 00000000000..c45f535be70 --- /dev/null +++ b/modules/trusted-firmware-m/nordic/nrf54l10_cpuapp/ns/cpuarch_ns.cmake @@ -0,0 +1,10 @@ +# +# Copyright (c) 2025, Nordic Semiconductor ASA. +# +# SPDX-License-Identifier: Apache-2.0 +# + +set(PLATFORM_DIR ${CMAKE_CURRENT_LIST_DIR}) +set(PLATFORM_PATH ${CMAKE_CURRENT_LIST_DIR}) + +include(${CMAKE_CURRENT_LIST_DIR}/common/nrf54l10/cpuarch.cmake)