Skip to content
Browse files

scripts: mergehex: Add --overlap argument

Allows specifying the 'overlap' argument in IntelHex::merge().
This is identical to the --overlap argument in, which
is bundled with IntelHex.

Signed-off-by: Øyvind Rønningstad <>
  • Loading branch information...
oyvindronningstad authored and galak committed May 15, 2019
1 parent 61fb6b4 commit 79d2e31cffa507c18a11cffd6a0b0d3dcd39913a
Showing with 6 additions and 3 deletions.
  1. +6 −3 scripts/
@@ -13,7 +13,7 @@
import argparse

def merge_hex_files(output, input_hex_files):
def merge_hex_files(output, input_hex_files, overlap):
ih = IntelHex()

for hex_file_path in input_hex_files:
@@ -25,7 +25,7 @@ def merge_hex_files(output, input_hex_files):
to_merge.start_addr = None

ih.merge(to_merge, overlap=overlap)
except AddressOverlapError:
raise AddressOverlapError("{} has merge issues".format(hex_file_path))

@@ -41,14 +41,17 @@ def parse_args():
parser.add_argument("-o", "--output", required=False, default="merged.hex",
type=argparse.FileType('w', encoding='UTF-8'),
help="Output file name.")
parser.add_argument("--overlap", default="error",
help="What to do when files overlap (error, ignore, replace). "
"See IntelHex.merge() for more info.")
parser.add_argument("input_files", nargs='*')
return parser.parse_args()

def main():
args = parse_args()

merge_hex_files(args.output, args.input_files)
merge_hex_files(args.output, args.input_files, args.overlap)

if __name__ == "__main__":

0 comments on commit 79d2e31

Please sign in to comment.
You can’t perform that action at this time.