ESP-Prog Fails to Get Flash Maps and Fails to Set Breakpoints

I had the ESP-Prog debugger working a few weeks ago on a WeMos D1 Mini ESP32 board.
Now when I try to debug on the same board, I get errors saying “Failed to get flash maps(1073405888)” and “esp32.cpu0: Failed to write breakpoint instruction (-4)!”. Then the debugger aborts.

My platformio.ini:

[env:wemos_d1_mini32]
platform = espressif32
board = wemos_d1_mini32
framework = arduino
monitor_speed = 115200
debug_tool = esp-prog
debug_init_break = tbreak setup
lib_deps = 
	paulstoffregen/OneWire@^2.3.6
	milesburton/DallasTemperature@^3.9.1
	bblanchon/ArduinoJson@^6.19.4
	mcxiaoke/ESPDateTime@^1.0.4

Output from the Debug Console:

undefinedC:\Users\PatsCot\.platformio\packages\toolchain-xtensa-esp32\bin\xtensa-esp32-elf-gdb.exe: warning: Couldn't determine a path for the index cache directory.
Reading symbols from c:\Users\PatsCot\Documents\PlatformIO\Projects\XL200_Test_Probe\.pio\build\wemos_d1_mini32\firmware.elf...
PlatformIO Unified Debugger -> https://bit.ly/pio-debug
PlatformIO: debug_tool = esp-prog
PlatformIO: Initializing remote target...
Open On-Chip Debugger  v0.11.0-esp32-20220411 (2022-04-11-08:48)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
adapter speed: 20000 kHz

WARNING: boards/esp-wroom-32.cfg is deprecated, and may be removed in a future release.
DEPRECATED! use 'adapter speed' not 'adapter_khz'
adapter speed: 5000 kHz

Info : tcl server disabled
Info : telnet server disabled
Info : clock speed 5000 kHz
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : starting gdb server for esp32.cpu0 on pipe
Info : accepting 'gdb' connection from pipe
Info : esp32.cpu0: Target halted, PC=0x40144B52, debug_reason=00000000
Info : Set GDB target to 'esp32.cpu0'
Info : esp32.cpu1: Target halted, PC=0x400DA7C8, debug_reason=00000000
Warn : No symbols for FreeRTOS!
Info : esp32.cpu0: Target halted, PC=0x400803C0, debug_reason=00000001
Error: Failed to get flash maps (1073405888)!
Warn : Failed to get flash mappings (-4)!
Info : esp32.cpu0: Target halted, PC=0x400803C0, debug_reason=00000001
Info : esp32.cpu0: Target halted, PC=0x400803C0, debug_reason=00000001
Info : Auto-detected flash bank 'esp32.cpu0.flash' size 320 KB
Info : Using flash bank 'esp32.cpu0.flash' size 320 KB
Info : esp32.cpu0: Target halted, PC=0x400803C0, debug_reason=00000001
Error: Failed to get flash maps (327732)!
Warn : Failed to get flash mappings (-4)!
Info : esp32.cpu0: Target halted, PC=0x400803C0, debug_reason=00000001
Info : Using flash bank 'esp32.cpu0.irom' size 0 KB
Info : esp32.cpu0: Target halted, PC=0x400803C0, debug_reason=00000001
Error: Failed to get flash maps (327732)!
Warn : Failed to get flash mappings (-4)!
Info : esp32.cpu0: Target halted, PC=0x400803C0, debug_reason=00000001
Info : Using flash bank 'esp32.cpu0.drom' size 0 KB
Info : New GDB Connection: 1, Target esp32.cpu0, state: halted
0x40144b52 in __ssvfiscanf_r (rptr=<optimized out>, fp=<optimized out>, fmt0=<optimized out>, ap=...) at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/newlib/newlib/libc/stdio/vfscanf.c:1219
1219	/builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/newlib/newlib/libc/stdio/vfscanf.c: No such file or directory.
Warn : Error reading FreeRTOS thread 0x0 name!
Warn : Error reading FreeRTOS thread 0x0 name!
Warn : Error reading FreeRTOS thread 0x18 name!
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
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)
Info : esp32.cpu0: Target halted, PC=0x400803C0, debug_reason=00000001
esp32.cpu0: Target halted, PC=0x400803C0, debug_reason=00000001
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu1: Core was reset.
esp32.cpu0: Core was reset.
esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
esp32.cpu1: Core was reset.
Info : esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu0: Target halted, PC=0x400003C0, debug_reason=00000001
Warn : Empty flash mapping!
Warn : Failed to get flash mappings (0)!
esp32.cpu0: Target halted, PC=0x400003C0, debug_reason=00000001
Empty flash mapping!
Failed to get flash mappings (0)!
Info : esp32.cpu0: Target halted, PC=0x400003C0, debug_reason=00000001
Error: Failed to get flash size!
esp32.cpu0: Target halted, PC=0x400003C0, debug_reason=00000001
Failed to get flash size!
Info : esp32.cpu0: Target halted, PC=0x400003C0, debug_reason=00000001
Error: Failed to get flash size!
Error: Failed to probe flash, size 0 KB
Error: auto_probe failed
Error: Failed to find bank 'esp32.cpu1.flash'!

