Skip to content

Commit c1cdcd7

Browse files
ahasztagrlubos
authored andcommitted
suit: Added DFU cache files to dfu zip
This commit enables automatic adding of the DFU cache partition files to the generated SUIT DFU zip file. Signed-off-by: Artur Hadasz <[email protected]>
1 parent ff70799 commit c1cdcd7

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

cmake/sysbuild/suit.cmake

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,14 @@ function(suit_generate_dfu_zip)
8383
GLOBAL PROPERTY
8484
SUIT_DFU_ARTIFACTS
8585
)
86+
get_property(
87+
additional_script_params
88+
GLOBAL PROPERTY
89+
SUIT_DFU_ZIP_ADDITIONAL_SCRIPT_PARAMS
90+
)
8691

8792
set(root_name "${SB_CONFIG_SUIT_ENVELOPE_ROOT_ARTIFACT_NAME}.suit")
88-
set(script_params "${root_name}type=suit-envelope")
93+
set(script_params "${root_name}type=suit-envelope;${additional_script_params}")
8994

9095
include(${ZEPHYR_NRF_MODULE_DIR}/cmake/fw_zip.cmake)
9196

@@ -339,13 +344,16 @@ function(suit_create_package)
339344
"--input" "\"${IMAGE_CACHE_URI},${BINARY_DIR}/zephyr/${BINARY_FILE}.bin\""
340345
)
341346
endforeach()
342-
list(APPEND CACHE_CREATE_ARGS "--output-file" "${SUIT_ROOT_DIRECTORY}dfu_cache_partition_${CACHE_PARTITION_NUM}.bin")
343347

344348
if(SUIT_DFU_CACHE_PARTITION_${CACHE_PARTITION_NUM}_EB_SIZE)
345349
list(APPEND CACHE_CREATE_ARGS "--eb-size" "${SUIT_DFU_CACHE_PARTITION_${CACHE_PARTITION_NUM}_EB_SIZE}")
346350
endif()
347351

348-
suit_create_cache_partition("${CACHE_CREATE_ARGS}")
352+
suit_create_cache_partition(
353+
"${CACHE_CREATE_ARGS}"
354+
"${SUIT_ROOT_DIRECTORY}dfu_cache_partition_${CACHE_PARTITION_NUM}.bin"
355+
${CACHE_PARTITION_NUM}
356+
)
349357
endforeach()
350358

351359
if(SB_CONFIG_SUIT_BUILD_RECOVERY)

cmake/sysbuild/suit_utilities.cmake

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,20 @@ function(suit_create_envelope input_file output_file create_signature)
8484
endif()
8585
endfunction()
8686

87-
function(suit_create_cache_partition args)
87+
function(suit_create_cache_partition args output_file partition_num)
88+
89+
list(APPEND args "--output-file" "${output_file}")
90+
8891
set_property(
8992
GLOBAL APPEND PROPERTY SUIT_POST_BUILD_COMMANDS
9093
COMMAND ${PYTHON_EXECUTABLE} ${SUIT_GENERATOR_CLI_SCRIPT}
9194
cache_create
9295
${args}
9396
BYPRODUCTS ${output_file}
9497
)
98+
99+
get_filename_component(output_file_name ${output_file} NAME)
100+
101+
set_property(GLOBAL APPEND PROPERTY SUIT_DFU_ARTIFACTS ${output_file})
102+
set_property(GLOBAL APPEND PROPERTY SUIT_DFU_ZIP_ADDITIONAL_SCRIPT_PARAMS "${output_file_name}type=cache;${output_file_name}partition=${partition_num};")
95103
endfunction()

0 commit comments

Comments
 (0)