Skip to content

Commit 099f428

Browse files
committed
boot: zephyr: Add fallback for overhead calculation when auto fails
Adds a fallback of 128 sectors for calculating the image overhead size if auto sectors is enabled but cannot calculate the value Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
1 parent 4ca606d commit 099f428

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

boot/zephyr/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,12 @@ if(SYSBUILD)
600600
if(CONFIG_BOOT_MAX_IMG_SECTORS_AUTO AND DEFINED slot_min_sectors AND "${slot_min_sectors}" GREATER "0")
601601
math(EXPR boot_status_data_size "${slot_min_sectors} * (3 * ${write_size})")
602602
else()
603-
math(EXPR boot_status_data_size "${CONFIG_BOOT_MAX_IMG_SECTORS} * (3 * ${write_size})")
603+
if(CONFIG_BOOT_MAX_IMG_SECTORS)
604+
math(EXPR boot_status_data_size "${CONFIG_BOOT_MAX_IMG_SECTORS} * (3 * ${write_size})")
605+
else()
606+
message(WARNING "CONFIG_BOOT_MAX_IMG_SECTORS is not defined, falling back to 128 sector default. Please set CONFIG_BOOT_MAX_IMG_SECTORS to the required value")
607+
math(EXPR boot_status_data_size "128 * (3 * ${write_size})")
608+
endif()
604609
endif()
605610
else()
606611
set(boot_status_data_size 0)

0 commit comments

Comments
 (0)