-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmass_flash.py
22 lines (21 loc) · 1004 Bytes
/
mass_flash.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import Jlink
import argparse
import traceback
if __name__ == '__main__':
print("mass flash appiation")
parser = argparse.ArgumentParser(prog='rttapp', description='JLink mass flash')
# parser.add_argument("-v", "--verbose", action='store_false')
parser.add_argument("-f", "--file", dest='file', required=True)
parser.add_argument("-s", "--sn", dest='sn', nargs='*', required=True)
parser.add_argument("-d", "--softdevice", dest="sd", action="store_true")
parser.add_argument("-e", "--erase", dest="erase", action="store_true")
args = parser.parse_args()
print(args)
if args.sn[0] == 'ALL':
Jlink.mass_flash(hex_file=args.file, sn=None, all=True, sd=args.sd, erase=args.erase)
else:
try:
flash_sn_list = [int(s) for s in args.sn]
Jlink.mass_flash(hex_file=args.file, sn=flash_sn_list, all=False, sd=args.sd, erase=args.erase)
except BaseException:
print(traceback.format_exc())