File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -215,9 +215,19 @@ endif
215215
216216SHELL = bash
217217APP_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
219223all : $(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 )
Original file line number Diff line number Diff line change 2121
2222
2323def 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
2727def 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
You can’t perform that action at this time.
0 commit comments