blob: bf50a8e62f4ead532ad2dfcc6729f7e6992ee051 [file] [log] [blame]
Andrew Sculla158e912018-07-16 11:32:13 +01001#!/usr/bin/env python
2
3"""Convert a file to binary format.
4
5Calls objcopy to convert a file into raw binary format.
6"""
7
8import argparse
Andrew Sculla158e912018-07-16 11:32:13 +01009import subprocess
10import sys
11
12def Main():
13 parser = argparse.ArgumentParser()
14 parser.add_argument("--tool_prefix", required=True)
15 parser.add_argument("--input", required=True)
16 parser.add_argument("--output", required=True)
17 args = parser.parse_args()
Andrew Scull2c242332018-08-08 13:30:32 +010018 subprocess.check_call([
Andrew Sculla158e912018-07-16 11:32:13 +010019 "{}objcopy".format(args.tool_prefix),
20 "-O",
21 "binary",
22 args.input,
23 args.output])
24 return 0
25
26if __name__ == "__main__":
27 sys.exit(Main())