ESP32-Pico-V3 fails to upload/debug using esp-prog

yes absolutely, that folder is there!

Please remove ~/.platformio/penv folder and restart VSCode. Does ~/.platformio/penv/bin/python --version work?

yes it works, version 3.8.4, removing penv folder did not make a difference.

@valeros very same symptoms with a blink :frowning:

Could you please try erasing the entire flash memory? Just type pio run -t erase in the IDE terminal and try to debug the blink example again. Also would be great if you could attach here all log messages.

This got us one step further. It does now stop at app_main, despite it not being stated in the platformio.ini in the blink project. It also stops at the first line in the loop. However if I try to step over it jumps into `start_cpu0_default.dbgasm’ at line 52 and wont ever jump back into the loop function.

Full log where i step over the first line in loop, and press resume after it jumped into start_cpu0_default.dbgasm:

Processing esp32dev (platform: https://github.com/platformio/platform-espressif32#feature/openocd-update; board: esp32dev; framework: arduino)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (2.0.0+sha.7b932d1) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-arduinoespressif32 3.10004.201016 (1.0.4)
 - tool-esptoolpy 1.20600.0 (2.6.0)
 - tool-openocd-esp32 2.1000.20200709 (10.0)
 - toolchain-xtensa32 2.50200.80 (5.2.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 26 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <WiFi> 1.0
Building in debug mode
Retrieving maximum program size .pio/build/esp32dev/firmware.elf
Checking size .pio/build/esp32dev/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   4.7% (used 15436 bytes from 327680 bytes)
Flash: [==        ]  16.5% (used 216801 bytes from 1310720 bytes)
========================= [SUCCESS] Took 1.12 seconds =========================
Reading symbols from /Users/wolfgang/Documents/PlatformIO/Projects/ESP32 Wifi Scan/.pio/build/esp32dev/firmware.elf...
done.
PlatformIO Unified Debugger -> http://bit.ly/pio-debug
PlatformIO: debug_tool = esp-prog
PlatformIO: Initializing remote target...
Open On-Chip Debugger  v0.10.0-esp32-20200709 (2020-07-09-08:54)
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.
Info : Configured 2 cores
adapter speed: 20000 kHz

Info : tcl server disabled
Info : telnet server disabled
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 20000 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 : cpu0: Detected debug stubs @ 3ffc0ca4
Info : accepting 'gdb' connection from pipe
Error: No symbols for FreeRTOS
Info : Target halted. CPU0: PC=0x400842F0 (active)
Info : Target halted. CPU1: PC=0x400E911E
Info : cpu0: Target halted, PC=0x40091856, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 45 KB
Info : Flash mapping 1: 0x20018 -> 0x400d0018, 100 KB
Info : cpu0: Target halted, PC=0x40091856, debug_reason=00000001
Info : Auto-detected flash bank 'esp32.flash' size 4096 KB
Info : Using flash bank 'esp32.flash' size 4096 KB
Info : cpu0: Target halted, PC=0x40091856, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 45 KB
Info : Flash mapping 1: 0x20018 -> 0x400d0018, 100 KB
Info : Using flash bank 'esp32.irom' size 104 KB
Info : cpu0: Target halted, PC=0x40091856, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 45 KB
Info : Flash mapping 1: 0x20018 -> 0x400d0018, 100 KB
Info : Using flash bank 'esp32.drom' size 48 KB
_xt_user_exc () at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/xtensa_vectors.S:649
649	/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/xtensa_vectors.S: No such file or directory.
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 : cpu0: Debug controller 0 was reset.
Info : cpu0: Core 0 was reset.
cpu0: Debug controller 0 was reset.
cpu0: Core 0 was reset.
Info : cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
Info : esp32: Core 0 was reset.
esp32: Core 0 was reset.
Info : esp32: Debug controller 1 was reset.
Info : esp32: Core 1 was reset.
esp32: Debug controller 1 was reset.
esp32: Core 1 was reset.
Info : Target halted. CPU0: PC=0x40000400 (active)
Info : Target halted. CPU1: PC=0x40000400
Target halted. CPU0: PC=0x40000400 (active)
Target halted. CPU1: PC=0x40000400
** Programming Started **
** Programming Started **
embedded:startup.tcl:449: Error: ** Programming Failed **
in procedure 'program_esp32'
in procedure 'program_esp' called at file "/Users/wolfgang/.platformio/packages/tool-openocd-esp32/share/openocd/scripts/target/esp32.cfg", line 64
in procedure 'program_error' called at file "/Users/wolfgang/.platformio/packages/tool-openocd-esp32/share/openocd/scripts/target/esp_common.cfg", line 106
at file "embedded:startup.tcl", line 449
embedded:startup.tcl:449: Error: ** Programming Failed **
in procedure 'program_esp32'
in procedure 'program_esp' called at file "/Users/wolfgang/.platformio/packages/tool-openocd-esp32/share/openocd/scripts/target/esp32.cfg", line 64
in procedure 'program_error' called at file "/Users/wolfgang/.platformio/packages/tool-openocd-esp32/share/openocd/scripts/target/esp_common.cfg", line 106
at file "embedded:startup.tcl", line 449
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 : cpu0: Debug controller 0 was reset.
Info : cpu0: Core 0 was reset.
cpu0: Debug controller 0 was reset.
cpu0: Core 0 was reset.
Info : cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
Info : esp32: Core 0 was reset.
esp32: Core 0 was reset.
Info : esp32: Debug controller 1 was reset.
Info : esp32: Core 1 was reset.
esp32: Debug controller 1 was reset.
esp32: Core 1 was reset.
Info : Target halted. CPU0: PC=0x40000400 (active)
Info : Target halted. CPU1: PC=0x40000400
Target halted. CPU0: PC=0x40000400 (active)
Target halted. CPU1: PC=0x40000400
** Programming Started **
** Programming Started **
embedded:startup.tcl:449: Error: ** Programming Failed **
in procedure 'program_esp32'
in procedure 'program_esp' called at file "/Users/wolfgang/.platformio/packages/tool-openocd-esp32/share/openocd/scripts/target/esp32.cfg", line 64
in procedure 'program_error' called at file "/Users/wolfgang/.platformio/packages/tool-openocd-esp32/share/openocd/scripts/target/esp_common.cfg", line 106
at file "embedded:startup.tcl", line 449
embedded:startup.tcl:449: Error: ** Programming Failed **
in procedure 'program_esp32'
in procedure 'program_esp' called at file "/Users/wolfgang/.platformio/packages/tool-openocd-esp32/share/openocd/scripts/target/esp32.cfg", line 64
in procedure 'program_error' called at file "/Users/wolfgang/.platformio/packages/tool-openocd-esp32/share/openocd/scripts/target/esp_common.cfg", line 106
at file "embedded:startup.tcl", line 449
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 : cpu0: Debug controller 0 was reset.
Info : cpu0: Core 0 was reset.
cpu0: Debug controller 0 was reset.
cpu0: Core 0 was reset.
Info : cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
Info : esp32: Core 0 was reset.
esp32: Core 0 was reset.
Info : esp32: Debug controller 1 was reset.
Info : esp32: Core 1 was reset.
esp32: Debug controller 1 was reset.
esp32: Core 1 was reset.
Info : Target halted. CPU0: PC=0x40000400 (active)
Info : Target halted. CPU1: PC=0x40000400
Target halted. CPU0: PC=0x40000400 (active)
Target halted. CPU1: PC=0x40000400
** Programming Started **
** Programming Started **
embedded:startup.tcl:449: Error: ** Programming Failed **
in procedure 'program_esp32'
in procedure 'program_esp' called at file "/Users/wolfgang/.platformio/packages/tool-openocd-esp32/share/openocd/scripts/target/esp32.cfg", line 64
in procedure 'program_error' called at file "/Users/wolfgang/.platformio/packages/tool-openocd-esp32/share/openocd/scripts/target/esp_common.cfg", line 106
at file "embedded:startup.tcl", line 449
embedded:startup.tcl:449: Error: ** Programming Failed **
in procedure 'program_esp32'
in procedure 'program_esp' called at file "/Users/wolfgang/.platformio/packages/tool-openocd-esp32/share/openocd/scripts/target/esp32.cfg", line 64
in procedure 'program_error' called at file "/Users/wolfgang/.platformio/packages/tool-openocd-esp32/share/openocd/scripts/target/esp_common.cfg", line 106
at file "embedded:startup.tcl", line 449
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 : cpu0: Debug controller 0 was reset.
Info : cpu0: Core 0 was reset.
cpu0: Debug controller 0 was reset.
cpu0: Core 0 was reset.
Info : cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
Info : esp32: Core 0 was reset.
esp32: Core 0 was reset.
Info : esp32: Debug controller 1 was reset.
Info : esp32: Core 1 was reset.
esp32: Debug controller 1 was reset.
esp32: Core 1 was reset.
Info : Target halted. CPU0: PC=0x40000400 (active)
Info : Target halted. CPU1: PC=0x40000400
Target halted. CPU0: PC=0x40000400 (active)
Target halted. CPU1: PC=0x40000400
** Programming Started **
** Programming Started **
embedded:startup.tcl:449: Error: ** Programming Failed **
in procedure 'program_esp32'
in procedure 'program_esp' called at file "/Users/wolfgang/.platformio/packages/tool-openocd-esp32/share/openocd/scripts/target/esp32.cfg", line 64
in procedure 'program_error' called at file "/Users/wolfgang/.platformio/packages/tool-openocd-esp32/share/openocd/scripts/target/esp_common.cfg", line 106
at file "embedded:startup.tcl", line 449
embedded:startup.tcl:449: Error: ** Programming Failed **
in procedure 'program_esp32'
in procedure 'program_esp' called at file "/Users/wolfgang/.platformio/packages/tool-openocd-esp32/share/openocd/scripts/target/esp32.cfg", line 64
in procedure 'program_error' called at file "/Users/wolfgang/.platformio/packages/tool-openocd-esp32/share/openocd/scripts/target/esp_common.cfg", line 106
at file "embedded:startup.tcl", line 449
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 : cpu0: Debug controller 0 was reset.
Info : cpu0: Core 0 was reset.
cpu0: Debug controller 0 was reset.
cpu0: Core 0 was reset.
Info : cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
Info : esp32: Core 0 was reset.
esp32: Core 0 was reset.
Info : esp32: Debug controller 1 was reset.
Info : esp32: Core 1 was reset.
esp32: Debug controller 1 was reset.
esp32: Core 1 was reset.
Info : Target halted. CPU0: PC=0x40000400 (active)
Info : Target halted. CPU1: PC=0x40000400
Target halted. CPU0: PC=0x40000400 (active)
Target halted. CPU1: PC=0x40000400
Hardware assisted breakpoint 1 at 0x400d1d7c: file /Users/wolfgang/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp, line 24.
PlatformIO: Initialization completed
PlatformIO: Resume the execution to `debug_init_break = thb app_main`
PlatformIO: More configuration options -> http://bit.ly/pio-debug
Note: automatically using hardware breakpoints for read-only addresses.
Info : Target halted. CPU0: PC=0x400D1D7C (active)
Info : Target halted. CPU1: PC=0x4008190B
Target halted. CPU0: PC=0x400D1D7C (active)
Target halted. CPU1: PC=0x4008190B
Info : cpu0: Detected debug stubs @ 3ffc0ca4
[New Thread 1073445320]
[New Thread 1073455716]
[Switching to Thread 1073446424]

Temporary breakpoint
1, app_main () at /Users/wolfgang/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp:24
24	{
Info : Target halted. CPU0: PC=0x400D0C3B (active)
Info : Target halted. CPU1: PC=0x4008190B
Target halted. CPU0: PC=0x400D0C3B (active)
Target halted. CPU1: PC=0x4008190B

Breakpoint
2, loop () at src/main.cpp:26
26	    Serial.println("led on");
Info : Target halted. CPU0: PC=0x400D0C4C (active)
Target halted. CPU0: PC=0x400D0C4C (active)
Info : Target halted. CPU1: PC=0x4008190B
Target halted. CPU1: PC=0x4008190B

Also the python problem is still unresolved.

Looks like you’re using the stable version of espressif32 platform, you need to use the upstream version:

[env:esp32dev]
#platform = espressif32
platform = https://github.com/platformio/platform-espressif32#feature/openocd-update
board = esp32dev
framework = arduino
monitor_speed = 115200

platformio.ini contains this exact line:

[env:esp32dev]
platform = https://github.com/platformio/platform-espressif32#feature/openocd-update
board = esp32dev
framework = arduino

yes at this point I also find this whole issue highly confusing.

edit: also if I really was using the stable version, uploading and debugging with the updated openocd version would not work at all as indicated early in this thread.

For some reason an old command program_esp32 used for programming. Are you sure you’re using the latest development version of platformio-core? What is the output of pio --version command?

wth
5.0.1 :scream:
why that again? I did run pio upgrade --dev and it said it’s on 5.0.2

trying again with 5.0.2b3 …

EDIT: disregard below, i have removed the breakpoint and started without breakpoint and it now works as expected :scream:

before edit:
@valeros it would have been boring if it worked now, wouldn’t it? :man_facepalming:

Processing esp32dev (platform: https://github.com/platformio/platform-espressif32#feature/openocd-update; board: esp32dev; framework: arduino)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (2.0.0+sha.7b932d1) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-arduinoespressif32 3.10004.201016 (1.0.4)
 - tool-esptoolpy 1.20600.0 (2.6.0)
 - tool-openocd-esp32 2.1000.20200709 (10.0)
 - toolchain-xtensa32 2.50200.80 (5.2.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 26 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <WiFi> 1.0
Building in debug mode
Retrieving maximum program size .pio/build/esp32dev/firmware.elf
Checking size .pio/build/esp32dev/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   4.7% (used 15436 bytes from 327680 bytes)
Flash: [==        ]  16.5% (used 216829 bytes from 1310720 bytes)
========================= [SUCCESS] Took 1.28 seconds =========================
Reading symbols from /Users/wolfgang/Documents/PlatformIO/Projects/ESP32 Wifi Scan/.pio/build/esp32dev/firmware.elf...
done.
PlatformIO Unified Debugger -> http://bit.ly/pio-debug
PlatformIO: debug_tool = esp-prog
PlatformIO: Initializing remote target...
Open On-Chip Debugger  v0.10.0-esp32-20200709 (2020-07-09-08:54)
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.
Info : Configured 2 cores
adapter speed: 20000 kHz

Info : tcl server disabled
Info : telnet server disabled
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 20000 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 : esp32: Debug controller 0 was reset.
Info : esp32: Core 0 was reset.
Info : accepting 'gdb' connection from pipe
Error: No symbols for FreeRTOS
Info : Target halted. CPU0: PC=0x4000F979 (active)
Info : Target halted. CPU1: PC=0x00000000
Info : cpu0: Target halted, PC=0x40091856, debug_reason=00000001
Warn : Empty flash mapping!
Warn : Failed to get flash mappings (0)!
Info : cpu0: Target halted, PC=0x40091856, debug_reason=00000001
Info : cpu0: Target halted, PC=0x40091856, debug_reason=00000001
Info : Auto-detected flash bank 'esp32.flash' size 4096 KB
Info : Using flash bank 'esp32.flash' size 4096 KB
Info : cpu0: Target halted, PC=0x40091856, debug_reason=00000001
Warn : Empty flash mapping!
Warn : Failed to get flash mappings (0)!
Info : cpu0: Target halted, PC=0x40091856, debug_reason=00000001
Info : Using flash bank 'esp32.irom' size 0 KB
Info : cpu0: Target halted, PC=0x40091856, debug_reason=00000001
Warn : Empty flash mapping!
Warn : Failed to get flash mappings (0)!
Info : cpu0: Target halted, PC=0x40091856, debug_reason=00000001
Info : Using flash bank 'esp32.drom' size 0 KB
0x4000f979 in ?? ()
Error: Too large number of threads 971036146!
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 : cpu0: Debug controller 0 was reset.
Info : cpu0: Core 0 was reset.
cpu0: Debug controller 0 was reset.
cpu0: Core 0 was reset.
Info : cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
Info : esp32: Core 0 was reset.
esp32: Core 0 was reset.
Info : esp32: Debug controller 1 was reset.
Info : esp32: Core 1 was reset.
esp32: Debug controller 1 was reset.
esp32: Core 1 was reset.
Info : Target halted. CPU0: PC=0x40000400 (active)
Target halted. CPU0: PC=0x40000400 (active)
Info : Target halted. CPU1: PC=0x40000400
Target halted. CPU1: PC=0x40000400
** Programming Started **
** Programming Started **
Info : cpu0: Target halted, PC=0x40091856, debug_reason=00000001
cpu0: Target halted, PC=0x40091856, debug_reason=00000001
Info : cpu0: Target halted, PC=0x40091856, debug_reason=00000001
cpu0: Target halted, PC=0x40091856, debug_reason=00000001
** Programming Finished **
** Programming Finished **
** Verify Started **
** Verify Started **
Info : cpu0: Target halted, PC=0x40091856, debug_reason=00000001
cpu0: Target halted, PC=0x40091856, debug_reason=00000001
** Verified OK **
** Verified OK **
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 : cpu0: Debug controller 0 was reset.
Info : cpu0: Core 0 was reset.
cpu0: Debug controller 0 was reset.
cpu0: Core 0 was reset.
Info : cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
Info : esp32: Core 0 was reset.
esp32: Core 0 was reset.
Info : esp32: Debug controller 1 was reset.
Info : esp32: Core 1 was reset.
esp32: Debug controller 1 was reset.
esp32: Core 1 was reset.
Info : Target halted. CPU0: PC=0x40000400 (active)
Target halted. CPU0: PC=0x40000400 (active)
Info : Target halted. CPU1: PC=0x40000400
Target halted. CPU1: PC=0x40000400
** Programming Started **
** Programming Started **
Info : cpu0: Target halted, PC=0x40091856, debug_reason=00000001
cpu0: Target halted, PC=0x40091856, debug_reason=00000001
Info : cpu0: Target halted, PC=0x40091856, debug_reason=00000001
cpu0: Target halted, PC=0x40091856, debug_reason=00000001
** Programming Finished **
** Programming Finished **
** Verify Started **
** Verify Started **
Info : cpu0: Target halted, PC=0x40091856, debug_reason=00000001
cpu0: Target halted, PC=0x40091856, debug_reason=00000001
** Verified OK **
** Verified OK **
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 : cpu0: Debug controller 0 was reset.
Info : cpu0: Core 0 was reset.
cpu0: Debug controller 0 was reset.
cpu0: Core 0 was reset.
Info : cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
Info : esp32: Core 0 was reset.
esp32: Core 0 was reset.
Info : esp32: Debug controller 1 was reset.
Info : esp32: Core 1 was reset.
esp32: Debug controller 1 was reset.
esp32: Core 1 was reset.
Info : Target halted. CPU0: PC=0x40000400 (active)
Info : Target halted. CPU1: PC=0x40000400
Target halted. CPU0: PC=0x40000400 (active)
Target halted. CPU1: PC=0x40000400
** Programming Started **
** Programming Started **
Info : cpu0: Target halted, PC=0x40091856, debug_reason=00000001
cpu0: Target halted, PC=0x40091856, debug_reason=00000001
Info : cpu0: Target halted, PC=0x40091856, debug_reason=00000001
cpu0: Target halted, PC=0x40091856, debug_reason=00000001
** Programming Finished **
** Programming Finished **
** Verify Started **
** Verify Started **
Info : cpu0: Target halted, PC=0x40091856, debug_reason=00000001
cpu0: Target halted, PC=0x40091856, debug_reason=00000001
** Verified OK **
** Verified OK **
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 : cpu0: Debug controller 0 was reset.
Info : cpu0: Core 0 was reset.
cpu0: Debug controller 0 was reset.
cpu0: Core 0 was reset.
Info : cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
Info : esp32: Core 0 was reset.
esp32: Core 0 was reset.
Info : esp32: Debug controller 1 was reset.
Info : esp32: Core 1 was reset.
esp32: Debug controller 1 was reset.
esp32: Core 1 was reset.
Info : Target halted. CPU0: PC=0x40000400 (active)
Info : Target halted. CPU1: PC=0x40000400
Target halted. CPU0: PC=0x40000400 (active)
Target halted. CPU1: PC=0x40000400
** Programming Started **
** Programming Started **
Info : cpu0: Target halted, PC=0x40091856, debug_reason=00000001
cpu0: Target halted, PC=0x40091856, debug_reason=00000001
Info : cpu0: Target halted, PC=0x40091856, debug_reason=00000001
cpu0: Target halted, PC=0x40091856, debug_reason=00000001
** Programming Finished **
** Programming Finished **
** Verify Started **
** Verify Started **
Info : cpu0: Target halted, PC=0x40091856, debug_reason=00000001
cpu0: Target halted, PC=0x40091856, debug_reason=00000001
** Verified OK **
** Verified OK **
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 : cpu0: Debug controller 0 was reset.
Info : cpu0: Core 0 was reset.
cpu0: Debug controller 0 was reset.
cpu0: Core 0 was reset.
Info : cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
Info : esp32: Core 0 was reset.
esp32: Core 0 was reset.
Info : esp32: Debug controller 1 was reset.
Info : esp32: Core 1 was reset.
esp32: Debug controller 1 was reset.
esp32: Core 1 was reset.
Info : Target halted. CPU0: PC=0x40000400 (active)
Info : Target halted. CPU1: PC=0x40000400
Target halted. CPU0: PC=0x40000400 (active)
Target halted. CPU1: PC=0x40000400
Hardware assisted breakpoint 1 at 0x400d1d98: file /Users/wolfgang/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp, line 24.
PlatformIO: Initialization completed
PlatformIO: Resume the execution to `debug_init_break = thb app_main`
PlatformIO: More configuration options -> http://bit.ly/pio-debug
Error: cpu0: Failed to write breakpoint instruction (-4)!
Error: cpu0: Failed to add SW breakpoint!
Error: can't add breakpoint: unknown reason
Warning:
Cannot insert breakpoint 2.
Cannot access memory at address 0x400d0c57

I’ve tried 3 times, also erased flash again to make sure.

At least we have set up proper environment for experimenting. Just to be sure, you didn’t enable flash encryption or secure boot?

Please see the edit on top valeros! Resetting the breakpoint did the trick!

I have just also tried debugging the big project and it seems to be working just fine :hugs:
Thank you very much for your amazing support!!

The only thing remains is python --version still reports 2.7.16, although since everything else works I can only imagine it’s a glitch :thinking:

Thanks to your work my debug session now works as well with the updated platform and core. The program comes to a halt at least at setup(). :+1:

It does not recognize my breakpoint set manually after it halted a few lines down, though. I will have to experiment a bit to find why, I think.

I cannot see why this is not stopping at the breakpoint:

tb 143
Temporary breakpoint 2 at 0x400d1360: file src\main.cpp, line 143.
{"token":45,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
c
Continuing.
{"token":51,"outOfBandRecord":[],"resultRecords":{"resultClass":"running","results":[]}}
Info : esp32: Debug controller 0 was reset.
Info : esp32: Core 0 was reset.
Info : esp32: Debug controller 1 was reset.
Info : esp32: Core 1 was reset.
esp32: Debug controller 0 was reset.
esp32: Core 0 was reset.
esp32: Debug controller 1 was reset.
esp32: Core 1 was reset.
Info : cpu0: Detected debug stubs @ 3ffc1e80
cpu0: Detected debug stubs @ 3ffc1e80

The program is running as if no breakpoint would have been there :confused:

[update]
Never mind. While writing this I think I found the solution myself: the code at line 143 was meant to initialize some global array and seemingly has been executed at compile time already. Optimization indeed :grin: