ESP32: Debugging not possible (FTDI FT2232HL/Linux)

Hello there,
I am trying to set up debugging the esp32 Wemos D1 mimi with a FTDI FT2232HL minimodule on ubuntu.
I set it up on windows successfully times ago.

I freshly installed ubuntu, Visual Studio code and PlatformIO via the extension manager.
When hitting Debugging it builds the project and acts if it is debugging (meaning there is the Restart and Stop button on top of the window) and stops then, after successful building.
As well it does not hit any breakpoint.
The program itself just consists of two int variables which get printed on Serial.

Build terminal log:

> Executing task in folder NussBot_DoorClient_2: platformio debug <

Processing wemos_d1_mini32 (platform: espressif32; board: wemos_d1_mini32; framework: arduino)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/wemos_d1_mini32.html
PLATFORM: Espressif 32 (3.3.0) > WeMos D1 MINI ESP32
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (minimodule) 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.10006.210326 (1.0.6) 
 - tool-esptoolpy 1.30100.210531 (3.1.0) 
 - toolchain-xtensa32 2.50200.97 (5.2.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 28 compatible libraries
Scanning dependencies...
No dependencies
Building in debug mode
Retrieving maximum program size .pio/build/wemos_d1_mini32/firmware.elf
Checking size .pio/build/wemos_d1_mini32/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   4.1% (used 13480 bytes from 327680 bytes)
Flash: [==        ]  15.9% (used 208306 bytes from 1310720 bytes)
============================================================================ [SUCCESS] Took 0.89 seconds ============================================================================

Terminal will be reused by tasks, press any key to close it.

platformio.ini:
; PlatformIO Project Configuration File

;

; Build options: build flags, source filter

; Upload options: custom upload port, speed and extra flags

; Library options: dependencies, extra library storages

; Advanced options: extra scripting

;

; Please visit documentation for the other options and examples

; https://docs.platformio.org/page/projectconf.html

[env:wemos_d1_mini32]

platform = espressif32

board = wemos_d1_mini32

framework = arduino

upload_port = /dev/ttyUSB0

upload_speed = 115200

debug_tool = minimodule

debug_init_break = tbreak setup

;debug_server = openocd -f /usr/share/openocd/scripts/interface/ft2232.cfg

Is there any output in hte “Debug Console” tab of PlatformIO? What happens when you open a CLI and execute

pio debug --interface=gdb -x .pioinit

?

Thanks for your reply, Indeed I totally oversaw that debug console tab.
undefinedpiogdb: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
So I guess Ill start searching for that dep.

Using cli here is really weird, as it states that pio is not installed.
So I went ahead and let apt isntall it, then executing your command.

****************************************************************************************************************************************************************************************************
Obsolete PIO Core v4.3.4 is used (previous was 5.1.1)
Please remove multiple PIO Cores from a system:
https://docs.platformio.org/page/faq.html#multiple-pio-cores-in-a-system
****************************************************************************************************************************************************************************************************
Error: Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/platformio/__main__.py", line 109, in main
    cli()  # pylint: disable=no-value-for-parameter
  File "/usr/lib/python3/dist-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/platformio/commands/__init__.py", line 44, in invoke
    return super(PlatformioCLI, self).invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/lib/python3/dist-packages/platformio/commands/debug/command.py", line 76, in cli
    debug_options = helpers.validate_debug_options(ctx, env_options)
  File "/usr/lib/python3/dist-packages/platformio/commands/debug/helpers.py", line 131, in validate_debug_options
    platform.get_package_dir(server_package) if server_package else None
  File "/usr/lib/python3/dist-packages/platformio/managers/platform.py", line 365, in get_package_dir
    return self.pm.get_package_dir(name, version)
  File "/usr/lib/python3/dist-packages/platformio/managers/package.py", line 415, in get_package_dir
    manifest = self.get_package(name, requirements, url)
  File "/usr/lib/python3/dist-packages/platformio/managers/package.py", line 384, in get_package
    for manifest in self.get_installed():
  File "/usr/lib/python3/dist-packages/platformio/managers/package.py", line 374, in get_installed
    manifest = self.load_manifest(pkg_dir)
  File "/usr/lib/python3/dist-packages/platformio/managers/package.py", line 347, in load_manifest
    manifest = ManifestParserFactory.new_from_file(manifest_path).as_dict()
  File "/usr/lib/python3/dist-packages/platformio/package/manifest/parser.py", line 73, in new_from_file
    return ManifestParserFactory.new(
  File "/usr/lib/python3/dist-packages/platformio/package/manifest/parser.py", line 123, in new
    return cls(contents, remote_url, package_dir)
  File "/usr/lib/python3/dist-packages/platformio/package/manifest/parser.py", line 136, in __init__
    self._data = self.normalize_repository(self._data)
  File "/usr/lib/python3/dist-packages/platformio/package/manifest/parser.py", line 174, in normalize_repository
    url = (data.get("repository") or {}).get("url")
AttributeError: 'str' object has no attribute 'get'

============================================================

An unexpected error occurred. Further steps:

* Verify that you have the latest version of PlatformIO using
  `pip install -U platformio` command

* Try to find answer in FAQ Troubleshooting section
  https://docs.platformio.org/page/faq.html

* Report this problem to the developers
  https://github.com/platformio/platformio-core/issues

============================================================

Seems that pio there is not updated.
Ill look for the .so.5 file before Ill take care about that cli pio.

EDIT:
I installed that dep and now I get a new error about ocd
Reading symbols from /home/marcel/Documents/PlatformIO/Projects/NussBot_DoorClient_2/.pio/build/wemos_d1_mini32/firmware.elf…

done.

PlatformIO Unified Debugger -> http://bit.ly/pio-debug

PlatformIO: debug_tool = minimodule

PlatformIO: Initializing remote target...

Open On-Chip Debugger v0.10.0-esp32-20210401 (2021-04-01-15:45)

Licensed under GNU GPL v2

For bug reports, read

http://openocd.org/doc/doxygen/bugs.html

WARNING: boards/esp-wroom-32.cfg is deprecated, and may be removed in a future release.

adapter speed: 5000 kHz

Info : tcl server disabled

Info : telnet server disabled

Error: no device found

Error: unable to open ftdi device with vid 0403, pid 6010, description 'FT2232H MiniModule', serial '*' at bus location '*'

I updated my platform.ini with those properties:
debug_port = /dev/ttyUSB1

debug_speed = 200

I changed the description in minimodule.cfg to the one given when I look up the device in USB-Devices and now it seems to work.
Unfortunately i have to take care of Guru meditation errors first and then I can start debugging.

Libncurses5 is missing per default on recent distros, known per Problem with esp32 debug for Ubuntu. (undefined symbol: _Py_ZeroStruct) - #13 by maxgerhardt.

That is not good - you really want to make sure you’re using the 5.x core. Follow the given link there to try to remove other installations of PlatformIO from the system. You usually only want the PIO version that is installed with the VSCode PIO extension (and update PATH to that one) and not any you install via pip system-wide (becauses PlatformIO’s python packet requirements might get in the way – the PIO extension installs it in a nice isolated pyenv).

Your debug device is a USB device, not a tty port. Remote that line. But it shouldn’t actually have influence anything. The main culprit is that OpenOCD couldn’t find the device.

Are you sure that’s the right way? Maybe you selected a wrong debug_tool and a different one would use the right .cfg with the USB device you actuall have.

Remember that you can decode these exceptions better with monitor_filter and build_type.

; enable exception decoding when seen on the serial
monitor_filters = esp32_exception_decoder
; force debug mode during normal build & upload (makes backtrace symbols available)
build_type = debug

Wow Max, thanks a lot for that elaborated answer!
I will try to apply the things you mentioned in the coming days.
As well, Ive seen your thread regarding debugging and ubuntu, but I couldnt relate something usefull from it then.

Nevertheless, thanks again and Ill surely provide feedback soonish!
PS: And surely you will already have figured out, Im not a linux pro :wink:

I applied the things you mentioned and cleaned my platform.ini and the pio installations, meaning removing the deprecated one and addding the vsc one to path.

Now debug console tells me there is a problem with my FTDI debugger, checked it again but all seems right.
I reuploaded the project to the esp via normal usb serial, problem still exists:

Processing wemos_d1_mini32 (platform: espressif32; board: wemos_d1_mini32; framework: arduino)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/wemos_d1_mini32.html
PLATFORM: Espressif 32 (3.3.0) > WeMos D1 MINI ESP32
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (minimodule) 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.10006.210326 (1.0.6)
 - tool-esptoolpy 1.30100.210531 (3.1.0)
 - toolchain-xtensa32 2.50200.97 (5.2.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 33 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <Adafruit ST7735 and ST7789 Library> 1.7.3
|   |-- <Adafruit GFX Library> 1.10.10
|   |   |-- <SPI> 1.0
|   |   |-- <Adafruit BusIO> 1.8.2
|   |   |   |-- <Wire> 1.0.1
|   |   |   |-- <SPI> 1.0
|   |   |-- <Wire> 1.0.1
|   |-- <SPI> 1.0
|-- <Adafruit GFX Library> 1.10.10
|   |-- <SPI> 1.0
|   |-- <Adafruit BusIO> 1.8.2
|   |   |-- <Wire> 1.0.1
|   |   |-- <SPI> 1.0
|   |-- <Wire> 1.0.1
|-- <Adafruit BusIO> 1.8.2
|   |-- <Wire> 1.0.1
|   |-- <SPI> 1.0
Building in debug mode
Retrieving maximum program size .pio/build/wemos_d1_mini32/firmware.elf
Checking size .pio/build/wemos_d1_mini32/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   4.1% (used 13552 bytes from 327680 bytes)
Flash: [==        ]  16.2% (used 212366 bytes from 1310720 bytes)
========================= [SUCCESS] Took 1.31 seconds =========================
Reading symbols from /home/marcel/Documents/PlatformIO/Projects/NussBot_DoorClient_2/.pio/build/wemos_d1_mini32/firmware.elf...
done.
PlatformIO Unified Debugger -> http://bit.ly/pio-debug
PlatformIO: debug_tool = minimodule
PlatformIO: Initializing remote target...
Open On-Chip Debugger  v0.10.0-esp32-20210401 (2021-04-01-15:45)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
WARNING: boards/esp-wroom-32.cfg is deprecated, and may be removed in a future release.
adapter speed: 200 kHz

Info : tcl server disabled
Info : telnet server disabled
Info : clock speed 200 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.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
Info : accepting 'gdb' connection from pipe
Warn : No symbols for FreeRTOS!
Info : esp32.cpu0: Target halted, PC=0x40009056, debug_reason=00000000
Info : Set GDB target to 'esp32.cpu0'
Info : esp32.cpu0: Target halted, PC=0x40091C2A, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 52 KB
Info : Flash mapping 1: 0x20018 -> 0x400d0018, 101 KB
Error: ftdi device did not accept all data: 0, tried 16381
Error: unable to purge ftdi rx buffers: LIBUSB_ERROR_NO_DEVICE
openocd: ../src/jtag/drivers/mpsse.c:852: mpsse_flush: Assertion `ctx->write_count == 0 && ctx->read_count == 0' failed.
Aborted (core dumped)
.pioinit:11: Error in sourced command file:
Remote connection closed

Looks like your debugger device gets thrown off the USB bus during init? Check power supply or use a different USB port. Make sure the debugger and the ESP32 have GND connected together.

And another post due to letter limit.
Retried simply by pressing the debugging button and now it has gone further with a new error, “FTDI device did not accept all data:0”:

Processing wemos_d1_mini32 (platform: espressif32; board: wemos_d1_mini32; framework: arduino)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/wemos_d1_mini32.html
PLATFORM: Espressif 32 (3.3.0) > WeMos D1 MINI ESP32
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (minimodule) 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.10006.210326 (1.0.6)
 - tool-esptoolpy 1.30100.210531 (3.1.0)
 - toolchain-xtensa32 2.50200.97 (5.2.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 33 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <Adafruit ST7735 and ST7789 Library> 1.7.3
|   |-- <Adafruit GFX Library> 1.10.10
|   |   |-- <SPI> 1.0
|   |   |-- <Adafruit BusIO> 1.8.2
|   |   |   |-- <Wire> 1.0.1
|   |   |   |-- <SPI> 1.0
|   |   |-- <Wire> 1.0.1
|   |-- <SPI> 1.0
|-- <Adafruit GFX Library> 1.10.10
|   |-- <SPI> 1.0
|   |-- <Adafruit BusIO> 1.8.2
|   |   |-- <Wire> 1.0.1
|   |   |-- <SPI> 1.0
|   |-- <Wire> 1.0.1
|-- <Adafruit BusIO> 1.8.2
|   |-- <Wire> 1.0.1
|   |-- <SPI> 1.0
Building in debug mode
Retrieving maximum program size .pio/build/wemos_d1_mini32/firmware.elf
Checking size .pio/build/wemos_d1_mini32/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   4.1% (used 13552 bytes from 327680 bytes)
Flash: [==        ]  16.2% (used 212366 bytes from 1310720 bytes)
========================= [SUCCESS] Took 1.23 seconds =========================
Reading symbols from /home/marcel/Documents/PlatformIO/Projects/NussBot_DoorClient_2/.pio/build/wemos_d1_mini32/firmware.elf...
done.
PlatformIO Unified Debugger -> http://bit.ly/pio-debug
PlatformIO: debug_tool = minimodule
PlatformIO: Initializing remote target...
Open On-Chip Debugger  v0.10.0-esp32-20210401 (2021-04-01-15:45)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
WARNING: boards/esp-wroom-32.cfg is deprecated, and may be removed in a future release.
adapter speed: 200 kHz

Info : tcl server disabled
Info : telnet server disabled
Info : clock speed 200 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.cpu0: Target halted, PC=0x40009056, debug_reason=00000001
Info : accepting 'gdb' connection from pipe
Warn : No symbols for FreeRTOS!
Info : esp32.cpu0: Target halted, PC=0x40091C2A, debug_reason=00000001
Info : Set GDB target to 'esp32.cpu0'
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 52 KB
Info : Flash mapping 1: 0x20018 -> 0x400d0018, 101 KB
Info : esp32.cpu0: Target halted, PC=0x40091C2A, debug_reason=00000001
Info : Auto-detected flash bank 'esp32.cpu0.flash' size 4096 KB
Info : Using flash bank 'esp32.cpu0.flash' size 4096 KB
Info : esp32.cpu0: Target halted, PC=0x40091C2A, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 52 KB
Info : Flash mapping 1: 0x20018 -> 0x400d0018, 101 KB
Info : Using flash bank 'esp32.cpu0.irom' size 104 KB
Info : esp32.cpu0: Target halted, PC=0x40091C2A, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 52 KB
Info : Flash mapping 1: 0x20018 -> 0x400d0018, 101 KB
Info : Using flash bank 'esp32.cpu0.drom' size 56 KB
Info : New GDB Connection: 1, Target esp32.cpu0, state: halted
Warn : negative reply, retrying
Warn : acknowledgment received, but no packet pending
0x40009056 in ?? ()
Error: Too large number of threads 3031807075!
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.
esp32.cpu0: Debug controller was reset.
esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
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
esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
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=0x40091C2A, debug_reason=00000001
esp32.cpu0: Target halted, PC=0x40091C2A, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 52 KB
Info : Flash mapping 1: 0x20018 -> 0x400d0018, 101 KB
Flash mapping 0: 0x10020 -> 0x3f400020, 52 KB
Flash mapping 1: 0x20018 -> 0x400d0018, 101 KB
Info : esp32.cpu0: Target halted, PC=0x40091C2A, debug_reason=00000001
esp32.cpu0: Target halted, PC=0x40091C2A, debug_reason=00000001
Info : Auto-detected flash bank 'esp32.cpu1.flash' size 4096 KB
Info : Using flash bank 'esp32.cpu1.flash' size 4096 KB
Auto-detected flash bank 'esp32.cpu1.flash' size 4096 KB
Using flash bank 'esp32.cpu1.flash' size 4096 KB
** Programming Started **
** Programming Started **
Info : esp32.cpu0: Target halted, PC=0x40091C2A, debug_reason=00000001
esp32.cpu0: Target halted, PC=0x40091C2A, debug_reason=00000001
Info : PROF: Data transferred in 1911.68 ms @ 10.462 KB/s
PROF: Data transferred in 1911.68 ms @ 10.462 KB/s
Info : esp32.cpu0: Target halted, PC=0x40091C2A, debug_reason=00000001
esp32.cpu0: Target halted, PC=0x40091C2A, debug_reason=00000001
** Programming Finished **
** Programming Finished **
** Verify Started **
** Verify Started **
Info : PROF: Data transferred in 1631.61 ms @ 10.2372 KB/s
PROF: Data transferred in 1631.61 ms @ 10.2372 KB/s
Info : esp32.cpu0: Target halted, PC=0x40091C2A, debug_reason=00000001
esp32.cpu0: Target halted, PC=0x40091C2A, 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 : esp32.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
esp32.cpu0: Debug controller was reset.
esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
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
esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
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
** Programming Started **
** Programming Started **
Info : esp32.cpu0: Target halted, PC=0x40091C2A, debug_reason=00000001
esp32.cpu0: Target halted, PC=0x40091C2A, debug_reason=00000001
Info : PROF: Data transferred in 368.868 ms @ 10.844 KB/s
PROF: Data transferred in 368.868 ms @ 10.844 KB/s
Info : esp32.cpu0: Target halted, PC=0x40091C2A, debug_reason=00000001
esp32.cpu0: Target halted, PC=0x40091C2A, debug_reason=00000001
** Programming Finished **
** Programming Finished **
** Verify Started **
** Verify Started **
Info : PROF: Data transferred in 301.051 ms @ 9.96509 KB/s
PROF: Data transferred in 301.051 ms @ 9.96509 KB/s
Info : esp32.cpu0: Target halted, PC=0x40091C2A, debug_reason=00000001
esp32.cpu0: Target halted, PC=0x40091C2A, 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 : esp32.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
esp32.cpu0: Debug controller was reset.
esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
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
esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
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
** Programming Started **
** Programming Started **
Info : esp32.cpu0: Target halted, PC=0x40091C2A, debug_reason=00000001
esp32.cpu0: Target halted, PC=0x40091C2A, debug_reason=00000001
Info : PROF: Data transferred in 751.241 ms @ 10.649 KB/s
PROF: Data transferred in 751.241 ms @ 10.649 KB/s
Info : esp32.cpu0: Target halted, PC=0x40091C2A, debug_reason=00000001
esp32.cpu0: Target halted, PC=0x40091C2A, debug_reason=00000001
** Programming Finished **
** Programming Finished **
** Verify Started **
** Verify Started **
Info : PROF: Data transferred in 782.133 ms @ 10.2284 KB/s
PROF: Data transferred in 782.133 ms @ 10.2284 KB/s
Info : esp32.cpu0: Target halted, PC=0x40091C2A, debug_reason=00000001
esp32.cpu0: Target halted, PC=0x40091C2A, 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 : esp32.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
esp32.cpu0: Debug controller was reset.
esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
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
esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
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
** Programming Started **
** Programming Started **
Info : esp32.cpu0: Target halted, PC=0x40091C2A, debug_reason=00000001
esp32.cpu0: Target halted, PC=0x40091C2A, debug_reason=00000001
Info : PROF: Data transferred in 20063.6 ms @ 10.367 KB/s
PROF: Data transferred in 20063.6 ms @ 10.367 KB/s
Info : esp32.cpu0: Target halted, PC=0x40091C2A, debug_reason=00000001
esp32.cpu0: Target halted, PC=0x40091C2A, debug_reason=00000001
** Programming Finished **
** Programming Finished **
** Verify Started **
** Verify Started **
Error: ftdi device did not accept all data: 0, tried 16384
Error: unable to purge ftdi rx buffers: LIBUSB_ERROR_NO_DEVICE
ftdi device did not accept all data: 0, tried 16384
openocd: ../src/jtag/drivers/mpsse.c:852: mpsse_flush: Assertion `ctx->write_count == 0 && ctx->read_count == 0' failed.
unable to purge ftdi rx buffers: LIBUSB_ERROR_NO_DEVICE
Aborted (core dumped)
.pioinit:15: Error in sourced command file:
Remote connection closed

Again, likely USB port issue. Cannot debug esp32 - #3 by maxgerhardt, Rare assertion error when trying to flash memory · Issue #10 · riscv/riscv-openocd · GitHub

I added another 5V power line to the FTDI debugger and now it goes further.
Tho, after a while it halts and I may select step over and other debugging related commands, but it does not show me the line, nor local variables, but global ones, really weird.