1function(mathup num align result) 2 math(EXPR out "(((${num}) + ((${align}) - 1)) & ~((${align}) - 1))") 3 set(${result} "${out}" PARENT_SCOPE) 4endfunction() 5 6function(${SYSBUILD_CURRENT_MODULE_NAME}_pre_image_cmake) 7 cmake_parse_arguments(POST_IMAGE_CMAKE "" "IMAGE" "IMAGES" ${ARGN}) 8 9 if(NOT "${POST_IMAGE_CMAKE_IMAGE}" STREQUAL "mcuboot") 10 return() 11 endif() 12 13 set_property( 14 DIRECTORY APPEND PROPERTY 15 CMAKE_CONFIGURE_DEPENDS 16 ${CMAKE_BINARY_DIR}/mcuboot/CMakeCache.txt 17 ${CMAKE_BINARY_DIR}/mcuboot/zephyr/.config 18 ) 19endfunction(${SYSBUILD_CURRENT_MODULE_NAME}_pre_image_cmake) 20 21function(${SYSBUILD_CURRENT_MODULE_NAME}_post_image_cmake) 22 cmake_parse_arguments(POST_IMAGE_CMAKE "" "IMAGE" "IMAGES" ${ARGN}) 23 24 if(NOT "${POST_IMAGE_CMAKE_IMAGE}" STREQUAL "mcuboot") 25 return() 26 endif() 27 28 foreach(image ${IMAGES}) 29 set(app_type) 30 get_property(app_type TARGET ${image} PROPERTY APP_TYPE) 31 32 if("${app_type}" STREQUAL "MAIN") 33 sysbuild_get(mcuboot_image_footer_size IMAGE mcuboot CACHE) 34 sysbuild_get(mcuboot_image_upgrade_footer_size IMAGE mcuboot CACHE) 35 math(EXPR mcuboot_image_footer_size "${mcuboot_image_footer_size}" OUTPUT_FORMAT HEXADECIMAL) 36 math(EXPR mcuboot_image_upgrade_footer_size "${mcuboot_image_upgrade_footer_size}" OUTPUT_FORMAT HEXADECIMAL) 37 38 set_property(TARGET ${image} APPEND_STRING PROPERTY CONFIG "CONFIG_ROM_END_OFFSET=${mcuboot_image_footer_size}\n") 39 set_property(TARGET ${image} APPEND_STRING PROPERTY CONFIG "CONFIG_MCUBOOT_UPDATE_FOOTER_SIZE=${mcuboot_image_upgrade_footer_size}\n") 40 return() 41 endif() 42 endforeach() 43endfunction(${SYSBUILD_CURRENT_MODULE_NAME}_post_image_cmake) 44