Bug? PlatformIO Esp32 doesn't upload via serial in debug mode

For some reason the PlatformIO environment doesn’t upload the debug build it creates when trying to enter debug mode (Run->Start Debugging) - for me at least. It will build it, but never uploads it. I’m using the esp-prog tool for debugging but want to keep the serial upload for circuitry reasons.

I can serial upload either release or debug builds fine when building/uploading, it is only during the debug sequence that it doesn’t upload.

This is my platform.ini:

upload_port = COM19
platform = espressif32
board = esp32dev
framework = arduino
build_type = debug
monitor_speed = 115200
debug_tool = esp-prog
debug_init_break = tbreak setup
build_flags = -DCORE_DEBUG_LEVEL=5

Note I need the upload_port specified there as during regular upload platformio will incorrectly autodetect the esp-prog port and try to upload to that…

Any thoughts?

When you start a debug session, what does the “Debug Console” tab in VSCode say? There is critical info there.

Most likely you haven’t connected the debugger to the board correctly per this article.