Skip to content

Commit 1a9ec93

Browse files
tomchyrlubos
authored andcommitted
[nrf noup] boot: Configure ROM_END_OFFSET images
Add a possibility to specify, which images should have the ROM_END_OFFSET automatically adjusted. Use the UpdateableImages_Get(..) functionality to configure all updateable images (including radio images as well as variants) in the default configuration. Ref: NCSDK-35612 Signed-off-by: Tomasz Chyrowicz <[email protected]>
1 parent 9be087c commit 1a9ec93

File tree

1 file changed

+29
-13
lines changed

1 file changed

+29
-13
lines changed

boot/zephyr/sysbuild/CMakeLists.txt

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,35 @@ function(${SYSBUILD_CURRENT_MODULE_NAME}_post_image_cmake)
2525
return()
2626
endif()
2727

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()
28+
set(auto_images)
29+
if("${SB_CONFIG_MCUBOOT_IMAGES_ROM_END_OFFSET_AUTO}" STREQUAL "")
30+
UpdateableImage_Get(auto_images ALL)
31+
32+
# If the list of updateable images is empty, look for the "MAIN" image type.
33+
list(LENGTH auto_images num_auto_images)
34+
if(num_auto_images EQUAL 0)
35+
foreach(image ${IMAGES})
36+
set(app_type)
37+
get_property(app_type TARGET ${image} PROPERTY APP_TYPE)
38+
39+
if("${app_type}" STREQUAL "MAIN")
40+
list(APPEND auto_images ${image})
41+
endif()
42+
endforeach()
4143
endif()
44+
else()
45+
set(auto_images "${SB_CONFIG_MCUBOOT_IMAGES_ROM_END_OFFSET_AUTO}")
46+
endif()
47+
48+
foreach(image ${auto_images})
49+
set(mcuboot_image_footer_size)
50+
set(mcuboot_image_upgrade_footer_size)
51+
sysbuild_get(mcuboot_image_footer_size IMAGE mcuboot CACHE)
52+
sysbuild_get(mcuboot_image_upgrade_footer_size IMAGE mcuboot CACHE)
53+
math(EXPR mcuboot_image_footer_size "${mcuboot_image_footer_size}" OUTPUT_FORMAT HEXADECIMAL)
54+
math(EXPR mcuboot_image_upgrade_footer_size "${mcuboot_image_upgrade_footer_size}" OUTPUT_FORMAT HEXADECIMAL)
55+
56+
set_property(TARGET ${image} APPEND_STRING PROPERTY CONFIG "CONFIG_ROM_END_OFFSET=${mcuboot_image_footer_size}\n")
57+
set_property(TARGET ${image} APPEND_STRING PROPERTY CONFIG "CONFIG_MCUBOOT_UPDATE_FOOTER_SIZE=${mcuboot_image_upgrade_footer_size}\n")
4258
endforeach()
4359
endfunction(${SYSBUILD_CURRENT_MODULE_NAME}_post_image_cmake)

0 commit comments

Comments
 (0)