cc3200: Add deploy target and improve robustness of update-wipy.py.

This commit is contained in:
Daniel Campora 2015-06-24 15:23:03 +02:00
parent d709622bd2
commit d02f671737
2 changed files with 22 additions and 6 deletions

View File

@ -215,9 +215,19 @@ endif
SHELL = bash
APP_SIGN = appsign.sh
UPDATE_WIPY ?= tools/update-wipy.py
WIPY_IP ?= '192.168.1.1'
WIPY_USER ?= 'micro'
WIPY_PWD ?= 'python'
all: $(BUILD)/mcuimg.bin
.PHONY: deploy
deploy: $(BUILD)/mcuimg.bin
$(ECHO) "Writing $< to the board"
$(Q)$(PYTHON) $(UPDATE_WIPY) --verify --ip $(WIPY_IP) --user $(WIPY_USER) --password $(WIPY_PWD) --file $<
$(BUILD)/application.axf: $(OBJ) $(LINKER_SCRIPT)
$(ECHO) "LINK $@"
$(Q)$(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBS)

View File

@ -21,7 +21,7 @@ from telnetlib import Telnet
def print_exception(e):
print ('Error: {}, on line {}'.format(e, sys.exc_info()[-1].tb_lineno))
print ('Exception: {}, on line {}'.format(e, sys.exc_info()[-1].tb_lineno))
def transfer_file(args):
@ -65,13 +65,19 @@ def reset_board(args):
time.sleep(1)
tn.write(bytes(args.password, 'ascii') + b"\r\n")
if b"Login succeeded!" in tn.read_until(b"for more information.", timeout=5):
if b'Type "help()" for more information.' in tn.read_until(b'Type "help()" for more information.', timeout=5):
print("Telnet login succeeded")
tn.write(b"import pyb\r\n")
tn.write(b"pyb.reset()\r\n")
tn.write(b'\r\x03\x03') # ctrl-C twice: interrupt any running program
time.sleep(1)
print("Reset performed")
success = True
tn.write(b'\r\x02') # ctrl-B: enter friendly REPL
if b'Type "help()" for more information.' in tn.read_until(b'Type "help()" for more information.', timeout=5):
tn.write(b"import pyb\r\n")
tn.write(b"pyb.reset()\r\n")
time.sleep(1)
print("Reset performed")
success = True
else:
print("Error: cannot enter friendly REPL")
else:
print("Error: telnet login failed")