-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathnrfjprog
executable file
·52 lines (39 loc) · 1.2 KB
/
nrfjprog
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
46
47
48
49
50
51
#!/usr/bin/python
"""
An implementation of the Nordic "nrfjprog.exe" program
using python and jlink.py.
See README.md for installation and more information.
"""
from jlink import jlink
import sys
if __name__=="__main__":
_jl=None
def jl():
global _jl
_jl = _jl or jlink.JLink()
return _jl
args = sys.argv[1:]
while (args):
arg = args.pop(0)
if arg=="--erase":
jl().halt()
#jl().erase_partial(0xA000,256*1024)
jl().erase_all()
elif arg=="--reset":
jl().halt()
jl().reset()
elif arg=="--program":
filename = args.pop(0)
jl().auto_program(filename)
elif arg=="--dumpfile":
startaddr = int(args.pop(),base=0)
endaddr = int(args.pop(),base=0)
filename = args.pop(0)
jl().halt()
print 'Dumping %x -> %x to file "%s"'%(startaddr,
endaddr,
filename)
jl().make_dump(startaddr,endaddr,filename)
else:
print "unknown argument: ",arg
sys.exit(-1)