Thanks , I am starting the OpenOCD on the raspberry manually now and it is working .
My platformio.ini looks like this :
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
debug_init_break = tbreak setup
;sudo OPENOCD_SCRIPTS=$PWD/tcl src/openocd -f interface/raspberrypi2-native.cfg -f target/esp32.cfg -c “adapter_khz 1000” -c “bindto 0.0.0.0”
debug_tool = custom
debug_port = raspberrypi.local:3333
debug_server = pyocd-gdbserver
I only need a way to automate the line that is commented , to start OpenOCD .