Skip to content
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

nrf_security: cracen: kmu: Support KMU reserved area through DTS #20417

Merged
merged 2 commits into from
Feb 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion subsys/nrf_security/src/drivers/cracen/cracenpsa/src/kmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,34 @@

extern nrf_security_mutex_t cracen_mutex_symmetric;

#define KMU_PUSH_AREA_SIZE 64

/* When execution in place (CONFIG_XIP) is not enabled, which in practice means that when Zephyr is
* built for a RAM loaded image, the Zephyr linker script always places the RAM loaded image in the
* top address of the RAM and then loads the linker scripts defined with the Zephyr SECTION_PROLOGUE
* macros. Using SECTION_PROLOGUE macros to set the address of the kmu_push_area is
* incompatible with RAM loaded images. The Zephyr reserved-memory devicetree methodology works for
* both use cases but it requires heavy updates of multiple devicetree files and overlays. In order
* to support the RAM loaded images use cases faster initial support for reserving the memory of
* nrf_kmu_reserved_push_area though devicetree is limited to RAM loaded images.
*/
#if DT_NODE_EXISTS(DT_NODELABEL(nrf_kmu_reserved_push_area)) && !CONFIG_XIP

#include <zephyr/dt-bindings/memory-attr/memory-attr.h>
#include <zephyr/linker/devicetree_regions.h>
#define KMU_PUSH_AREA_NODE DT_NODELABEL(nrf_kmu_reserved_push_area)
uint8_t kmu_push_area[KMU_PUSH_AREA_SIZE] Z_GENERIC_SECTION(
LINKER_DT_NODE_REGION_NAME(KMU_PUSH_AREA_NODE));

#else

/* The section .nrf_kmu_reserved_push_area is placed at the top RAM address
* by the linker scripts. We do that for both the secure and non-secure builds.
* Since this buffer is placed on the top of RAM we don't need to have the alignment
* attribute anymore.
*/
uint8_t kmu_push_area[64] __attribute__((section(".nrf_kmu_reserved_push_area")));
uint8_t kmu_push_area[KMU_PUSH_AREA_SIZE] __attribute__((section(".nrf_kmu_reserved_push_area")));
#endif

typedef struct kmu_metadata {
uint32_t metadata_version: 4;
Expand Down
2 changes: 1 addition & 1 deletion west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ manifest:
# https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/guides/modules.html
- name: zephyr
repo-path: sdk-zephyr
revision: 16dc0c6c01401abcb069ec35139f490c2b13d907
revision: b91aa4fec5484f6cd076c9333bb474a7f5c002c1
import:
# In addition to the zephyr repository itself, NCS also
# imports the contents of zephyr/west.yml at the above
Expand Down
Loading