mirror of
https://github.com/travisgoodspeed/goodwatch
synced 2024-11-21 23:58:31 +00:00
Proper argument parsing, will continue development on a machine with hardware.
This commit is contained in:
parent
b9bfa08e67
commit
e1f0ece1c8
@ -6,13 +6,13 @@
|
||||
## bad checksums. It is free for any use, provided you tip your
|
||||
## bartender.
|
||||
|
||||
import serial, time, sys;
|
||||
import serial, time, sys, argparse;
|
||||
|
||||
|
||||
class BSL:
|
||||
def __init__(self, port):
|
||||
print("Opening %s" % port);
|
||||
self.serial=serial.Serial("/dev/ttyUSB0",
|
||||
self.serial=serial.Serial(port,
|
||||
baudrate=9600,
|
||||
parity=serial.PARITY_EVEN,
|
||||
stopbits=serial.STOPBITS_ONE,
|
||||
@ -216,18 +216,35 @@ def writetest(bsl):
|
||||
assert(readmsg==msg);
|
||||
|
||||
if __name__=='__main__':
|
||||
bsl=BSL("/dev/ttyUSB0");
|
||||
|
||||
print "Testing the BSL library:"
|
||||
|
||||
bsl.enter_bsl();
|
||||
|
||||
if not bsl.unlock():
|
||||
print "Unable to unlock BSL. Try a bulk erase."
|
||||
sys.exit(1);
|
||||
|
||||
bsl.version();
|
||||
coredump(bsl);
|
||||
writetest(bsl);
|
||||
parser = argparse.ArgumentParser(description='CC430F6137 BSL Client')
|
||||
parser.add_argument('-e','--erase', help='Mass Erase',action='count');
|
||||
parser.add_argument('-p','--port', help='Serial Port',default='/dev/ttyUSB0');
|
||||
parser.add_argument('-f','--file', help='Flash File');
|
||||
parser.add_argument('-P','--password', help='Password File or Hex');
|
||||
parser.add_argument('-d','--dump', help='Produce a core dump.',action='count');
|
||||
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
bsl=BSL(args.port);
|
||||
|
||||
if args.erase!=None:
|
||||
bsl.masserase();
|
||||
if args.dump!=None:
|
||||
coredump(bsl);
|
||||
|
||||
# bsl=BSL("/dev/ttyUSB0");
|
||||
|
||||
# print "Testing the BSL library:"
|
||||
|
||||
# bsl.enter_bsl();
|
||||
|
||||
# if not bsl.unlock():
|
||||
# print "Unable to unlock BSL. Try a bulk erase."
|
||||
# sys.exit(1);
|
||||
|
||||
# bsl.version();
|
||||
# coredump(bsl);
|
||||
# writetest(bsl);
|
||||
|
||||
|
||||
|
@ -4,7 +4,7 @@ CC = msp430-gcc -mmcu=cc430f6137
|
||||
|
||||
modules=main.o lcd.o
|
||||
|
||||
all: goodwatch
|
||||
all: goodwatch.hex
|
||||
|
||||
goodwatch: $(modules)
|
||||
$(CC) -o goodwatch $(modules)
|
||||
|
Loading…
Reference in New Issue
Block a user