forked from JohnDMcMaster/eetime
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbin_init.py
More file actions
executable file
·45 lines (38 loc) · 1.17 KB
/
bin_init.py
File metadata and controls
executable file
·45 lines (38 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env python3
"""
Did you put something important into the test fixture?
Just a hopeless data hoarder?
We might have saved it
"""
import argparse
import eetime.jl
from eetime import util
import glob
import os
import binascii
import collect
def main():
parser = argparse.ArgumentParser(
description='Display and write the initial ROM read')
util.add_bool_arg(parser,
"--hexdump",
default=False,
help="Hexdump instead of writing")
parser.add_argument('jl', help='.jl to extract (or first file if dir)')
parser.add_argument('out',
nargs="?",
default="out.bin",
help='Output binary')
args = parser.parse_args()
fn = args.jl
if os.path.isdir(fn):
fn = sorted(list(glob.glob(fn + "/*.jl")))[0]
print("Opening %s" % (fn, ))
header, _footer, _reads = eetime.jl.load_jl(fn)
if not "read" in header:
raise Exception(".jl doesn't support initial read")
buf = collect.str2fw(header["read"])
if args.hexdump:
util.hexdump(buf, terse=True)
if __name__ == "__main__":
main()