ESP-Prog debugger issue. No visible error. (Ubuntu)

Hi, I’m having a fairly similar situation to the OP of the below, but I’m using Ubuntu.

But of course, since I’m still writing this, it didn’t help my case.
I have uploaded a short video showing the issue here:

Here are my devices. I am not entirely sure if I have assigned them to the right ports in platformio.ini.

platformio.ini:

[env:esp wrover kit]
platform = espressif32
framework = arduino
board = esp-wrover-kit
monitor_speed = 115200
build_flags = -D LED_BUILTIN=2
upload_protocol = esp-prog
debug_tool = esp-prog
debug_init_break = tbreak setup
upload_port = /dev/ttyUSB0
monitor_port = /dev/ttyUSB0
debug_port = /dev/ttyUSB2

Blink.cpp:

#include <Arduino.h>

// Set LED_BUILTIN if it is not defined by Arduino framework
// #define LED_BUILTIN 2

void setup()
{
  // initialize LED digital pin as an output.
  Serial.begin(115200);
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop()
{
  Serial.write("hi");
  // turn the LED on (HIGH is the voltage level)
  digitalWrite(LED_BUILTIN, HIGH);
  // wait for a second
  delay(1000);
  // turn the LED off by making the voltage LOW
  digitalWrite(LED_BUILTIN, LOW);
  // wait for a second
  delay(1000);
}

Upload log:

> Executing task in folder 210330-011607-arduino-blink: platformio run --target upload --environment esp wrover kit <

Processing esp wrover kit (platform: espressif32; framework: arduino; board: esp-wrover-kit)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp-wrover-kit.html
PLATFORM: Espressif 32 (3.2.0) > Espressif ESP-WROVER-KIT
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) On-board (ftdi) 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.30000.201119 (3.0.0) 
 - tool-mkspiffs 2.230.0 (2.30) 
 - tool-openocd-esp32 2.1000.20201202 (10.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 release mode
Compiling .pio/build/esp wrover kit/src/Blink.cpp.o
Linking .pio/build/esp wrover kit/firmware.elf
Retrieving maximum program size .pio/build/esp wrover kit/firmware.elf
Checking size .pio/build/esp wrover kit/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 208242 bytes from 1310720 bytes)
Building .pio/build/esp wrover kit/firmware.bin
esptool.py v3.0
Configuring upload protocol...
AVAILABLE: esp-prog, espota, esptool, ftdi, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = esp-prog
Uploading .pio/build/esp wrover kit/firmware.bin
Open On-Chip Debugger  v0.10.0-esp32-20201202 (2020-12-02-17:38)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
debug_level: 1

adapter speed: 20000 kHz

WARNING: boards/esp32-wrover.cfg is deprecated, and may be removed in a future release.
         If your board is ESP32-WROVER-KIT, use board/esp32-wrover-kit-1.8v.cfg instead.
adapter speed: 5000 kHz

** Programming Started **
** Programming Finished **
** Verify Started **
** Verified OK **
** Programming Started **
** Programming Finished **
** Verify Started **
** Verified OK **
** Programming Started **
** Programming Finished **
** Verify Started **
** Verified OK **
** Programming Started **
** Programming Finished **
** Verify Started **
** Verified OK **
shutdown command invoked
==================================================================================== [SUCCESS] Took 12.87 seconds ====================================================================================

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

Debug log:

> Executing task in folder 210330-011607-arduino-blink: platformio debug <

Processing esp wrover kit (platform: espressif32; framework: arduino; board: esp-wrover-kit)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp-wrover-kit.html
PLATFORM: Espressif 32 (3.2.0) > Espressif ESP-WROVER-KIT
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) On-board (ftdi) 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.30000.201119 (3.0.0) 
 - tool-openocd-esp32 2.1000.20201202 (10.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
Compiling .pio/build/esp wrover kit/src/Blink.cpp.o
Linking .pio/build/esp wrover kit/firmware.elf
Retrieving maximum program size .pio/build/esp wrover kit/firmware.elf
Checking size .pio/build/esp wrover kit/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 208334 bytes from 1310720 bytes)
Building .pio/build/esp wrover kit/firmware.bin
esptool.py v3.0
==================================================================================== [SUCCESS] Took 2.30 seconds ====================================================================================

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

