Openocd: The term 'openocd' is not recognized

I have been trying to get started with debugging a board with an ESP32-S3-WROOM-1 micro.

I’m running platformio in VSCode on Windows 10, using the Arduino libraries.

As I understand it, this part has a built-in JTAG interface, which I’ve been trying to use.
Much of the advice I have seen online has referenced using OpenOCD. I have not been able to use OpenOCD, as I get “The term ‘openocd’ is not recognized as the name of a cmdlet. . .” error.

I see this whether I try to execute in the Powershell terminal or the PlatformIO Core CLI terminal. If I understand correctly, the Powershell terminal no longer has the correct environment variables, so I might expect it wouldn’t work there, but should in the CLI terminal.

I found this thread already:

To answer the questions there:
(1) I have a directory called “tool-openocd-esp32” at C:\Users<my name>.platformio\packages.
(2) A selection of the output of Advanced → Verbose Upload is:

PACKAGES:
 - framework-arduinoespressif32 @ 3.20014.231204 (2.0.14)
 - tool-esptoolpy @ 1.40501.0 (4.5.1)
 - tool-mkfatfs @ 2.0.1
 - tool-mklittlefs @ 1.203.210628 (2.3)
 - tool-mkspiffs @ 2.230.0 (2.30)
 - toolchain-riscv32-esp @ 8.4.0+2021r2-patch5
 - toolchain-xtensa-esp32s3 @ 8.4.0+2021r2-patch5

(It seems strange that the list of packages here is shorter than the packages I see in the directory referenced in item (1)).

(3) The platform.ini file is

[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
monitor_speed = 115200

[env:debug]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
;monitor_speed = 115200
debug_tool = esp-builtin ; use the USB-JTAG built into the ESP32-S3-WROOM.
build_type = debug
debug_speed = 5000
debug_init_break = tbreak setup ;https://www.youtube.com/watch?v=HGB9PI3IDL0 26:13
; these ports may change - check Device Manager to confirm
upload_port = COM7 ; this is the Jtag/serial debug port listed in Device Manager - *debug* code is loaded through this port
monitor_port = COM9 ; the ordinary serial port that is on the USB ON THE BA PCB

lib_deps =
adafruit/Adafruit INA219 @ ^1.2.3
adafruit/Adafruit BusIO@^1.16.0
adafruit/RTClib @ ^2.1.4

build_flags =
-D USER_SETUP_LOADED
-D ST7796_DRIVER
-D TFT_INVERSION_OFF
-D TFT_BL=48
-D TFT_BACKLIGHT_ON=HIGH
-D TFT_MISO=37
-D TFT_MOSI=35
-D TFT_SCLK=36
-D TFT_CS=38
-D TFT_DC=18
-D TFT_RST=-1
-D LOAD_GLCD
-D LOAD_FONT2
-D LOAD_FONT4
-D LOAD_FONT6
-D LOAD_FONT7
-D LOAD_FONT8
-D LOAD_GFXFF
-D LOAD_RLE
-D SMOOTH_FONT
-D USE_HSPI_PORT
-D SPI_FREQUENCY=80000000
-Wl,--print-memory-usage,-Map,output.map

I also tried the advice in the other thread of deleting the “tool-openocd-esp32” directory, then rebuilt - however, the “tool-openocd-esp32” directory did NOT reappear after rebuilding.

Questions:
(1) how do I get OpenOCD working?
(2) Am I correct that to use OpenOCD, that I need to use the Core CLI terminal, not Powershell?
(3) Why is the list of packages shown during Verbose Upload shorter than the list of packages I see in my …/.platformio/packages directory?

Upload is happening via esptoolpy, debugging is happening via OpenOCD.

What is the exact output when you open a PlatformIO Core CLI and execute

pio debug --interface=gdb -- -x .pioinit

?

I tried copying and pasting my output from your request, but I’m failing to post the response due to some error about “new users can only post two links.” How may I post the entire output?

For now, here are the last several lines of the output from pio debug --interface=gdb – -x .pioinit:

(I had to modify my platformio.ini file; I can re-post it if you need that).

[New Thread 1070550884]
[New Thread 1070549484]
[New Thread 1070536904]
[New Thread 1070542288]
[New Thread 1070535204]
[Switching to Thread 1070548084]

Thread 1 “main” hit Temporary breakpoint 1, app_main ()
at C:/Users/jason/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp:56
56 {
(gdb)

You should use code block formatting so that it’s not a link anymore. Use a line of tripple backticks and the top and bottom of the text

example text

But, that text above there is already shwoing that the debugging session has worked perfectly fine. So there is no problem after all?

Just exit GDB again (“quit” command) and use the regular Debug sidebar and the play button next to “PIO Debug”.

Yes, it does appear there is no problem now. I am finally able to start debugging.

I had not run the command you listed before, because I had not seen it in any of the any of the other references I looked at (and I am totally new to debugging firmware, so I’m starting at zero anyway).

Looks like I am on my way now, thank you for your prompt responses!