-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
source [find interface/stlink.cfg] | ||
|
||
transport select hla_swd | ||
|
||
source [find target/stm32f1x.cfg] | ||
|
||
reset_config srst_only connect_assert_srst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# flash.py <hex_filename> | ||
|
||
import os, sys, time, telnetlib | ||
|
||
cmd = 'reset init ; flash write_image erase %s ; reset\n' % sys.argv[1] | ||
|
||
# Start the OpenOCD daemon in the background and connect via telnet | ||
def open_ocd(): | ||
os.system('openocd -f scripts/openocd/f1.cfg &') | ||
while True: | ||
time.sleep(0.5) | ||
try: | ||
t = telnetlib.Telnet('localhost', 4444) | ||
except: | ||
pass | ||
else: | ||
return t | ||
|
||
with open_ocd() as t: | ||
t.write(cmd.encode('utf-8')) | ||
t.write('shutdown\n'.encode('utf-8')) | ||
t.read_all() # Waits for EOF (telnet session shutdown) |