(Said I couldn’t post more than two links as a new user. Well who’s laughing noooow)

I have put the udev rules in the correct place.

This is the ESP32 variant I have.
https://www.aliexpress.com/item/32816065152.html?spm=a2g0s.9042311.0.0.7a024c4djhBsvM
I’ve tried a few board configs in platformio.ini that seemed to match this one. Not sure if it is a critical detail.

Wiring: https://photos.app.goo.gl/1SoV1PFVqnkFcQK5A

I’m sort of a newbie to embedded programming, so let me know if I have forgotten any information!
Oh, and I hope you don’t mind me tagging you, @maxgerhardt. But you seem knowledgeable!

Just to make sure there’s no issue with path escaping here or whatever, can you change the environment name to have no spaces? Like [env:esp-wrover-kit]

1 Like

It doesn’t seem to have any effect, but I did see the env name in the launch.json file. The debug controls still vanishes after success in the debug log.

I also don’t know if esp-wrover-kit is the actual board. I’m not sure how to tell, since I didn’t find it on the board nor the description where I bought it.

Upload log:

> Executing task in folder 210330-011607-arduino-blink: platformio run --target upload <

Processing esp-wrover-kit (platform: espressif32; framework: arduino; board: esp-wrover-kit)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp-wrover-kit.html
PLATFORM: Espressif 32 (3.2.0) > Espressif ESP-WROVER-KIT
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) On-board (ftdi) 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.30000.201119 (3.0.0) 
 - tool-mkspiffs 2.230.0 (2.30) 
 - tool-openocd-esp32 2.1000.20201202 (10.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 release mode
Compiling .pio/build/esp-wrover-kit/src/Blink.cpp.o
Generating partitions .pio/build/esp-wrover-kit/partitions.bin
Archiving .pio/build/esp-wrover-kit/libFrameworkArduinoVariant.a
Indexing .pio/build/esp-wrover-kit/libFrameworkArduinoVariant.a
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/Esp.cpp.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/FunctionalInterrupt.cpp.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/HardwareSerial.cpp.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/IPAddress.cpp.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/IPv6Address.cpp.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/MD5Builder.cpp.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/Print.cpp.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/Stream.cpp.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/StreamString.cpp.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/WMath.cpp.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/WString.cpp.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/base64.cpp.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/cbuf.cpp.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-adc.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-bt.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-cpu.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-dac.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-gpio.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-i2c.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-ledc.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-log.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-matrix.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-misc.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-psram.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-rmt.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-sigmadelta.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-spi.c.o
/home/ab/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-spi.c: In function 'spiTransferBytesNL':
/home/ab/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-spi.c:922:39: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
                 uint8_t * last_out8 = &result[c_longs-1];
                                       ^
/home/ab/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-spi.c:923:40: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-time.c.o
                 uint8_t * last_data8 = &last_data;
                                        ^
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-timer.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-touch.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-uart.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/libb64/cdecode.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/libb64/cencode.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/main.cpp.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/stdlib_noniso.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/wiring_pulse.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/wiring_shift.c.o
Archiving .pio/build/esp-wrover-kit/libFrameworkArduino.a
Indexing .pio/build/esp-wrover-kit/libFrameworkArduino.a
Linking .pio/build/esp-wrover-kit/firmware.elf
Retrieving maximum program size .pio/build/esp-wrover-kit/firmware.elf
Checking size .pio/build/esp-wrover-kit/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 208242 bytes from 1310720 bytes)
Building .pio/build/esp-wrover-kit/firmware.bin
esptool.py v3.0
Configuring upload protocol...
AVAILABLE: esp-prog, espota, esptool, ftdi, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = esp-prog
Uploading .pio/build/esp-wrover-kit/firmware.bin
Open On-Chip Debugger  v0.10.0-esp32-20201202 (2020-12-02-17:38)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
debug_level: 1

adapter speed: 20000 kHz

