Commit 9fb7ce5d authored by Jamie McCrae's avatar Jamie McCrae Committed by Jamie
Browse files

boot: zephyr: Fix estimated size calculation

Fixes an issue with the estimated size calculation which wrongly
used the maximum align size for some multiplications, this would
mean that in some instances the estimated maximum image size was
smaller than the actual allowed size

Signed-off-by: default avatarJamie McCrae <jamie.mccrae@nordicsemi.no>
parent 7ace8bd4
Loading
Loading
Loading
Loading
+8 −4
Changes for boot/zephyr/CMakeLists.txt: 8 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -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)