Skip to content

Commit 857f369

Browse files
Vge0rgetomi-font
authored andcommitted
platform: nordic_nrf: Add initial support for nRF54L10
This adds nRF54L10 initial support for TF-M. This is NOT full upstream support. There are important limitations: - Hardware crypto acceleration with Cracen is not supported - Random number generation with Cracen is not supported - The tests suites PSA arch tests and TF-M regression tests are not tested - BL2 is not supported - Some soc related configurations are not supported and they rely on hard-coded values (check nordicsemi_nrf54l_init for more info) This was tested using some basic Zephyr samples. Only one flash/RAM layout is supported at the moment. This adds the same level of support with the nRF54L15, the configuration is nearly identical, the main difference is the partitioning scheme since these devices have different RRAM/RAM sizes. Signed-off-by: Georgios Vasilakis <[email protected]> Change-Id: I396d0d570ebd9b471138b7f02019bc0a1279e0d1 (cherry picked from commit d301766)
1 parent 9118ec3 commit 857f369

20 files changed

+708
-1
lines changed

platform/ext/target/nordic_nrf/common/core/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ endif()
2424
# At the time of writing there is no systematic way to identify which
2525
# NVM technology is used by the SoC from the Kconfig, so we just
2626
# hardcode this information here instead.
27-
if((NRF_SOC_VARIANT STREQUAL nrf54l15) OR (TFM_PLATFORM STREQUAL "nordic_nrf/nrf54l15dk_nrf54l15_cpuapp") OR (PSA_API_TEST_TARGET STREQUAL nrf54l15))
27+
if((NRF_SOC_VARIANT MATCHES "^nrf54l1[05]$") OR (TFM_PLATFORM MATCHES "nordic\_nrf\/nrf54l15dk\_nrf54l1[05]\_cpuapp") OR (PSA_API_TEST_TARGET MATCHES "^nrf54l1[05]$"))
2828
# Maybe we only need to check one of these options but these
2929
# variables keep changing so we check both to be future proof
3030
set(HAS_RRAMC 1)
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#-------------------------------------------------------------------------------
2+
# Copyright (c) 2020-2022, Arm Limited. All rights reserved.
3+
# Copyright (c) 2020, Nordic Semiconductor ASA.
4+
#
5+
# SPDX-License-Identifier: BSD-3-Clause
6+
#
7+
#-------------------------------------------------------------------------------
8+
cmake_policy(SET CMP0076 NEW)
9+
set(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR})
10+
11+
set(target nrf54l)
12+
add_subdirectory(../core nrf_common)
13+
14+
#========================= Platform Secure ====================================#
15+
16+
target_include_directories(platform_s
17+
PUBLIC
18+
.
19+
../nrf54l
20+
)
21+
22+
target_sources(platform_s
23+
PRIVATE
24+
${HAL_NORDIC_PATH}/nrfx/mdk/system_nrf54l.c
25+
../nrf54l/nrf54l_init.c
26+
)
27+
28+
target_compile_definitions(platform_s
29+
PUBLIC
30+
NRF_SKIP_FICR_NS_COPY_TO_RAM
31+
)
32+
33+
#========================= tfm_spm ============================================#
34+
35+
target_sources(tfm_spm
36+
PRIVATE
37+
$<$<OR:$<BOOL:${CONFIG_TFM_FLIH_API}>,$<BOOL:${CONFIG_TFM_SLIH_API}>>:${CMAKE_CURRENT_SOURCE_DIR}/../nrf54l/tfm_interrupts.c>
38+
)
39+
40+
#========================= Files for building NS side platform ================#
41+
42+
install(FILES ../nrf54l/nrfx_config_nrf54l.h
43+
ns/CMakeLists.txt
44+
config.cmake
45+
cpuarch.cmake
46+
DESTINATION ${INSTALL_PLATFORM_NS_DIR}/common/nrf54l10
47+
)
48+
49+
install(DIRECTORY partition
50+
tests
51+
DESTINATION ${INSTALL_PLATFORM_NS_DIR}/common/nrf54l10
52+
)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#-------------------------------------------------------------------------------
2+
# Copyright (c) 2020, Nordic Semiconductor ASA.
3+
# Copyright (c) 2020-2023, Arm Limited. All rights reserved.
4+
#
5+
# SPDX-License-Identifier: BSD-3-Clause
6+
#
7+
#-------------------------------------------------------------------------------
8+
9+
include(${PLATFORM_PATH}/common/nrf54l/config.cmake)
10+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#
2+
# Copyright (c) 2023, Nordic Semiconductor ASA.
3+
#
4+
# SPDX-License-Identifier: BSD-3-Clause
5+
#
6+
7+
# cpuarch.cmake is used to set things that related to the platform that are both
8+
# immutable and global, which is to say they should apply to any kind of project
9+
# that uses this platform. In practice this is normally compiler definitions and
10+
# variables related to hardware.
11+
12+
# Set architecture and CPU
13+
set(TFM_SYSTEM_PROCESSOR cortex-m33)
14+
set(TFM_SYSTEM_ARCHITECTURE armv8-m.main)
15+
set(CONFIG_TFM_FP_ARCH "fpv5-sp-d16")
16+
17+
add_compile_definitions(
18+
NRF54L10_XXAA
19+
NRF54L_SERIES
20+
NRF_APPLICATION
21+
# SKIP configuring the SAU from the MDK as it does not fit TF-M's needs
22+
NRF_SKIP_SAU_CONFIGURATION
23+
NRF_SKIP_FICR_NS_COPY_TO_RAM
24+
)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#-------------------------------------------------------------------------------
2+
# Copyright (c) 2023, Arm Limited. All rights reserved.
3+
#
4+
# SPDX-License-Identifier: BSD-3-Clause
5+
#
6+
#-------------------------------------------------------------------------------
7+
8+
cmake_policy(SET CMP0076 NEW)
9+
set(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR})
10+
11+
set(target nrf54l)
12+
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../core nrf_common)
13+
14+
target_include_directories(platform_ns
15+
PUBLIC
16+
${CMAKE_CURRENT_LIST_DIR}
17+
)
18+
19+
target_sources(platform_ns
20+
PRIVATE
21+
${HAL_NORDIC_PATH}/nrfx/mdk/system_nrf54l.c
22+
)
23+
24+
target_compile_definitions(platform_ns
25+
PUBLIC
26+
NRF_TRUSTZONE_NONSECURE
27+
NRF_SKIP_CLOCK_CONFIGURATION
28+
DOMAIN_NS=1
29+
)
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA. All rights reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#ifndef __FLASH_LAYOUT_H__
18+
#define __FLASH_LAYOUT_H__
19+
20+
#ifdef BL2
21+
#error "BL2 is not supported for this platform"
22+
#endif
23+
24+
/* Flash layout on NRF54L15 Application MCU without BL2:
25+
*
26+
* 0x0000_0000 Secure image primary (384 KB)
27+
* 0x0006_0000 Protected Storage Area (16 KB)
28+
* 0x0006_4000 Internal Trusted Storage Area (16 KB)
29+
* 0x0006_8000 OTP / NV counters area (8 KB)
30+
* 0x0006_A000 Non-secure image primary (504 KB)
31+
* 0x000E_8000 Non-secure storage, used when built with NRF_NS_STORAGE=ON,
32+
* otherwise unused (32 KB)
33+
*/
34+
35+
/* This header file is included from linker scatter file as well, where only a
36+
* limited C constructs are allowed. Therefore it is not possible to include
37+
* here the platform_base_address.h to access flash related defines. To resolve
38+
* this some of the values are redefined here with different names, these are
39+
* marked with comment.
40+
*/
41+
42+
/* Use Flash memory to store Code data */
43+
#define FLASH_BASE_ADDRESS (0x0)
44+
45+
/* nRF54L10 has 1022 kB of non volatile memory (RRAM) but the last 62kB are reserved
46+
* for FLPR MCU in Zephyr. For simplicity and for possible support for running FLPR along
47+
* with TF-M later FLPR non volatile memory is not used by TF-M. */
48+
#define FLASH_TOTAL_SIZE (0xF0000) /* 960 kB since the last 62kB are reserved for FLPR */
49+
#define TOTAL_ROM_SIZE FLASH_TOTAL_SIZE
50+
51+
/* nRF54L10 has 192 kB of volatile memory (SRAM) but the last 48kB are reserved
52+
* for FLPR MCU in Zephyr. For simplicity and for possible support for running FLPR along
53+
* with TF-M later FLPR volatile memory is not used by TF-M. */
54+
#define SRAM_BASE_ADDRESS (0x20000000)
55+
#define TOTAL_RAM_SIZE (0x00024000) /* 144 kB since the last 48kB are reserved for FLPR */
56+
57+
#define FLASH_S_PARTITION_SIZE (0x60000) /* S partition: 384 kB*/
58+
#define FLASH_NS_PARTITION_SIZE (0x7E000) /* NS partition: 504 kB*/
59+
60+
#define S_ROM_ALIAS_BASE FLASH_BASE_ADDRESS
61+
#define NS_ROM_ALIAS_BASE FLASH_BASE_ADDRESS
62+
63+
/* Use SRAM memory to store RW data */
64+
#define S_RAM_ALIAS_BASE SRAM_BASE_ADDRESS
65+
#define NS_RAM_ALIAS_BASE SRAM_BASE_ADDRESS
66+
67+
/* Sector size of the embedded flash hardware (erase/program) */
68+
#define FLASH_AREA_IMAGE_SECTOR_SIZE (0x1000) /* 4 KB. Flash memory program/erase operations have a page granularity. */
69+
70+
#if (FLASH_S_PARTITION_SIZE > FLASH_NS_PARTITION_SIZE)
71+
#define FLASH_MAX_PARTITION_SIZE FLASH_S_PARTITION_SIZE
72+
#else
73+
#define FLASH_MAX_PARTITION_SIZE FLASH_NS_PARTITION_SIZE
74+
#endif
75+
76+
/* Offset and size definition in flash area used by assemble.py */
77+
#define SECURE_IMAGE_MAX_SIZE FLASH_S_PARTITION_SIZE
78+
#define NON_SECURE_IMAGE_MAX_SIZE FLASH_NS_PARTITION_SIZE
79+
80+
#define SECURE_STORAGE_PARTITIONS_START (FLASH_BASE_ADDRESS + FLASH_S_PARTITION_SIZE)
81+
82+
/* Protected Storage (PS) Service definitions */
83+
#define FLASH_PS_AREA_OFFSET (SECURE_STORAGE_PARTITIONS_START)
84+
#define FLASH_PS_AREA_SIZE (0x4000) /* 16 KB */
85+
86+
/* Internal Trusted Storage (ITS) Service definitions */
87+
#define FLASH_ITS_AREA_OFFSET (FLASH_PS_AREA_OFFSET + FLASH_PS_AREA_SIZE)
88+
#define FLASH_ITS_AREA_SIZE (0x4000) /* 16 KB */
89+
90+
/* OTP_definitions */
91+
#define FLASH_OTP_NV_COUNTERS_AREA_OFFSET (FLASH_ITS_AREA_OFFSET + FLASH_ITS_AREA_SIZE)
92+
#define FLASH_OTP_NV_COUNTERS_AREA_SIZE (0x2000) /* 8KB */
93+
94+
#define FLASH_OTP_NV_COUNTERS_SECTOR_SIZE FLASH_AREA_IMAGE_SECTOR_SIZE
95+
96+
#define SECURE_STORAGE_PARTITIONS_END (FLASH_OTP_NV_COUNTERS_AREA_OFFSET + FLASH_OTP_NV_COUNTERS_AREA_SIZE)
97+
/* END OF PARTITIONS LAYOUT */
98+
99+
#define SECURE_IMAGE_OFFSET (0x0)
100+
#define NON_SECURE_IMAGE_OFFSET (SECURE_STORAGE_PARTITIONS_END)
101+
102+
/* Non-secure storage region */
103+
#define NRF_FLASH_NS_STORAGE_AREA_SIZE (0x8000) /* 32 KB */
104+
#define NRF_FLASH_NS_STORAGE_AREA_OFFSET (FLASH_TOTAL_SIZE - \
105+
NRF_FLASH_NS_STORAGE_AREA_SIZE)
106+
107+
/* Flash device name used by BL2
108+
* Name is defined in flash driver file: Driver_Flash.c
109+
*/
110+
//#define FLASH_DEV_NAME Driver_FLASH0
111+
/* Smallest flash programmable unit in bytes */
112+
#define TFM_HAL_FLASH_PROGRAM_UNIT (0x4)
113+
114+
/* Protected Storage (PS) Service definitions
115+
* Note: Further documentation of these definitions can be found in the
116+
* TF-M PS Integration Guide.
117+
*/
118+
#define TFM_HAL_PS_FLASH_DRIVER Driver_FLASH0
119+
120+
/* In this target the CMSIS driver requires only the offset from the base
121+
* address instead of the full memory address.
122+
*/
123+
/* Base address of dedicated flash area for PS */
124+
#define TFM_HAL_PS_FLASH_AREA_ADDR FLASH_PS_AREA_OFFSET
125+
/* Size of dedicated flash area for PS */
126+
#define TFM_HAL_PS_FLASH_AREA_SIZE FLASH_PS_AREA_SIZE
127+
#define PS_RAM_FS_SIZE TFM_HAL_PS_FLASH_AREA_SIZE
128+
/* Number of physical erase sectors per logical FS block */
129+
#define TFM_HAL_PS_SECTORS_PER_BLOCK (1)
130+
/* Smallest flash programmable unit in bytes */
131+
#define TFM_HAL_PS_PROGRAM_UNIT (0x4)
132+
133+
/* Internal Trusted Storage (ITS) Service definitions
134+
* Note: Further documentation of these definitions can be found in the
135+
* TF-M ITS Integration Guide. The ITS should be in the internal flash, but is
136+
* allocated in the external flash just for development platforms that don't
137+
* have internal flash available.
138+
*/
139+
#define TFM_HAL_ITS_FLASH_DRIVER Driver_FLASH0
140+
141+
/* In this target the CMSIS driver requires only the offset from the base
142+
* address instead of the full memory address.
143+
*/
144+
/* Base address of dedicated flash area for ITS */
145+
#define TFM_HAL_ITS_FLASH_AREA_ADDR FLASH_ITS_AREA_OFFSET
146+
/* Size of dedicated flash area for ITS */
147+
#define TFM_HAL_ITS_FLASH_AREA_SIZE FLASH_ITS_AREA_SIZE
148+
#define ITS_RAM_FS_SIZE TFM_HAL_ITS_FLASH_AREA_SIZE
149+
/* Number of physical erase sectors per logical FS block */
150+
#define TFM_HAL_ITS_SECTORS_PER_BLOCK (1)
151+
/* Smallest flash programmable unit in bytes */
152+
#define TFM_HAL_ITS_PROGRAM_UNIT (0x4)
153+
154+
/* OTP / NV counter definitions */
155+
#define TFM_OTP_NV_COUNTERS_AREA_SIZE (FLASH_OTP_NV_COUNTERS_AREA_SIZE / 2)
156+
#define TFM_OTP_NV_COUNTERS_AREA_ADDR FLASH_OTP_NV_COUNTERS_AREA_OFFSET
157+
#define TFM_OTP_NV_COUNTERS_SECTOR_SIZE FLASH_OTP_NV_COUNTERS_SECTOR_SIZE
158+
#define TFM_OTP_NV_COUNTERS_BACKUP_AREA_ADDR (TFM_OTP_NV_COUNTERS_AREA_ADDR + \
159+
TFM_OTP_NV_COUNTERS_AREA_SIZE)
160+
161+
162+
#endif /* __FLASH_LAYOUT_H__ */

0 commit comments

Comments
 (0)