WARNING: boards/esp32-wrover.cfg is deprecated, and may be removed in a future release.
         If your board is ESP32-WROVER-KIT, use board/esp32-wrover-kit-1.8v.cfg instead.
adapter speed: 5000 kHz

** Programming Started **
** Programming Finished **
** Verify Started **
** Verified OK **
** Programming Started **
** Programming Finished **
** Verify Started **
** Verified OK **
** Programming Started **
** Programming Finished **
** Verify Started **
** Verified OK **
** Programming Started **
** Programming Finished **
** Verify Started **
** Verified OK **
shutdown command invoked
==================================================================================== [SUCCESS] Took 15.28 seconds ====================================================================================

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

Debug log:

> Executing task in folder 210330-011607-arduino-blink: platformio debug <

Processing esp-wrover-kit (platform: espressif32; framework: arduino; board: esp-wrover-kit)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp-wrover-kit.html
PLATFORM: Espressif 32 (3.2.0) > Espressif ESP-WROVER-KIT
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) On-board (ftdi) 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.30000.201119 (3.0.0) 
 - tool-openocd-esp32 2.1000.20201202 (10.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
Compiling .pio/build/esp-wrover-kit/src/Blink.cpp.o
Linking .pio/build/esp-wrover-kit/firmware.elf
Retrieving maximum program size .pio/build/esp-wrover-kit/firmware.elf
Checking size .pio/build/esp-wrover-kit/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 208334 bytes from 1310720 bytes)
Building .pio/build/esp-wrover-kit/firmware.bin
esptool.py v3.0
==================================================================================== [SUCCESS] Took 2.39 seconds ====================================================================================

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

Also, forgot launch.json:

// AUTOMATICALLY GENERATED FILE. PLEASE DO NOT MODIFY IT MANUALLY
//
// PIO Unified Debugger
//
// Documentation: https://docs.platformio.org/page/plus/debugging.html
// Configuration: https://docs.platformio.org/page/projectconf/section_env_debug.html

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "platformio-debug",
            "request": "launch",
            "name": "PIO Debug",
            "executable": "/home/ab/Documents/PlatformIO/Projects/210330-011607-arduino-blink/.pio/build/esp-wrover-kit/firmware.elf",
            "projectEnvName": "esp-wrover-kit",
            "toolchainBinDir": "/home/ab/.platformio/packages/toolchain-xtensa32/bin",
            "internalConsoleOptions": "openOnSessionStart",
            "preLaunchTask": {
                "type": "PlatformIO",
                "task": "Pre-Debug"
            }
        },
        {
            "type": "platformio-debug",
            "request": "launch",
            "name": "PIO Debug (skip Pre-Debug)",
            "executable": "/home/ab/Documents/PlatformIO/Projects/210330-011607-arduino-blink/.pio/build/esp-wrover-kit/firmware.elf",
            "projectEnvName": "esp-wrover-kit",
            "toolchainBinDir": "/home/ab/.platformio/packages/toolchain-xtensa32/bin",
            "internalConsoleOptions": "openOnSessionStart"
        }
    ]
}

Thank you for taking the time by the way. Much appreciated!

Are you running the latest PlatformIO core? (CLI and pio upgrade --dev)

In VSCode there should also be a tab “Debug Console” that should show how it tries to invoke OpenOCD to start the GDB server. Is there any output in there?

1 Like

No, but I just switched from 5.1.1 to 5.2.0a3 now with that command.

And no, there’s no output in the debug console. But I know there should be from here How to use the PlatformIO debugger on the ESP32 using an ESP-prog - YouTube

Is there anything OpenOCD related I should have downloaded that I missed? I do have GDB, as far as I know.

However, I just ran OpenOCD:

(base) ab@desktop:~/Documents/PlatformIO/Projects/210330-011607-arduino-blink$ openocd
Open On-Chip Debugger 0.10.0+dev-g14c0d0d-dirty (2021-02-05-20:41)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
embedded:startup.tcl:26: Error: Can't find openocd.cfg
in procedure 'script' 
at file "embedded:startup.tcl", line 26
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Error: Debug Adapter has to be specified, see "adapter driver" command
embedded:startup.tcl:26: Error: 
in procedure 'script' 
at file "embedded:startup.tcl", line 26

