Skip to content

Commit a8390df

Browse files
degjorvanordicjm
authored andcommitted
modules: trusted-firmware-m: Add support for TF-m to nRF54LM20a
Update configurations to support /ns targets for LM20 Signed-off-by: Dag Erik Gjørvad <[email protected]>
1 parent 277f82c commit a8390df

File tree

17 files changed

+133
-30
lines changed

17 files changed

+133
-30
lines changed

cmake/sysbuild/partition_manager.cmake

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ macro(add_region)
2222
list(APPEND ${underscore_domain}region_arguments "--${REGION_NAME}-base-address;${REGION_BASE}")
2323
list(APPEND ${underscore_domain}region_arguments
2424
"--${REGION_NAME}-placement-strategy;${REGION_PLACEMENT}")
25-
if (REGION_DEVICE)
25+
if(REGION_DEVICE)
2626
list(APPEND ${underscore_domain}region_arguments "--${REGION_NAME}-device;${REGION_DEVICE}")
2727
list(APPEND ${underscore_domain}region_arguments
2828
"--${REGION_NAME}-default-driver-kconfig;${REGION_DEFAULT_DRIVER_KCONFIG}")
2929
endif()
30-
if (REGION_DYNAMIC_PARTITION)
30+
if(REGION_DYNAMIC_PARTITION)
3131
list(APPEND ${underscore_domain}region_arguments
3232
"--${REGION_NAME}-dynamic-partition;${REGION_DYNAMIC_PARTITION}")
3333
endif()
@@ -69,13 +69,13 @@ function(partition_manager)
6969

7070
if(EXISTS "${user_def_pm_static}" AND NOT IS_DIRECTORY "${user_def_pm_static}")
7171
set(static_configuration_file ${user_def_pm_static})
72-
elseif (EXISTS ${conf_dir_pm_static})
72+
elseif(EXISTS ${conf_dir_pm_static})
7373
set(static_configuration_file ${conf_dir_pm_static})
74-
elseif (EXISTS ${board_dir_pm_static})
74+
elseif(EXISTS ${board_dir_pm_static})
7575
set(static_configuration_file ${board_dir_pm_static})
7676
endif()
7777

78-
if (EXISTS ${static_configuration_file})
78+
if(EXISTS ${static_configuration_file})
7979
message(STATUS "Found partition manager static configuration ${PM_DOMAIN}: "
8080
"${static_configuration_file}"
8181
)
@@ -138,7 +138,7 @@ function(partition_manager)
138138
)
139139
endif()
140140

141-
if (DEFINED PM_DOMAIN)
141+
if(DEFINED PM_DOMAIN)
142142
set(underscore _)
143143
else()
144144
set(underscore)
@@ -273,7 +273,7 @@ function(partition_manager)
273273
endif()
274274
endforeach()
275275

276-
if (DEFINED PM_DOMAIN)
276+
if(DEFINED PM_DOMAIN)
277277
set(merged_suffix _${PM_DOMAIN})
278278
string(TOUPPER ${merged_suffix} MERGED_SUFFIX)
279279
endif()
@@ -330,12 +330,12 @@ function(partition_manager)
330330
${CMAKE_BINARY_DIR}/${container}.hex
331331
)
332332

333-
if (DEFINED PM_DOMAIN)
333+
if(DEFINED PM_DOMAIN)
334334
get_property(image_name GLOBAL PROPERTY DOMAIN_APP_${PM_DOMAIN})
335335
update_runner(IMAGE ${image_name} HEX ${CMAKE_BINARY_DIR}/${container}.hex)
336336
endif()
337337

