Andrew Scull | a158e91 | 2018-07-16 11:32:13 +0100 | [diff] [blame^] | 1 | #!/usr/bin/env python |
| 2 | |
| 3 | """Convert a file to binary format. |
| 4 | |
| 5 | Calls objcopy to convert a file into raw binary format. |
| 6 | """ |
| 7 | |
| 8 | import argparse |
| 9 | import os |
| 10 | import subprocess |
| 11 | import sys |
| 12 | |
| 13 | def Main(): |
| 14 | parser = argparse.ArgumentParser() |
| 15 | parser.add_argument("--tool_prefix", required=True) |
| 16 | parser.add_argument("--input", required=True) |
| 17 | parser.add_argument("--output", required=True) |
| 18 | args = parser.parse_args() |
| 19 | raw = subprocess.check_output([ |
| 20 | "{}objcopy".format(args.tool_prefix), |
| 21 | "-O", |
| 22 | "binary", |
| 23 | args.input, |
| 24 | args.output]) |
| 25 | return 0 |
| 26 | |
| 27 | if __name__ == "__main__": |
| 28 | sys.exit(Main()) |