Does this tell you anything? I assume it’s just complaining about lack of input arguments.

My bad, I didn’t see this – this must be removed. The debug device is a USB device, not a seial port, PlatformIO will figure it out automatically. Does that change anything?

1 Like

No, it’s the same result without it. Does this help at all?


I remember joining my user to dialout and plugdev. Gonna check and see though.

edit: Yeah

(base) ab@desktop:~/Documents/PlatformIO/Projects/210330-011607-arduino-blink$ id -nG $USER
ab adm dialout cdrom sudo dip plugdev lpadmin lxd sambashare docker

Okay but then place keep the option out still.

Please execute the OpenOCD manually to see what OpenOCD says.

~/.platformio/packages/tool-openocd-esp32/bin/openocd -s ~/.platformio/packages/tool-openocd-esp32/scripts -f interface/ftdi/esp32_devkitj_v1.cfg -f board/esp32-wrover.cfg -c "adapter_khz 500"
1 Like
(base) ab@desktop:~/Documents/PlatformIO/Projects/210330-011607-arduino-blink$ ~/.platformio/packages/tool-openocd-esp32/bin/openocd -s ~/.platformio/packages/tool-openocd-esp32/scripts -f interface/ftdi/esp32_devkitj_v1.cfg -f board/esp32-wrover.cfg -c "adapter_khz 500"
Open On-Chip Debugger  v0.10.0-esp32-20201202 (2020-12-02-17:38)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
adapter speed: 20000 kHz

WARNING: boards/esp32-wrover.cfg is deprecated, and may be removed in a future release.
         If your board is ESP32-WROVER-KIT, use board/esp32-wrover-kit-1.8v.cfg instead.
Info : FreeRTOS creation
Info : FreeRTOS creation
adapter speed: 500 kHz

Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 500 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: Detected debug stubs @ 3ffc09b0
Info : Listening on port 3333 for gdb connections

It halts after printing about listening to 3333.

Interesting, this is fully correct. OpenOCD has created the debug server without problems. (Ctrl+C to exit)

Are you running VSCode in some sort of container, e.g. via Flatpack or Snap? Or did you install it natively on the machine via a .deb package or whatever?

1 Like

I can’t quite remember, but I ran this. I think snap is installed in a different place, but perhaps not if it’s in legacy mode.

(base) ab@desktop:~$ whereis code
code: /usr/bin/code /usr/share/code

I could try and install natively with a .deb

Seems to be installed with apt. But I do sometimes have to enter my password to use vscode.

Package: code
Version: 1.54.3-1615806378
Priority: optional
Section: devel
Maintainer: Microsoft Corporation <vscode-linux@microsoft.com>
Installed-Size: 282 MB
Provides: visual-studio-code
Depends: libnss3 (>= 2:3.26), gnupg, apt, libxkbfile1, libsecret-1-0, libgtk-3-0 (>= 3.10.0), libxss1, libgbm1
Conflicts: visual-studio-code
Replaces: visual-studio-code
Homepage: https://code.visualstudio.com/
Download-Size: 71,9 MB
APT-Manual-Installed: yes
APT-Sources: https://packages.microsoft.com/repos/vscode stable/main amd64 Packages
Description: Code editing. Redefined.
 Visual Studio Code is a new choice of tool that combines the simplicity of a code editor with what developers need for the core edit-build-debug cycle. See https://code.visualstudio.com/docs/setup/linux for installation instructions and FAQ.

N: There are 112 additional records. Please use the '-a' switch to see them.

Should be okay if installed via packet manager. On my Ubuntu Budgie machine I also use apt with the documented package source. I’ve only seen problems with VSCode if installed via snap install code since the container environment seems to be too restrictive for debugging / USB device access or whatever.

Can you please try the following as a proof-of-concept:

Replace

debug_tool = esp-prog

with

debug_tool = custom
debug_port = localhost:3333

then start the OpenOCD server again via the command above, then press start debugging in VSCode. If all goes well PlatformIO / VSCode should just connect to the now running GDB server and work.

