Skip to content

Commit c09142e

Browse files
committed
Don't bother padding hex files for managed bl
1 parent 4f13e21 commit c09142e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tools/build_api.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ def merge_region_list(region_list, destination, padding=b'\xFF'):
346346
padding - bytes to fill gapps with
347347
"""
348348
merged = IntelHex()
349+
_, format = splitext(destination)
349350

350351
print("Merging Regions:")
351352

@@ -363,14 +364,17 @@ def merge_region_list(region_list, destination, padding=b'\xFF'):
363364
pad_size = region.size - part_size
364365
if pad_size > 0 and region != region_list[-1]:
365366
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)
367372

368373
if not exists(dirname(destination)):
369374
makedirs(dirname(destination))
370375
print("Space used after regions merged: 0x%x" %
371376
(merged.maxaddr() - merged.minaddr() + 1))
372377
with open(destination, "wb+") as output:
373-
_, format = splitext(destination)
374378
merged.tofile(output, format=format.strip("."))
375379

376380
def scan_resources(src_paths, toolchain, dependencies_paths=None,

0 commit comments

Comments
 (0)