PlatformIO Community

Remote debugging works for stm32 , remote download fails

Platformio on Lubuntu , config project

upload_protocol = custom
upload_port =  limero.local:3333
debug_tool = custom
debug_port =  limero.local:3333
debug_build_flags = -O0 -ggdb3 -g3

I can do remote debugging to a raspberry pi running openocd with this config

lieven@limero:~/workspace/hoverboard $ more ocd-server.sh 
sudo openocd -f openocd.cfg
lieven@limero:~/workspace/hoverboard $ more openocd.cfg 
bindto 0.0.0.0
source [find interface/stlink.cfg]
set CHIPNAME stm32f1x
source [find target/stm32f1x.cfg]
init
targets
reset halt
# program testProgram.hex verify reset
# shutdown

When I use remote debug ( F5 ) it uploads code and I can debug, when doing the download , it doesn’t connect to the openocd and doesn’t transfer the image.
Project : https://github.com/vortex314/hoverboard

PlatformIO has built in remote uploading capabilities if you use PIO Remote.

The OpenOCD upload will always try and invoke OpenOCD locally (source), setting a remote upload_port where a GDB server opened by OpenOCD is listening doesn’t change that. You would have to write a custom upload protocol command that invokes GDB with the right commands to flash the firmware on the device.

That was quick ! Didn’t expect an answer anytime soon.
I’ll have a look at PIO remote.
Thanks !