Skip to content

Commit d02f671

Browse files
author
Daniel Campora
committed
cc3200: Add deploy target and improve robustness of update-wipy.py.
1 parent d709622 commit d02f671

2 files changed

Lines changed: 22 additions & 6 deletions

File tree

cc3200/application.mk

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,19 @@ endif
215215

216216
SHELL = bash
217217
APP_SIGN = appsign.sh
218+
UPDATE_WIPY ?= tools/update-wipy.py
219+
WIPY_IP ?= '192.168.1.1'
220+
WIPY_USER ?= 'micro'
221+
WIPY_PWD ?= 'python'
218222

219223
all: $(BUILD)/mcuimg.bin
220224

225+
.PHONY: deploy
226+
227+
deploy: $(BUILD)/mcuimg.bin
228+
$(ECHO) "Writing $< to the board"
229+
$(Q)$(PYTHON) $(UPDATE_WIPY) --verify --ip $(WIPY_IP) --user $(WIPY_USER) --password $(WIPY_PWD) --file $<
230+
221231
$(BUILD)/application.axf: $(OBJ) $(LINKER_SCRIPT)
222232
$(ECHO) "LINK $@"
223233
$(Q)$(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBS)

cc3200/tools/update-wipy.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222

2323
def print_exception(e):
24-
print ('Error: {}, on line {}'.format(e, sys.exc_info()[-1].tb_lineno))
24+
print ('Exception: {}, on line {}'.format(e, sys.exc_info()[-1].tb_lineno))
2525

2626

2727
def transfer_file(args):
@@ -65,13 +65,19 @@ def reset_board(args):
6565
time.sleep(1)
6666
tn.write(bytes(args.password, 'ascii') + b"\r\n")
6767

68-
if b"Login succeeded!" in tn.read_until(b"for more information.", timeout=5):
68+
if b'Type "help()" for more information.' in tn.read_until(b'Type "help()" for more information.', timeout=5):
6969
print("Telnet login succeeded")
70-
tn.write(b"import pyb\r\n")
71-
tn.write(b"pyb.reset()\r\n")
70+
tn.write(b'\r\x03\x03') # ctrl-C twice: interrupt any running program
7271
time.sleep(1)
73-
print("Reset performed")
74-
success = True
72+
tn.write(b'\r\x02') # ctrl-B: enter friendly REPL
73+
if b'Type "help()" for more information.' in tn.read_until(b'Type "help()" for more information.', timeout=5):
74+
tn.write(b"import pyb\r\n")
75+
tn.write(b"pyb.reset()\r\n")
76+
time.sleep(1)
77+
print("Reset performed")
78+
success = True
79+
else:
80+
print("Error: cannot enter friendly REPL")
7581
else:
7682
print("Error: telnet login failed")
7783

0 commit comments

Comments
 (0)