Skip to content

Commit f9e4e52

Browse files
taltenbachnordicjm
authored andcommitted
zephyr: Fix TLV area was included in trailer size when rounding up
In order to determine the maximum image size, the size of the trailer is computed. When using swap-move or swap-offset, this trailer size has to be rounded up to the next multiple of the sector size. However, the current logic was rouding up the sum of the trailer size and the TLV area size, instead of only the trailer size. This commit fixes the issue. Signed-off-by: Thomas Altenbach <thomas.altenbach@legrand.com>
1 parent 6cbea0a commit f9e4e52

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

boot/zephyr/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -677,8 +677,10 @@ if(SYSBUILD)
677677
set(boot_status_data_size 0)
678678
endif()
679679

680-
math(EXPR required_size "${key_size} + ${boot_magic_size} + ${boot_swap_data_size} + ${boot_status_data_size} + ${boot_tlv_estimate}")
681-
align_up(${required_size} ${erase_size} required_size)
680+
math(EXPR trailer_size "${key_size} + ${boot_magic_size} + ${boot_swap_data_size} + ${boot_status_data_size}")
681+
align_up(${trailer_size} ${erase_size} trailer_size)
682+
683+
math(EXPR required_size "${trailer_size} + ${boot_tlv_estimate}")
682684

683685
if(CONFIG_SINGLE_APPLICATION_SLOT OR CONFIG_BOOT_FIRMWARE_LOADER)
684686
set(required_upgrade_size "0")

0 commit comments

Comments
 (0)