Skip to content

Commit cf6db82

Browse files
tejlmandnordicjm
authored andcommitted
sysbuild: partition manager provide image file information
Partition manager CMake code defines runner image file as sysbuild cache variable. This ensures the image file is propagated to the Zephyr image build system where the nRF Connect SDK CMake code will specify the image file on the runner's yaml properties. Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
1 parent dc5ca47 commit cf6db82

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

CMakeLists.txt

+10
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ set(CONF_FILE_BUILD_TYPE ${CONF_FILE_BUILD_TYPE} CACHE INTERNAL "The build type"
1414
# Customize the Zephyr kernel version.h using nRF Connect SDK ncs_version.h.
1515
set(KERNEL_VERSION_CUSTOMIZATION \#include;<ncs_version.h> PARENT_SCOPE)
1616

17+
foreach(runner_ext BIN HEX ELF)
18+
zephyr_get(NCS_RUNNER_${runner_ext} SYSBUILD)
19+
if(DEFINED NCS_RUNNER_${runner_ext})
20+
string(TOLOWER "${runner_ext}" type)
21+
set_target_properties(runners_yaml_props_target PROPERTIES
22+
"${type}_file" "${NCS_RUNNER_${runner_ext}}"
23+
)
24+
endif()
25+
endforeach()
26+
1727
include(cmake/extensions.cmake)
1828
include(cmake/version.cmake)
1929
include(cmake/multi_image.cmake)

cmake/sysbuild/partition_manager.cmake

+17-4
Original file line numberDiff line numberDiff line change
@@ -299,21 +299,34 @@ function(update_runner)
299299

300300
set(runners_content_update)
301301
file(STRINGS ${runners_file} runners_content)
302-
foreach(line ${runners_content})
303-
if(DEFINED RUNNER_ELF AND ${line} MATCHES "^.*elf_file: .*$")
302+
foreach(line IN LISTS runners_content)
303+
if(DEFINED RUNNER_ELF AND "${line}" MATCHES "^.*elf_file: .*$")
304304
string(REGEX REPLACE "(.*elf_file:) .*" "\\1 ${RUNNER_ELF}" line ${line})
305+
set(${RUNNER_IMAGE}_NCS_RUNNER_ELF "${RUNNER_ELF}" CACHE INTERNAL
306+
"nRF Connect SDK partition managere controlled elf file"
307+
)
305308
endif()
306309

307-
if(DEFINED RUNNER_HEX AND ${line} MATCHES "^.*hex_file: .*$")
310+
if(DEFINED RUNNER_HEX AND "${line}" MATCHES "^.*hex_file: .*$")
308311
string(REGEX REPLACE "(.*hex_file:) .*" "\\1 ${RUNNER_HEX}" line ${line})
312+
set(${RUNNER_IMAGE}_NCS_RUNNER_HEX "${RUNNER_HEX}" CACHE INTERNAL
313+
"nRF Connect SDK partition managere controlled hex file"
314+
)
309315
endif()
310316

311-
if(DEFINED RUNNER_BIN AND ${line} MATCHES "^.*bin_file: .*$")
317+
if(DEFINED RUNNER_BIN AND "${line}" MATCHES "^.*bin_file: .*$")
312318
string(REGEX REPLACE "(.*bin_file:) .*" "\\1 ${RUNNER_BIN}" line ${line})
319+
set(${RUNNER_IMAGE}_NCS_RUNNER_BIN "${RUNNER_BIN}" CACHE INTERNAL
320+
"nRF Connect SDK partition managere controlled bin file"
321+
)
313322
endif()
314323
list(APPEND runners_content_update "${line}\n")
315324
endforeach()
316325
file(WRITE ${runners_file} ${runners_content_update})
326+
327+
# NCS has updated the cache with an NCS_RUNNER file, thus re-create the sysbuild cache.
328+
# No need for CMAKE_RERUN in this case, as runners.yaml has been updated above.
329+
sysbuild_cache(CREATE APPLICATION ${RUNNER_IMAGE})
317330
endfunction()
318331

319332

0 commit comments

Comments
 (0)