Skip to content

Commit ff9e886

Browse files
committed
sysbuild: Add Kconfig to load microcode once only on nRF54L devices
Prevents the microcode for CRACEN being loaded multiple times per image if the Kconfig is enabled by only loading it in the first image that uses it Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
1 parent dee077d commit ff9e886

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

sysbuild/CMakeLists.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,23 @@ function(${SYSBUILD_CURRENT_MODULE_NAME}_pre_cmake)
618618
set(network_images)
619619
endif()
620620

621+
if(SB_CONFIG_CRACEN_MICROCODE_LOAD_ONCE)
622+
if(SB_CONFIG_CRACEN_MICROCODE_LOAD_B0)
623+
set_config_bool(b0 CONFIG_CRACEN_LOAD_MICROCODE y)
624+
625+
if(SB_CONFIG_BOOTLOADER_MCUBOOT)
626+
set_config_bool(mcuboot CONFIG_CRACEN_LOAD_MICROCODE n)
627+
endif()
628+
elseif(SB_CONFIG_CRACEN_MICROCODE_LOAD_MCUBOOT)
629+
if(SB_CONFIG_SECURE_BOOT_APPCORE)
630+
set_config_bool(b0 CONFIG_CRACEN_LOAD_MICROCODE n)
631+
endif()
632+
633+
set_config_bool(mcuboot CONFIG_CRACEN_LOAD_MICROCODE y)
634+
endif()
635+
636+
set_config_bool(${DEFAULT_IMAGE} CONFIG_CRACEN_LOAD_MICROCODE n)
637+
endif()
621638
endfunction(${SYSBUILD_CURRENT_MODULE_NAME}_pre_cmake)
622639

623640
function(${SYSBUILD_CURRENT_MODULE_NAME}_pre_image_cmake)

sysbuild/Kconfig.cracen

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Copyright (c) 2024 Nordic Semiconductor
2+
#
3+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
4+
5+
config SUPPORT_CRACEN
6+
bool
7+
default y if SOC_SERIES_NRF54LX
8+
help
9+
Hidden symbol indicating if CRACEN is supported on the device.
10+
11+
if SUPPORT_CRACEN
12+
13+
menu "CRACEN"
14+
15+
config CRACEN_MICROCODE_LOAD_B0
16+
bool
17+
depends on SECURE_BOOT_APPCORE && SECURE_BOOT_SIGNATURE_TYPE_ED25519
18+
default y
19+
help
20+
Hidden symbol indicating if b0 is using CRACEN.
21+
22+
config CRACEN_MICROCODE_LOAD_MCUBOOT
23+
bool
24+
depends on BOOTLOADER_MCUBOOT && BOOT_SIGNATURE_TYPE_ED25519
25+
default y
26+
help
27+
Hidden symbol indicating if MCUboot is using CRACEN.
28+
29+
config CRACEN_MICROCODE_LOAD_ONCE
30+
bool "Load CRACEN microcode once only"
31+
depends on CRACEN_MICROCODE_LOAD_B0 || CRACEN_MICROCODE_LOAD_MCUBOOT
32+
default y
33+
help
34+
If enabled, will only load microcode for CRACEN in the first system bootable image,
35+
which will be either b0 or MCUboot, depending on project configuration.
36+
37+
endmenu
38+
39+
endif # SUPPORT_CRACEN

sysbuild/Kconfig.sysbuild

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,4 @@ rsource "Kconfig.suit_provisioning"
8383
rsource "Kconfig.sdp"
8484
rsource "Kconfig.approtect"
8585
rsource "Kconfig.lwm2m_carrier"
86+
rsource "Kconfig.cracen"

0 commit comments

Comments
 (0)