imgtool: Add possibility to set confirm flag for hex files as well
Fix imgtool does not take into account value of confirm flag, when signing .hex images
Signed-off-by: Roman Okhrimenko <roman.okhrimenko@cypress.com>
diff --git a/scripts/imgtool/image.py b/scripts/imgtool/image.py
index 5cbefd5..20c2e32 100644
--- a/scripts/imgtool/image.py
+++ b/scripts/imgtool/image.py
@@ -219,9 +219,12 @@
self.save_enctlv,
self.enctlv_len)
trailer_addr = (self.base_addr + self.slot_size) - trailer_size
- padding = bytes([self.erased_val] *
- (trailer_size - len(boot_magic))) + boot_magic
- h.puts(trailer_addr, padding)
+ padding = bytearray([self.erased_val] *
+ (trailer_size - len(boot_magic)))
+ if self.confirm and not self.overwrite_only:
+ padding[-MAX_ALIGN] = 0x01 # image_ok = 0x01
+ padding += boot_magic
+ h.puts(trailer_addr, bytes(padding))
h.tofile(path, 'hex')
else:
if self.pad: