diff --git a/esptool/bin_image.py b/esptool/bin_image.py index 98b8b365c..082f4fb01 100644 --- a/esptool/bin_image.py +++ b/esptool/bin_image.py @@ -760,8 +760,10 @@ def get_alignment_data_needed(segment): self.ROM_LOADER.BOOTLOADER_FLASH_OFFSET - self.SEG_HEADER_LEN ) if pad_len < align_min: - print("Unable to align the segment!") - break + # in case pad_len does not fit minimum alignment, + # pad it to next aligned boundary + pad_len += self.IROM_ALIGN + pad_len -= self.ROM_LOADER.BOOTLOADER_FLASH_OFFSET pad_segment = ImageSegment(0, b"\x00" * pad_len, f.tell()) self.save_segment(f, pad_segment)