Browse Source

STM32F7: Add build target to program via OpenOCD

Keir Fraser 5 years ago
parent
commit
5ed5bd0d32
2 changed files with 13 additions and 0 deletions
  1. 4 0
      Makefile
  2. 9 0
      scripts/telnet.py

+ 4 - 0
Makefile

@@ -71,6 +71,10 @@ endif
 BAUD=115200
 DEV=/dev/ttyUSB0
 
+ocd: all
+	python3 scripts/telnet.py localhost 4444 \
+	"reset init ; flash write_image erase `pwd`/$(PROJ)-$(VER).hex ; reset"
+
 flash: all
 	sudo stm32flash -b $(BAUD) -w $(PROJ)-$(VER).hex $(DEV)
 

+ 9 - 0
scripts/telnet.py

@@ -0,0 +1,9 @@
+
+# Send a command over telnet to remote host:
+#  telnet.py <host> <port> <string>
+
+import sys
+import telnetlib
+
+with telnetlib.Telnet(sys.argv[1], sys.argv[2]) as t:
+    t.write((sys.argv[3] + '\n').encode('utf-8'))