mirror of https://github.com/ARMmbed/mbed-os.git
tools: Update build_api
Rename loop varibles for better readability and formatting changes.pull/9208/head
parent
c8de1aed5e
commit
f7a114eba8
|
@ -435,9 +435,9 @@ def merge_region_list(region_list, destination, notify, padding=b'\xFF'):
|
||||||
# this is only to get a neat ToolException anyway, since IntelHex.merge will
|
# this is only to get a neat ToolException anyway, since IntelHex.merge will
|
||||||
# throw IntelHex.AddressOverlapError if there's overlapping
|
# throw IntelHex.AddressOverlapError if there's overlapping
|
||||||
part_size = 0
|
part_size = 0
|
||||||
for es in part.segments():
|
for start, stop in part.segments():
|
||||||
part_size += es[1] - es[0]
|
part_size += stop - start
|
||||||
merged.merge(part[es[0]:_end_addr_inclusive(es[1])])
|
merged.merge(part)
|
||||||
|
|
||||||
if part_size > region.size:
|
if part_size > region.size:
|
||||||
raise ToolException("Contents of region %s does not fit"
|
raise ToolException("Contents of region %s does not fit"
|
||||||
|
@ -445,13 +445,12 @@ def merge_region_list(region_list, destination, notify, padding=b'\xFF'):
|
||||||
|
|
||||||
# Hex file can have gaps, so no padding needed. While other formats may
|
# Hex file can have gaps, so no padding needed. While other formats may
|
||||||
# need padding. Iterate through segments and pad the gaps.
|
# need padding. Iterate through segments and pad the gaps.
|
||||||
if (format != ".hex"):
|
if format != ".hex":
|
||||||
begin = 0
|
begin = 0
|
||||||
for es in merged.segments():
|
for start, stop in merged.segments():
|
||||||
if (begin < es[0]):
|
pad_size = start - begin
|
||||||
pad_size = es[0] - begin
|
merged.puts(begin, padding * pad_size)
|
||||||
merged.puts(begin, padding * pad_size)
|
begin = stop + 1
|
||||||
begin = es[1] + 1
|
|
||||||
|
|
||||||
if not exists(dirname(destination)):
|
if not exists(dirname(destination)):
|
||||||
makedirs(dirname(destination))
|
makedirs(dirname(destination))
|
||||||
|
|
Loading…
Reference in New Issue