1 Like

Nothing in debug console, and terminates like before.

[env:esp-wrover-kit]
platform = espressif32
framework = arduino
board = esp-wrover-kit

monitor_speed = 115200

build_flags = -D LED_BUILTIN=2

upload_protocol = esp-prog
debug_tool = custom
debug_port = localhost:3333

debug_init_break = tbreak setup

upload_port = /dev/ttyUSB0
monitor_port = /dev/ttyUSB0
> Executing task in folder 210330-011607-arduino-blink: platformio debug <

Processing esp-wrover-kit (platform: espressif32; framework: arduino; board: esp-wrover-kit)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp-wrover-kit.html
PLATFORM: Espressif 32 (3.2.0) > Espressif ESP-WROVER-KIT
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (custom) On-board (ftdi) 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.30000.201119 (3.0.0) 
 - tool-openocd-esp32 2.1000.20201202 (10.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
Compiling .pio/build/esp-wrover-kit/src/Blink.cpp.o
Linking .pio/build/esp-wrover-kit/firmware.elf
Retrieving maximum program size .pio/build/esp-wrover-kit/firmware.elf
Checking size .pio/build/esp-wrover-kit/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 208334 bytes from 1310720 bytes)
Building .pio/build/esp-wrover-kit/firmware.bin
esptool.py v3.0
=================================================================================== [SUCCESS] Took 2.29 seconds ===================================================================================

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

Did OpenOCD output more after

?

1 Like

No, I’m rerunning it again. It just stopped there:

(base) ab@desktop:~/Documents/PlatformIO/Projects/210330-011607-arduino-blink$ ~/.platformio/packages/tool-openocd-esp32/bin/openocd -s ~/.platformio/packages/tool-openocd-esp32/scripts -f interface/ftdi/esp32_devkitj_v1.cfg -f board/esp32-wrover.cfg -c "adapter_khz 500"
Open On-Chip Debugger  v0.10.0-esp32-20201202 (2020-12-02-17:38)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
adapter speed: 20000 kHz

WARNING: boards/esp32-wrover.cfg is deprecated, and may be removed in a future release.
         If your board is ESP32-WROVER-KIT, use board/esp32-wrover-kit-1.8v.cfg instead.
Info : FreeRTOS creation
Info : FreeRTOS creation
adapter speed: 500 kHz

Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 500 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: Detected debug stubs @ 3ffc09b0
Info : Listening on port 3333 for gdb connections


I also tried hitting enter. If it’s a gdb shell we should get (gdb) on a new line right?

For GDB yes, but this is OpenOCD and just starts the server, it’s not the GDB client itself. For that one would have to execute ~/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gdb .pio/build/esp-wrover-kit/firmware.elf followed by target extended-remote localhost:3333 to connect to OpenOCD. But that’s off-topic.

One last thing please, maybe it is able to start OpenOCD, but not GDB. What happens when you execute
just

~/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gdb

?

1 Like

Ah, gotcha. GDB seems to run alright though.

(base) ab@desktop:~/Documents/PlatformIO/Projects/210330-011607-arduino-blink$ ~/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gdb
GNU gdb (crosstool-NG crosstool-ng-1.22.0-97-gc752ad5) 7.10
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-build_pc-linux-gnu --target=xtensa-esp32-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) 
(base) ab@desktop:~/Documents/PlatformIO/Projects/210330-011607-arduino-blink$ ~/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gdb .pio/build/esp-wrover-kit/firmware.elf followed by target extended-remote localhost:3333
Excess command line arguments ignored. (by ...)
GNU gdb (crosstool-NG crosstool-ng-1.22.0-97-gc752ad5) 7.10
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-build_pc-linux-gnu --target=xtensa-esp32-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from .pio/build/esp-wrover-kit/firmware.elf...done.
/home/ab/Documents/PlatformIO/Projects/210330-011607-arduino-blink/followed: No such file or directory.
(gdb) 

Welp, seems I’ve posted too much…
image

Okay just for fun, what happens if you do this? (While OpenOCD is running in the background)

1 Like