338-
if ("${container}" STREQUAL "merged")
338+
if("${container}" STREQUAL "merged")
339339
update_runner(IMAGE ${DEFAULT_IMAGE} HEX ${CMAKE_BINARY_DIR}/${container}.hex)
340340
endif()
341341
endforeach()
@@ -406,7 +406,7 @@ get_property(PM_SUBSYS_PREPROCESSED GLOBAL PROPERTY PM_SUBSYS_PREPROCESSED)
406406
# have a statically defined size. There is only one dynamic partition per
407407
# domain. For the "root domain" (ie the domain of the root image) this is
408408
# always "app".
409-
if (NOT is_dynamic_partition_in_domain)
409+
if(NOT is_dynamic_partition_in_domain)
410410
set(dynamic_partition "app")
411411
else()
412412
set(dynamic_partition ${${DOMAIN}_PM_DOMAIN_DYNAMIC_PARTITION})
@@ -559,7 +559,7 @@ foreach(d APP ${PM_DOMAINS})
559559
sysbuild_get(${image_name}_CONFIG_FLASH_SIZE IMAGE ${image_name} VAR CONFIG_FLASH_SIZE KCONFIG)
560560
math(EXPR flash_size "${${image_name}_CONFIG_FLASH_SIZE} * 1024" OUTPUT_FORMAT HEXADECIMAL)
561561

