Commit b5fadc28 by Enrico Pozzobon

bluepill template improvements

parent 1f7473d2
#!/bin/bash #!/bin/bash
mv -n *.c *.s *.S src/ mv -n *.c *.s *.S src/
mv -n *.dat *.inc *.h include/ mv -n *.dat *.inc *.h include/
sed -i src/encrypt.c -e "s/\(\s\)init(/\1_init(/g" sed -i src/encrypt.c -e "s/\(\s\)init(/\1encrypt_init(/g"
exit 0 exit 0
...@@ -20,6 +20,28 @@ def flash(): ...@@ -20,6 +20,28 @@ def flash():
stdout=sys.stderr, stdin=pipe) stdout=sys.stderr, stdin=pipe)
stdout, stderr = p.communicate("") stdout, stderr = p.communicate("")
def popen_jlink():
pipe = subprocess.PIPE
cmd = ['JLinkExe']
cmd.extend(['-autoconnect', '1'])
cmd.extend(['-device', 'STM32F103C8'])
cmd.extend(['-if', 'swd'])
cmd.extend(['-speed', '4000'])
return subprocess.Popen(cmd, stdout=sys.stderr, stdin=pipe)
def fill_ram():
p = popen_jlink()
return p.communicate(("""
h
loadbin empty_ram.bin 0x20000000
r
g
exit
""").encode('ascii'))
def get_serial(): def get_serial():
import serial.tools.list_ports import serial.tools.list_ports
ports = serial.tools.list_ports.comports() ports = serial.tools.list_ports.comports()
...@@ -113,6 +135,7 @@ def main(argv): ...@@ -113,6 +135,7 @@ def main(argv):
uartp = UARTP(ser) uartp = UARTP(ser)
flash() flash()
fill_ram()
eprint("Flashed") eprint("Flashed")
time.sleep(0.1) time.sleep(0.1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment