PlatformIO Community

ESP32 can't debug in VScode

Hello,

I,am refer to this tutorial to set up the gdb server, and I can also connect to the Raspberry Pi smoothly in VScode, but this error occurs when I run debug

Reading symbols from /Users/caiyousheng/Documents/PlatformIO/Projects/ESP32_Debug_Test/.pio/build/nodemcu-32s/firmware.elf...
PlatformIO Unified Debugger -> https://bit.ly/pio-debug
PlatformIO: debug_tool = custom
PlatformIO: Initializing remote target...
undefined0000606:WARNING:gdb_server:pyocd-gdbserver is deprecated; please use the new combined pyocd tool.
0x4000f979 in ?? ()
JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Unexpected OCD_ID = 00000000
[esp32.cpu0] Debug controller was reset.
[esp32.cpu0] Core was reset.
[esp32.cpu0] Target halted, PC=0x500000CF, debug_reason=00000000
[esp32.cpu0] Core was reset.
[esp32.cpu0] Target halted, PC=0x40000400, debug_reason=00000000
[esp32.cpu1] Debug controller was reset.
[esp32.cpu1] Core was reset.
[esp32.cpu1] Target halted, PC=0x40000400, debug_reason=00000000
[esp32.cpu0] Target halted, PC=0x4009260E, debug_reason=00000001
Failed to get flash maps (4294967290)!
Failed to get flash mappings (-4)!
[esp32.cpu0] Target halted, PC=0x4009260E, debug_reason=00000001
[esp32.cpu0] Target halted, PC=0x4009260E, debug_reason=00000001
Auto-detected flash bank 'esp32.cpu1.flash' size 4096 KB
Using flash bank 'esp32.cpu1.flash' size 4096 KB
** Programming Started **
[esp32.cpu0] Target halted, PC=0x4009260E, debug_reason=00000001
couldn't open /Users/caiyousheng/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/bin/bootloader_dio_40m.bin
** Programming Failed **
.pioinit:15: Error in sourced command file:
Protocol error with Rcmd
Loop <_UnixSelectorEventLoop running=False closed=True debug=False> that handles pid 62115 is closed

platformio.ini :

[env:nodemcu-32s]

platform = https://github.com/platformio/platform-espressif32.git 
board = nodemcu-32s
framework = arduino
debug_init_break = tbreak setup
debug_tool = custom
debug_port = raspberrypi.local:3333
debug_server = pyocd-gdbserver
upload_port = /dev/cu.SLAB_USBtoUART

Dev Board:AI-thinker NodeMCU-32S

I am also interested in learning how to fix the error. Waiting for the answer.

Then I found that the name of the file is BootLoader_ [spi flash mode] _ [spi_frequency] .bin, but if I set a mode that is not in the folder (Exaple, SET SPEED to 20MHz), he will not show up this error. I think the program is flash in, but I can’t get Debug normally. After reboot, I did not perform the program that was flash in before, and there was no way to enter the debug again, only of flash any program again over the USB.