562-
if (${image_name}_CONFIG_SOC_SERIES_NRF91X OR ${image_name}_CONFIG_SOC_NRF5340_CPUAPP OR ${image_name}_CONFIG_SOC_SERIES_NRF54LX)
562+
if(${image_name}_CONFIG_SOC_SERIES_NRF91X OR ${image_name}_CONFIG_SOC_NRF5340_CPUAPP OR ${image_name}_CONFIG_SOC_SERIES_NRF54LX)
563563
add_region(
564564
NAME otp
565565
SIZE ${otp_size}
@@ -645,7 +645,7 @@ endforeach()
645645
list(APPEND pm_out_partition_file ${APPLICATION_BINARY_DIR}/partitions.yml)
646646
list(APPEND pm_out_region_file ${APPLICATION_BINARY_DIR}/regions.yml)
647647

648-
if (is_dynamic_partition_in_domain)
648+
if(is_dynamic_partition_in_domain)
649649
# Nothing is built as child.
650650
# We have all required info available, just need to use them.
651651
# We are being built as sub image.
@@ -668,7 +668,7 @@ else()
668668
list(REMOVE_DUPLICATES PM_DOMAINS)
669669
foreach (d ${PM_DOMAINS})
670670
# Don't include shared vars from own domain.
671-
if (NOT ("${DOMAIN}" STREQUAL "${d}"))
671+
if(NOT ("${DOMAIN}" STREQUAL "${d}"))
672672
get_shared(shared_header_files IMAGE ${d} PROPERTY PM_DOMAIN_HEADER_FILES)
673673
get_shared(shared_prefixed_images IMAGE ${d} PROPERTY PM_DOMAIN_IMAGES)
674674
get_shared(shared_pm_out_partition_file IMAGE ${d} PROPERTY PM_DOMAIN_PARTITIONS)

modules/trusted-firmware-m/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,7 @@ config TFM_S_CODE_VECTOR_TABLE_SIZE
511511
hex
512512
default 0x144 if SOC_SERIES_NRF91X
513513
default 0x154 if SOC_NRF5340_CPUAPP
514+
default 0x4cc if SOC_NRF54LM20A_ENGA_CPUAPP
514515
default 0x47c if SOC_SERIES_NRF54LX
515516
default 0x504 if SOC_SERIES_NRF71X
516517
default 0xffffffff # Invalid value to discover missing SOC support.

modules/trusted-firmware-m/Kconfig.tfm.defconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ config TFM_BOARD
1313
default "$(ZEPHYR_NRF_MODULE_DIR)/modules/trusted-firmware-m/tfm_boards/nrf54l15_cpuapp" if SOC_NRF54L15_CPUAPP
1414
default "$(ZEPHYR_NRF_MODULE_DIR)/modules/trusted-firmware-m/tfm_boards/nrf54l10_cpuapp" if SOC_NRF54L10_CPUAPP
1515
default "$(ZEPHYR_NRF_MODULE_DIR)/modules/trusted-firmware-m/tfm_boards/nrf54lv10a_cpuapp" if SOC_NRF54LV10A_ENGA_CPUAPP
16+
default "$(ZEPHYR_NRF_MODULE_DIR)/modules/trusted-firmware-m/tfm_boards/nrf54lm20a_cpuapp" if SOC_NRF54LM20A_ENGA_CPUAPP
1617
default "${ZEPHYR_NRF_MODULE_DIR}/modules/trusted-firmware-m/tfm_boards/nrf7120_cpuapp" if SOC_NRF7120_ENGA_CPUAPP
1718
depends on TRUSTED_EXECUTION_NONSECURE
1819

modules/trusted-firmware-m/Kconfig.tfm.pm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ config PM_PARTITION_SIZE_TFM_SRAM
1919
# Set the of TFM_SRAM to 0x10000(64kB) since the nR54L10
2020
# has less RAM. The number was selected based on the observed memory
2121
# usage of TFM in crypto samples and it can be changed later if needed.
22-
default 0x10000 if SOC_NRF54L10_CPUAPP || SOC_NRF54LV10A_ENGA_CPUAPP
22+
default 0x10000 if SOC_NRF54L10_CPUAPP || SOC_NRF54LV10A_ENGA_CPUAPP || \
23+
SOC_NRF54LM20A_ENGA_CPUAPP
2324
default 0x16000 if SOC_SERIES_NRF91X
2425
default 0x30000
2526
help

modules/trusted-firmware-m/tfm_boards/CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ if(${TFM_PARTITION_CRYPTO})
9292
# file, which means that we need to make sure that the nrf_security PSA headers
9393
# are included before any other PSA-related headers.
9494
if((NRF_SOC_VARIANT MATCHES "nrf54l1[05]") OR
95-
(NRF_SOC_VARIANT MATCHES "nrf54lv10a") OR (NRF_SOC_VARIANT MATCHES "nrf7120"))
95+
(NRF_SOC_VARIANT MATCHES "nrf54lv10a") OR
96+
(NRF_SOC_VARIANT MATCHES "nrf54lm20a") OR
97+
(NRF_SOC_VARIANT MATCHES "nrf7120"))
9698
target_link_libraries(platform_crypto_keys
9799
PRIVATE
98100
psa_crypto_library_config
@@ -224,7 +226,10 @@ file(COPY ${CMAKE_CURRENT_LIST_DIR}/common
224226

225227

226228
if((NRF_SOC_VARIANT MATCHES "nrf54l1[05]") OR
227-
(NRF_SOC_VARIANT MATCHES "nrf54lv10a") OR (NRF_SOC_VARIANT MATCHES "nrf7120"))
229+
(NRF_SOC_VARIANT MATCHES "nrf54lv10a") OR
230+
(NRF_SOC_VARIANT MATCHES "nrf54lm20a") OR
231+
(NRF_SOC_VARIANT MATCHES "nrf7120"))
232+
228233
file(COPY ${ZEPHYR_NRF_MODULE_DIR}/subsys/nrf_security/src/drivers/cracen/cracenpsa/include/cracen_psa_key_ids.h
229234
DESTINATION ${INSTALL_INTERFACE_INC_DIR})
230235
file(COPY ${ZEPHYR_NRF_MODULE_DIR}/subsys/nrf_security/src/drivers/cracen/cracenpsa/include/cracen_psa_kmu.h

modules/trusted-firmware-m/tfm_boards/board/device_cfg.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
#undef ARRAY_SIZE
1414
#include <zephyr/devicetree.h>
1515

16-
17-
#if defined(NRF54L15_XXAA) || defined(NRF54L10_XXAA) || defined(NRF54LV10A_ENGA_XXAA) || \
16+
#if defined(NRF54L15_XXAA) || defined(NRF54L10_XXAA) || \
17+
defined(NRF54LV10A_ENGA_XXAA) || defined(NRF54LM20A_ENGA_XXAA) || \
1818
defined(NRF7120_ENGA_XXAA)
1919
#if defined(CONFIG_TFM_SECURE_UART00) && DOMAIN_NS != 1U
2020
#define TFM_UART uart00
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#
2+
# Copyright (c) 2025, Nordic Semiconductor ASA.
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
set(NRF_BOARD_SELECTED True)
8+
9+
add_subdirectory(${Trusted\ Firmware\ M_SOURCE_DIR}/platform/ext/target/nordic_nrf/common/nrf54lm20a
10+
nrf54lm20a)
11+
12+
add_subdirectory(.. tfm_board)
13+
14+
target_include_directories(platform_s
15+
PUBLIC
16+
${ZEPHYR_NRF_MODULE_DIR}/subsys/nrf_security/src/drivers/cracen/cracenpsa/include
17+
)
18+
19+
target_sources(platform_s
20+
PRIVATE
21+
${ZEPHYR_BASE}/soc/nordic/nrf54l/soc.c
22+
)
23+
24+
target_include_directories(platform_s
25+
PRIVATE
26+
${ZEPHYR_BASE}/modules/cmsis/
27+
${ZEPHYR_BASE}/soc/nordic/nrf54l
28+
${ZEPHYR_BASE}/soc/nordic/common
29+
)
30+
31+
install(FILES ${CMAKE_CURRENT_LIST_DIR}/ns/cpuarch_ns.cmake
32+
DESTINATION ${INSTALL_PLATFORM_NS_DIR}
33+
RENAME cpuarch.cmake)
34+
35+
install(FILES config.cmake
36+
DESTINATION ${INSTALL_PLATFORM_NS_DIR})
37+
38+
install(FILES ../common/config.cmake
39+
DESTINATION ${INSTALL_PLATFORM_NS_DIR}/../common/)
40+
41+
install(DIRECTORY
42+
${Trusted\ Firmware\ M_SOURCE_DIR}/platform/ext/target/nordic_nrf/nrf54lm20dk_nrf54lm20a_cpuapp/tests
43+
DESTINATION ${INSTALL_PLATFORM_NS_DIR}
44+
)
Lines changed: 23 additions & 0 deletions
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: LicenseRef-Nordic-5-Clause
5+
#
6+
#-------------------------------------------------------------------------------
7+
8+
include(${CMAKE_CURRENT_LIST_DIR}/../common/config.cmake)
9+
10+
set(NRF_SOC_VARIANT nrf54lm20a CACHE STRING "nRF SoC Variant")
11+
12+
include(${PLATFORM_PATH}/common/${NRF_SOC_VARIANT}/config.cmake)
13+
14+
# Override PS_CRYPTO_KDF_ALG
15+
set(PS_CRYPTO_KDF_ALG PSA_ALG_SP800_108_COUNTER_CMAC CACHE STRING "KDF Algorithm to use")
16+
17+
# attest_hal.c includes bl_storage.h, which needs CONFIG_NRFX_RRAMC to be defined.
18+
# This is because bl_storage is a lib intended to be run from either the bootloader (Zephyr) or from TF-M.
19+
# This is independent from the NS image's CONFIG_NRFX_RRAMC, which must be disabled, so we can not inherit
20+
# this from app Kconfig.
21+
if(TFM_PARTITION_INITIAL_ATTESTATION)
22+
add_compile_definitions(CONFIG_NRFX_RRAMC)
23+
endif()
Lines changed: 10 additions & 0 deletions
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: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
set(PLATFORM_PATH platform/ext/target/nordic_nrf)
8+
9+
include(${PLATFORM_PATH}/common/nrf54lm20a/cpuarch.cmake)
10+
add_compile_definitions(__NRF_TFM__)
Lines changed: 10 additions & 0 deletions
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: LicenseRef-Nordic-5-Clause
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/nrf54lm20a/cpuarch.cmake)

0 commit comments

Comments
 (0)