diff --git a/boot/zephyr/CMakeLists.txt b/boot/zephyr/CMakeLists.txt index 9156ad23d..f6c4b7eea 100644 --- a/boot/zephyr/CMakeLists.txt +++ b/boot/zephyr/CMakeLists.txt @@ -433,8 +433,12 @@ if(SYSBUILD) if(NOT DEFINED write_size) message(WARNING "Unable to determine write size of slot0 or slot1 partition, setting to 8 (this is probably wrong)") set(write_size 8) - elseif(write_size LESS 8) - set(write_size 8) + endif() + + if(${write_size} LESS 8) + set(max_align_size 8) + else() + set(max_align_size ${write_size}) endif() set(key_size 0) @@ -473,7 +477,7 @@ if(SYSBUILD) set(key_size "${boot_enc_key_size}") endif() - align_up(${key_size} ${write_size} key_size) + align_up(${key_size} ${max_align_size} key_size) math(EXPR key_size "${key_size} * 2") endif() @@ -482,7 +486,7 @@ if(SYSBUILD) if(CONFIG_SINGLE_APPLICATION_SLOT OR CONFIG_BOOT_FIRMWARE_LOADER) set(boot_swap_data_size 0) else() - math(EXPR boot_swap_data_size "${write_size} * 4") + math(EXPR boot_swap_data_size "${max_align_size} * 4") endif() if(CONFIG_BOOT_SWAP_USING_SCRATCH OR CONFIG_BOOT_SWAP_USING_MOVE)