-
Notifications
You must be signed in to change notification settings - Fork 1.4k
boards: nordic: add support for TF-m to nrf7120 #24475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# | ||
# Copyright (c) 2025, Nordic Semiconductor ASA. | ||
# | ||
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
# | ||
|
||
set(NRF_BOARD_SELECTED True) | ||
|
||
add_subdirectory(${Trusted\ Firmware\ M_SOURCE_DIR}/platform/ext/target/nordic_nrf/common/nrf7120 nrf7120) | ||
|
||
add_subdirectory(.. tfm_board) | ||
|
||
target_include_directories(platform_s | ||
PUBLIC | ||
${ZEPHYR_NRF_MODULE_DIR}/subsys/nrf_security/src/drivers/cracen/cracenpsa/include | ||
) | ||
|
||
target_sources(platform_s | ||
PRIVATE | ||
${ZEPHYR_NRF_MODULE_DIR}/nrf/soc/nordic/nrf71/soc.c | ||
) | ||
|
||
target_include_directories(platform_s | ||
PRIVATE | ||
${ZEPHYR_BASE}/modules/cmsis/ | ||
${ZEPHYR_NRF_MODULE_DIR}/soc/nordic/nrf71 | ||
${ZEPHYR_BASE}/soc/nordic/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(FILES ../common/config.cmake | ||
DESTINATION ${INSTALL_PLATFORM_NS_DIR}/../common/) | ||
|
||
install(DIRECTORY ${Trusted\ Firmware\ M_SOURCE_DIR}/platform/ext/target/nordic_nrf/nrf7120pdk_nrf7120_cpuapp/tests | ||
DESTINATION ${INSTALL_PLATFORM_NS_DIR} | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#------------------------------------------------------------------------------- | ||
# Copyright (c) 2025, Nordic Semiconductor ASA. | ||
# | ||
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
# | ||
#------------------------------------------------------------------------------- | ||
|
||
include(${CMAKE_CURRENT_LIST_DIR}/../common/config.cmake) | ||
|
||
set(NRF_SOC_VARIANT nrf7120 CACHE STRING "nRF SoC Variant") | ||
|
||
include(${PLATFORM_PATH}/common/${NRF_SOC_VARIANT}/config.cmake) | ||
|
||
# Override PS_CRYPTO_KDF_ALG | ||
set(PS_CRYPTO_KDF_ALG PSA_ALG_SP800_108_COUNTER_CMAC CACHE STRING "KDF Algorithm to use") | ||
|
||
# attest_hal.c includes bl_storage.h, which needs CONFIG_NRFX_MRAMC to be defined. | ||
# This is because bl_storage is a lib intended to be run from either the bootloader (Zephyr) or from TF-M. | ||
# This is independent from the NS image's CONFIG_NRFX_MRAMC, which must be disabled, so we can not inherit | ||
# this from app Kconfig. | ||
if(TFM_PARTITION_INITIAL_ATTESTATION) | ||
add_compile_definitions(CONFIG_NRFX_MRAMC) | ||
endif() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# | ||
# Copyright (c) 2025, Nordic Semiconductor ASA. | ||
# | ||
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
# | ||
|
||
set(PLATFORM_PATH platform/ext/target/nordic_nrf) | ||
|
||
include(${PLATFORM_PATH}/common/nrf7120/cpuarch.cmake) | ||
add_compile_definitions(__NRF_TFM__) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# | ||
# Copyright (c) 2025, Nordic Semiconductor ASA. | ||
# | ||
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
# | ||
|
||
set(PLATFORM_DIR ${CMAKE_CURRENT_LIST_DIR}) | ||
set(PLATFORM_PATH ${CMAKE_CURRENT_LIST_DIR}) | ||
|
||
include(${CMAKE_CURRENT_LIST_DIR}/common/nrf7120/cpuarch.cmake) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,4 +48,18 @@ config NRF_TRUSTZONE_RAM_REGION_SIZE | |
This abstraction allows us to configure TRUSTZONE without depending | ||
on peripheral specific symbols. | ||
|
||
config SOC_NRF7120_SKIP_CLOCK_CONFIG | ||
bool | ||
prompt "Skip clock frequency configuration in system initialization" if TRUSTED_EXECUTION_SECURE | ||
tomi-font marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
default y if TRUSTED_EXECUTION_NONSECURE | ||
help | ||
With this option, the CPU clock frequency is not set during this | ||
Zephyr image's system initialization. The CPU runs with either | ||
the HW reset values, or with the configuration set by an image | ||
earlier in the boot chain. | ||
|
||
Note that for security reasons it is not supported to configure | ||
the clock peripheral (NRF_OSCILLATORS) from the non-secure | ||
domain. | ||
|
||
|
||
endif # SOC_SERIES_NRF71X |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should not pollute compiler invocation line for all Zephyr sources with such configs.
Those should be provided to MDK either for only the sources which needs it or through a form of a single config header, like this: https://github.com/zephyrproject-rtos/zephyr/blob/main/modules/hal_nordic/nrfx/nrfx_kconfig.h
Also providing a Kconfig -> MDK defines this way is not scalable.
The Kconfig already have dependencies, but adding the translation in CMake adds extra level of dependencies (namely the inclusion tree of the CMake file itself), which thus results in constructs like this having to be duplicated.
A single config header, as linked, allows to:
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what I see nrf54lx is doing it the same: https://github.com/nrfconnect/sdk-zephyr/blob/main/modules/hal_nordic/nrfx/CMakeLists.txt#L193 , and I think it is better to align for same workflow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tejlmand What should I do with this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's better to clean up the mess instead of building on top of it.
As your example show, then we now have 2 specific Kconfigs mapping to same MDK symbol, and two CMake codelines doing the same thing but in different places.
Not to mention that the trees including
nrf71/CMakeLists.txt
andnrfx/CMakeLists.txt
may be included based on additional different (Kconfig) conditions.The most correct thing is having a single Kconfig, which then has proper dependencies like this:
and then in a Kconfig to MDK mapping header have (such as this https://github.com/zephyrproject-rtos/zephyr/blob/main/modules/hal_nordic/nrfx/nrfx_kconfig.h):
That will give you:
When looking at compile invocation and see
gcc ..... -DNRF_SKIP_CLOCK_CONFIGURATION ...
then it's hard to know where this flag originates from and why, because this flag might be present multiple places in the CMake code, and which one was the line causing it to be set ?But if the flag exist in a Kconfig to MDK mapping header as presented above, then it's much easier to see it's directly related to a Kconfig symbol, and I can check that Kconfig symbol for dependencies / selects.
No extra dependencies are added directly or indirectly, whereas the symbol mapping in CMake automatically adds indirect dependencies
see also: zephyrproject-rtos/zephyr#95874 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have a look with this PR: https://github.com/zephyrproject-rtos/zephyr/pull/97474/files