From 534becb175c1b57f73dfd9b7f3686514d5271c92 Mon Sep 17 00:00:00 2001 From: Volodymyr Medvid Date: Wed, 20 Feb 2019 22:23:19 +0200 Subject: [PATCH] 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. --- tools/targets/PSOC6.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/targets/PSOC6.py b/tools/targets/PSOC6.py index 08dc7b80f3..64e0cf792a 100644 --- a/tools/targets/PSOC6.py +++ b/tools/targets/PSOC6.py @@ -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()