esp32.cpu0: Target halted, PC=0x400003C0, debug_reason=00000001
Failed to get flash size!
Failed to probe flash, size 0 KB
auto_probe failed
Failed to find bank 'esp32.cpu1.flash'!

Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
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)
Info : esp32.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
esp32.cpu0: Debug controller was reset.
esp32.cpu0: Core was reset.
esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
Info : esp32.cpu0: Core was reset.
esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
esp32.cpu1: Debug controller was reset.
esp32.cpu1: Core was reset.
Info : esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu0: Target halted, PC=0x400003C0, debug_reason=00000001
Warn : Empty flash mapping!
Warn : Failed to get flash mappings (0)!
esp32.cpu0: Target halted, PC=0x400003C0, debug_reason=00000001
Empty flash mapping!
Failed to get flash mappings (0)!
Info : esp32.cpu0: Target halted, PC=0x400003C0, debug_reason=00000001
Error: Failed to get flash size!
esp32.cpu0: Target halted, PC=0x400003C0, debug_reason=00000001
Failed to get flash size!
Info : esp32.cpu0: Target halted, PC=0x400003C0, debug_reason=00000001
Error: Failed to get flash size!
Error: Failed to probe flash, size 0 KB
Error: auto_probe failed
Error: Failed to find bank 'esp32.cpu1.flash'!

esp32.cpu0: Target halted, PC=0x400003C0, debug_reason=00000001
Failed to get flash size!
Failed to probe flash, size 0 KB
auto_probe failed
Failed to find bank 'esp32.cpu1.flash'!

Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
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)
Info : esp32.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
esp32.cpu0: Debug controller was reset.
esp32.cpu0: Core was reset.
esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
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.
Info : esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu0: Target halted, PC=0x400003C0, debug_reason=00000001
Warn : Empty flash mapping!
Warn : Failed to get flash mappings (0)!
esp32.cpu0: Target halted, PC=0x400003C0, debug_reason=00000001
Empty flash mapping!
Failed to get flash mappings (0)!
Info : esp32.cpu0: Target halted, PC=0x400003C0, debug_reason=00000001
Error: Failed to get flash size!
esp32.cpu0: Target halted, PC=0x400003C0, debug_reason=00000001
Failed to get flash size!
Info : esp32.cpu0: Target halted, PC=0x400003C0, debug_reason=00000001
Error: Failed to get flash size!
Error: Failed to probe flash, size 0 KB
Error: auto_probe failed
Error: Failed to find bank 'esp32.cpu1.flash'!

esp32.cpu0: Target halted, PC=0x400003C0, debug_reason=00000001
Failed to get flash size!
Failed to probe flash, size 0 KB
auto_probe failed
Failed to find bank 'esp32.cpu1.flash'!

Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
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)
Info : esp32.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
esp32.cpu0: Debug controller was reset.
esp32.cpu0: Core was reset.
esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
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.
Info : esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu0: Target halted, PC=0x400003C0, debug_reason=00000001
Warn : Empty flash mapping!
Warn : Failed to get flash mappings (0)!
esp32.cpu0: Target halted, PC=0x400003C0, debug_reason=00000001
Empty flash mapping!
Failed to get flash mappings (0)!
Info : esp32.cpu0: Target halted, PC=0x400003C0, debug_reason=00000001
Error: Failed to get flash size!
esp32.cpu0: Target halted, PC=0x400003C0, debug_reason=00000001
Failed to get flash size!
Info : esp32.cpu0: Target halted, PC=0x400003C0, debug_reason=00000001
Error: Failed to get flash size!
Error: Failed to probe flash, size 0 KB
Error: auto_probe failed
Error: Failed to find bank 'esp32.cpu1.flash'!

esp32.cpu0: Target halted, PC=0x400003C0, debug_reason=00000001
Failed to get flash size!
Failed to probe flash, size 0 KB
auto_probe failed
Failed to find bank 'esp32.cpu1.flash'!

Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
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)
Info : esp32.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
esp32.cpu0: Debug controller was reset.
esp32.cpu0: Core was reset.
esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
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.
Info : esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
Temporary breakpoint 1 at 0x400d4ae4: file src/main.cpp, line 261.
PlatformIO: Initialization completed
PlatformIO: Resume the execution to `debug_init_break = tbreak setup`
PlatformIO: More configuration options -> https://bit.ly/pio-debug
Warn : address 0x400d4ae4 not writable
Error: esp32.cpu0: Failed to write breakpoint instruction (-4)!
Error: esp32.cpu0: Failed to add SW breakpoint!
Error: can't add breakpoint: unknown reason
Warn : address 0x400d9d2a not writable
Error: esp32.cpu0: Failed to write breakpoint instruction (-4)!
Error: esp32.cpu0: Failed to add SW breakpoint!
Error: can't add breakpoint: unknown reason
Warn : address 0x400d9d8a not writable
Error: esp32.cpu0: Failed to write breakpoint instruction (-4)!
Error: esp32.cpu0: Failed to add SW breakpoint!
Error: can't add breakpoint: unknown reason
Warning:
Cannot insert breakpoint 1.
Cannot access memory at address 0x400d4ae4
Cannot insert breakpoint 2.
Cannot access memory at address 0x400d9d2a
Cannot insert breakpoint 3.
Cannot access memory at address 0x400d9d8a

Command aborted.

(maxgerhardt is my hero)

Can you test the setup with a simple blink sketch and also test if uploading via the debugger (upload_protocol = esp-prog) works?

A possible cause of this problem is that the JTAG pins are not left alone but reconfigured for GPIO, SPI, I2C etc. or are also wired to an LED, button etc.

With a simple blink sketch, I am able to upload via the debugger.
In the sketch where the debugger is not working, the only reconfigured pin is GPIO17

Thanks for the quick reply by the way!

I removed the reconfiguration on GPIO17 and the debugger worked. However, I am unable to connect to WiFi while stepping through code with the debugger.