PSOC6: correctly align hex files with split text sections

When the original PSOC6 CM4 hex file contains unalinged text sections
that span through multiple intelhex segments, aligned segments (filled
with zeroes) overlap with the original data segments, resulting in
error thrown by ihex.merge(alignments, overlap='error').
Such hex file can be produced when the ELF is built with ARM MDK Compiler
with --split_sections option:
http://www.keil.com/support/man/docs/armcc/armcc_chr1359124944914.htm

Change the merge strategy to overlap='ignore', so that the overlapping
zero-filled segments are skipped.
pull/9781/head
Volodymyr Medvid 2019-02-20 22:23:19 +02:00
parent f61dee1626
commit 534becb175
1 changed files with 1 additions and 1 deletions

View File

@ -96,7 +96,7 @@ def patch(message_func, ihex, hexf, align=256):
aligned_end += align
message_func("Aligning end from 0x%x to 0x%x" % (end, aligned_end))
alignments.frombytes(ihex.tobinarray(end, aligned_end - 1), end)
ihex.merge(alignments)
ihex.merge(alignments, 'ignore')
def merge_images(hexf0, hexf1=None):
ihex = IntelHex()