west_commands: sign: imgtool: fix slot size readout

This fixes wrong slot selection when reading partition size. According
to the comment in code, 'slot1_partition' size should be preferred:

  [...] slot1_partition size is used, when available, because in
  swap-move mode it can be one sector smaller. When not available,
  fallback to slot0_partition (single slot dfu). [...]

This fixes a typo in the if statement which currently always results in
use of 'slot0_partition' size.

Fixes: 86c4b4caa9 ("west/sign: Move from using partition label property")
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
This commit is contained in:
Piotr Dymacz 2024-03-28 22:34:03 +01:00 committed by Anas Nashif
commit fc72f696fe

View file

@ -406,7 +406,7 @@ class ImgtoolSigner(Signer):
# The partitions node, and its subnode, must provide # The partitions node, and its subnode, must provide
# the size of slot1_partition or slot0_partition partition via the regs property. # the size of slot1_partition or slot0_partition partition via the regs property.
slot_key = 'slot0_partition' if 'slot1_partition' in slots else 'slot0_partition' slot_key = 'slot1_partition' if 'slot1_partition' in slots else 'slot0_partition'
if not slots[slot_key].regs: if not slots[slot_key].regs:
log.die(f'{slot_key} flash partition has no regs property;', log.die(f'{slot_key} flash partition has no regs property;',
"can't determine size of slot") "can't determine size of slot")