@@ -346,6 +346,7 @@ def merge_region_list(region_list, destination, padding=b'\xFF'):
346
346
padding - bytes to fill gapps with
347
347
"""
348
348
merged = IntelHex ()
349
+ _ , format = splitext (destination )
349
350
350
351
print ("Merging Regions:" )
351
352
@@ -363,14 +364,17 @@ def merge_region_list(region_list, destination, padding=b'\xFF'):
363
364
pad_size = region .size - part_size
364
365
if pad_size > 0 and region != region_list [- 1 ]:
365
366
print (" Padding region %s with 0x%x bytes" % (region .name , pad_size ))
366
- merged .puts (merged .maxaddr () + 1 , padding * pad_size )
367
+ if format is ".hex" :
368
+ """The offset will be in the hex file generated when we're done,
369
+ so we can skip padding here"""
370
+ else :
371
+ merged .puts (merged .maxaddr () + 1 , padding * pad_size )
367
372
368
373
if not exists (dirname (destination )):
369
374
makedirs (dirname (destination ))
370
375
print ("Space used after regions merged: 0x%x" %
371
376
(merged .maxaddr () - merged .minaddr () + 1 ))
372
377
with open (destination , "wb+" ) as output :
373
- _ , format = splitext (destination )
374
378
merged .tofile (output , format = format .strip ("." ))
375
379
376
380
def scan_resources (src_paths , toolchain , dependencies_paths = None ,
0 commit comments