Commit 1276cc7b by Enrico Pozzobon Committed by lwc-tester

ft2232H + openocd bluepill template

parent f8b9564e
#
## Requirements
```
sudo apt install python3-pip openocd
sudo pip3 install pyserial platformio saleae
sudo pip3 uninstall enum34
```
interface ftdi
transport select jtag
ftdi_device_desc "FT2232H MiniModule"
ftdi_vid_pid 0x0403 0x6010
# The other channel is used for UART
ftdi_channel 1
ftdi_layout_init 0x0018 0x05fb
# BDBUS4 is connected to JTAG TRST
ftdi_layout_signal nTRST -data 0x0010
# BDBUS5 is connected to System Reset
ftdi_layout_signal nSRST -data 0x0020
set WORKAREASIZE 0x2000
source [find target/stm32f1x.cfg]
#tpiu config internal swodump.stm32f103-generic.log uart off 72000000
#reset_config srst_only srst_push_pull srst_nogate connect_assert_srst
reset_config none srst_push_pull srst_nogate
...@@ -15,31 +15,20 @@ def eprint(*args, **kargs): ...@@ -15,31 +15,20 @@ def eprint(*args, **kargs):
def flash(): def flash():
pipe = subprocess.PIPE pipe = subprocess.PIPE
cmd = ['platformio', 'run', '-e', 'bluepill_f103c8', '--target', 'upload'] cmd = ['openocd', '-f', 'openocd.cfg', '-c' 'program ' +
'.pio/build/bluepill_f103c8/firmware.elf verify reset exit']
p = subprocess.Popen(cmd, p = subprocess.Popen(cmd,
stdout=sys.stderr, stdin=pipe) stdout=sys.stderr, stdin=sys.stdout)
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(): def fill_ram():
p = popen_jlink() pipe = subprocess.PIPE
return p.communicate((""" cmd = ['openocd', '-f', 'openocd.cfg', '-c' 'program ' +
h 'empty_ram.bin reset exit 0x20000000']
loadbin empty_ram.bin 0x20000000 p = subprocess.Popen(cmd,
r stdout=sys.stderr, stdin=sys.stdout)
g stdout, stderr = p.communicate("")
exit
""").encode('ascii'))
def get_serial(): def get_serial():
......
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