aboutsummaryrefslogtreecommitdiff
path: root/cc3200
diff options
context:
space:
mode:
authorDaniel Campora <daniel@wipy.io>2015-06-24 15:23:03 +0200
committerDaniel Campora <daniel@wipy.io>2015-06-24 15:26:05 +0200
commitd02f671737ebfe90026790de98b6b08752680354 (patch)
treed39d475c5df47e8885573e74329cbbcb66f2ba09 /cc3200
parentd709622bd218f1bf3cf396d21bf5f22bce481e2e (diff)
cc3200: Add deploy target and improve robustness of update-wipy.py.
Diffstat (limited to 'cc3200')
-rw-r--r--cc3200/application.mk10
-rw-r--r--cc3200/tools/update-wipy.py18
2 files changed, 22 insertions, 6 deletions
diff --git a/cc3200/application.mk b/cc3200/application.mk
index 71bbb72ba..0ac98bf5f 100644
--- a/cc3200/application.mk
+++ b/cc3200/application.mk
@@ -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)
diff --git a/cc3200/tools/update-wipy.py b/cc3200/tools/update-wipy.py
index ed87388e0..078ab7c7f 100644
--- a/cc3200/tools/update-wipy.py
+++ b/cc3200/tools/update-wipy.py
@@ -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")