Update `--included-header` parameter
The `--included-header` was "mandatory" when using imgtool with firmware
images generated by the Zephyr build system and it was a source of
issues when it was forgotten. This removes `--included-header` and adds
a new parameter `--pad-header` with inverted semantics, to be used only
when a zeroed header is required to be added to the firmware image.
Signed-off-by: Fabio Utzig <utzig@apache.org>
diff --git a/scripts/imgtool/image.py b/scripts/imgtool/image.py
index ea318f7..511c78c 100644
--- a/scripts/imgtool/image.py
+++ b/scripts/imgtool/image.py
@@ -66,7 +66,7 @@
class Image():
@classmethod
- def load(cls, path, included_header=False, **kwargs):
+ def load(cls, path, pad_header=False, **kwargs):
"""Load an image from a given file"""
ext = os.path.splitext(path)[1][1:].lower()
if ext == INTEL_HEX_EXT:
@@ -78,7 +78,7 @@
obj.payload, obj.base_addr = obj.load(path)
# Add the image header if needed.
- if not included_header and obj.header_size > 0:
+ if pad_header and obj.header_size > 0:
obj.payload = (b'\000' * obj.header_size) + obj.payload
obj.check()