Skip to content

Commit e9da911

Browse files
Vge0rgerlubos
authored andcommitted
[nrf noup] soc: nrf54l: Add custom section for KMU
Add a custom section in the linker which should always be placed in the top of RAM. This will be used by the KMU to push keys into it. Since when you provision a key into the KMU you need to set specific a memory location for the PUSH operation we need to keep this memory location static across images/dfus. The linker script inclusion which places the KMU reserved buffer on the top of RAM doesn't work for non-XIP builds. The Zephyr linker script will firstly load the code for an non-XIP build in RAM and then include this KMU related linker script which results in an unpredictable placement of the KMU reserved area and a failed build. In order to support non-XIP builds the linker file is not included and the a DTS reserved-memory entry should be used. To limit the scope, the DTS reserved memory region is currently only supported for non-XIP builds. This is a noup since the KMU is not supported upstream. Ref: NCSDK-25121 Signed-off-by: Georgios Vasilakis <[email protected]> (cherry picked from commit d1c0da1)
1 parent 6d216e1 commit e9da911

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

soc/nordic/nrf54l/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,12 @@ zephyr_library_sources(
66
../validate_rram_partitions.c
77
)
88
zephyr_include_directories(.)
9+
10+
# We need a buffer in memory in a static location which can be used by
11+
# the KMU peripheral. The KMU has a static destination address, we chose
12+
# this address to be 0x20000000, which is the first address in the SRAM.
13+
if(NOT CONFIG_BUILD_WITH_TFM AND CONFIG_PSA_NEED_CRACEN_KMU_DRIVER AND CONFIG_XIP)
14+
# Exclamation mark is printable character with the lowest number in ASCII table.
15+
# We are sure that this file will be included first.
16+
zephyr_linker_sources(RAM_SECTIONS SORT_KEY ! kmu_push_area_section.ld)
17+
endif()
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# This section must be loaded first of all the
2+
# custom sections because we want it to be placed
3+
# at the top address of RAM.
4+
SECTION_PROLOGUE(NRF_KMU_RESERVED_PUSH_SECTION,(NOLOAD) ,)
5+
{
6+
__nrf_kmu_reserved_push_area = .;
7+
*(.nrf_kmu_reserved_push_area)
8+
__nrf_kmu_reserved_push_area_end = .;
9+
} GROUP_NOLOAD_LINK_IN(RAMABLE_REGION, RAMABLE_REGION)
10+
11+
# It doesn't seem to be possible to enforce placing a section
12+
# at a specific address in memory using the Zephyr SECTION macros.
13+
# So this assert is necessary to avoid accidentatly moving this
14+
# section to a different address.
15+
ASSERT(__nrf_kmu_reserved_push_area == RAM_ADDR, "Error: \
16+
The section NRF_KMU_RESERVED_PUSH_SECTION needs to be \
17+
placed on the top RAM address but it is not, please edit \
18+
your linker scripts to make sure that it is placed on \
19+
the to RAM address.")

0 commit comments

Comments
 (0)