diff --git a/templates/bluepill/configure b/templates/bluepill/configure index d3c9b5f..d19f245 100755 --- a/templates/bluepill/configure +++ b/templates/bluepill/configure @@ -1,5 +1,5 @@ #!/bin/bash mv -n *.c *.s *.S src/ 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 diff --git a/templates/bluepill/empty_ram.bin b/templates/bluepill/empty_ram.bin new file mode 100644 index 0000000..abdf77b Binary files /dev/null and b/templates/bluepill/empty_ram.bin differ diff --git a/templates/bluepill/test b/templates/bluepill/test index c0307ef..bc8087f 100755 --- a/templates/bluepill/test +++ b/templates/bluepill/test @@ -20,6 +20,28 @@ def flash(): stdout=sys.stderr, stdin=pipe) 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(): import serial.tools.list_ports ports = serial.tools.list_ports.comports() @@ -113,6 +135,7 @@ def main(argv): uartp = UARTP(ser) flash() + fill_ram() eprint("Flashed") time.sleep(0.1)