Commit f9e4e529 authored by Thomas Altenbach's avatar Thomas Altenbach Committed by Jamie
Browse files

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: default avatarThomas Altenbach <thomas.altenbach@legrand.com>
parent 6cbea0a2
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -677,8 +677,10 @@ if(SYSBUILD)
      set(boot_status_data_size 0)
    endif()

    math(EXPR required_size "${key_size} + ${boot_magic_size} + ${boot_swap_data_size} + ${boot_status_data_size} + ${boot_tlv_estimate}")
    align_up(${required_size} ${erase_size} required_size)
    math(EXPR trailer_size "${key_size} + ${boot_magic_size} + ${boot_swap_data_size} + ${boot_status_data_size}")
    align_up(${trailer_size} ${erase_size} trailer_size)

    math(EXPR required_size "${trailer_size} + ${boot_tlv_estimate}")

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