Let's say I've got two STM32's, and I'm using this programmer here.
I want to connect to both of them and debug/reflash/itterate independently.
So, the setup I have is as follows:
HW
PC |-> USB1 -> ST-LINK-Programmer1 -> STM32_Board1
|-> USB2 -> ST-LINK-Programmer2 -> STM32_Board2
SW
They way I normally do this with one board is pretty simple.
openocd -f config.cfg
And here is the config file I'm calling:
source [find interface/stlink-v2.cfg]
transport select hla_swd
source [find target/stm32f4x.cfg]
reset_config none
Then, in a different terminal, I call arm-gdb like so:
arm-none-eabi-gdb build/FW.elf
and in the ~/.gdbinit, I've got this single line:
target remote localhost:3333
What's not Working
This is pretty obvious...I'm using port 3333 for the first OpenOCD, but the second instance is trying to use that same port and fails with
Error: couldn't bind tcl to socket: Address already in use
What I've Tried
I've looked over the documentation here, but I'm failing to see how to call these options in my config.cfg
file.
I've also tried adding these commands about tcl_port and gdb_port to the actual command line arguments, like
openocd -f config.cfg -c tcl_port 4444
, but this doesn't work either...The socket is still in use.
My Real Question
What's the right way to do this? And are there any gotchas with dealing with arm-none-eabi-gdb after getting openocd configured so that it connects to the right OpenOCD instance?