Skip to content

Commit 362f653

Browse files
SebastianBoehenrikbrixandersen
authored andcommitted
soc: nordic: uicr: Change how secondary images are detected
Detect secondary images by checking a Kconfig value instead of a marker file. Signed-off-by: Sebastian Bøe <[email protected]>
1 parent 014caf7 commit 362f653

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

soc/nordic/common/uicr/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,10 @@ config NRF_PERIPHCONF_GENERATE_ENTRIES
1818
help
1919
Generate a C file containing PERIPHCONF entries based on the
2020
device configuration in the devicetree.
21+
22+
config IS_IRONSIDE_SE_SECONDARY_IMAGE
23+
bool "Ironside SE secondary image indicator (informative only, do not change)"
24+
help
25+
This Kconfig is set by sysbuild to indicate that this image is a
26+
secondary firmware for Ironside SE. This is used by the UICR generation
27+
system to determine which PERIPHCONF partition to use.

soc/nordic/common/uicr/gen_uicr/CMakeLists.txt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,19 @@ project(uicr)
2323
function(parse_kconfig_value config_file config_name output_var)
2424
file(STRINGS ${config_file} config_lines ENCODING "UTF-8")
2525
foreach(line ${config_lines})
26+
# Match quoted strings like CONFIG_FOO="value"
2627
if("${line}" MATCHES "^${config_name}=\"(.*)\"$")
2728
set(${output_var} "${CMAKE_MATCH_1}" PARENT_SCOPE)
2829
return()
2930
endif()
31+
# Match unquoted values like CONFIG_FOO=y or CONFIG_FOO=n
32+
if("${line}" MATCHES "^${config_name}=(.*)$")
33+
set(${output_var} "${CMAKE_MATCH_1}" PARENT_SCOPE)
34+
return()
35+
endif()
3036
endforeach()
37+
# If not found, return empty (including "# CONFIG_FOO is not set" case)
38+
set(${output_var} "" PARENT_SCOPE)
3139
endfunction()
3240

3341
# Function to compute partition absolute address and size from devicetree
@@ -131,8 +139,9 @@ if(CONFIG_GEN_UICR_GENERATE_PERIPHCONF)
131139
parse_kconfig_value(${_dir}/zephyr/.config CONFIG_KERNEL_BIN_NAME kernel_bin_name)
132140
set(kernel_elf_path ${_dir}/zephyr/${kernel_bin_name}.elf)
133141

134-
# Check if this is secondary firmware by looking for the marker file
135-
if(EXISTS ${_dir}/is_secondary_firmware.txt)
142+
# Check if this is secondary firmware by reading the Kconfig from .config
143+
parse_kconfig_value(${_dir}/zephyr/.config CONFIG_IS_IRONSIDE_SE_SECONDARY_IMAGE is_secondary)
144+
if(is_secondary STREQUAL "y")
136145
list(APPEND secondary_periphconf_elfs ${kernel_elf_path})
137146
else()
138147
list(APPEND periphconf_elfs ${kernel_elf_path})

0 commit comments

Comments
 (0)