Skip to content

Commit ec6c446

Browse files
committed
cmake: sysbuild: suit: Add support for merging other files
Adds support for merging other files onto the uicr_merged.hex file of the application core Signed-off-by: Jamie McCrae <[email protected]>
1 parent 25e4377 commit ec6c446

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

cmake/sysbuild/suit.cmake

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,12 +534,24 @@ function(suit_setup_merge)
534534
list(APPEND ARTIFACTS_TO_MERGE ${BINARY_DIR}/zephyr/suit_mpi_${IMAGE_TARGET_NAME}_merged.hex)
535535
endif()
536536

537+
if(${IMAGE_TARGET_NAME} STREQUAL "application")
538+
# Get a list of files (and their dependencies) which need merging into the uicr merged file
539+
# and add them at the end of the list, allowing for overwriting, this only applies to the
540+
# application core image
541+
get_property(merge_files GLOBAL PROPERTY SUIT_MERGE_FILE)
542+
get_property(merge_dependencies GLOBAL PROPERTY SUIT_MERGE_DEPENDENCIES)
543+
else()
544+
set(merge_files)
545+
set(merge_dependencies)
546+
endif()
547+
537548
set_property(
538549
GLOBAL APPEND PROPERTY SUIT_POST_BUILD_COMMANDS
539550
COMMAND ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/scripts/build/mergehex.py
540551
--overlap replace
541552
-o ${OUTPUT_HEX_FILE}
542-
${ARTIFACTS_TO_MERGE}
553+
${ARTIFACTS_TO_MERGE} ${merge_files}
554+
DEPENDS ${merge_dependencies}
543555
# fixme: uicr_merged is overwritten by new content, runners_yaml_props_target could be used to define
544556
# what shall be flashed, but not sure where to set this! Remove --overlap if ready!
545557
# example usage: set_property(TARGET runners_yaml_props_target PROPERTY hex_file ${merged_hex_file})

cmake/sysbuild/suit_utilities.cmake

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,17 @@ function(suit_create_cache_partition args output_file partition_num recovery)
108108
"${output_file_name}type=cache;${output_file_name}partition=${partition_num};")
109109
endif()
110110
endfunction()
111+
112+
# Usage:
113+
# suit_add_merge_hex_file(FILES <files> [DEPENDENCIES <dependencies>]
114+
#
115+
# Add files which should be merged into the uicr_merged.hex output file, respecting any
116+
# dependencies that need to be generated before hand. This will overwrite existing data if it is
117+
# present in other files
118+
function(suit_add_merge_hex_file)
119+
cmake_parse_arguments(arg "" "" "FILES;DEPENDENCIES" ${ARGN})
120+
zephyr_check_arguments_required(${CMAKE_CURRENT_FUNCTION} arg FILES)
121+
122+
set_property(GLOBAL APPEND PROPERTY SUIT_MERGE_FILE ${arg_FILES})
123+
set_property(GLOBAL APPEND PROPERTY SUIT_MERGE_DEPENDENCIES ${arg_DEPENDENCIES})
124+
endfunction()

0 commit comments

Comments
 (0)