Updated "How to" Set Up Eclipse for ESP32-C3 Built in JTAG Debugging

BrianP
Posts: 60
Joined: Mon Apr 13, 2020 1:48 pm

Updated "How to" Set Up Eclipse for ESP32-C3 Built in JTAG Debugging

Postby BrianP » Fri Jul 23, 2021 3:33 pm

The various devs have fixed many of the issues I created workarounds for in an earlier topic.

Great work!

The fixes are not yet part of esp-idf or the Eclipse plugin so I thought I would provide an updated how to.

1) Download and install esp-idf MASTER branch.
Run install and export.
Build a project for ESP32-C3 to make sure everything works

2) Install eclipse-cdt. I used the most recent 2020-06 version
In Eclipse
Help -> Install New Software
Add… ->
Name Espressif IDF Plugin for Eclipse
URL https://dl.espressif.com/dl/idf-eclipse ... ates/beta/ note this is the beta
Add
Select Espressif IDF from the list and install. Make sure to set up the tools if necessary (see https://github.com/espressif/idf-eclipse-plugin)


3) Locate the existing esp32-ocd directory associated with esp-idf, in my case that is
C:\Users\bjpic\.espressif\tools\openocd-esp32\v0.10.0-esp32-20210401\openocd-esp32

Go to https://github.com/espressif/openocd-esp32/releases/ and download the most recent release of
openocd-esp32. Unzip the file and copy the openocd-esp32 directory to the existing "bad" openocd-esp32
directory in .espressif\tools i.e. in my case

C:\Users\bjpic\.espressif\tools\openocd-esp32\v0.10.0-esp32-20210401\openocd-esp32

4) Open eclipse and create a project (i.e. blink).
Set up a debug configuration.
Run -> Debug Configuration. Tab Debugger
Target esp32c3
Board ESP32-C3 chip (via built-in USB-JTAG)

Actual executable is wrong! Browse to a path to
riscv32-esp-elf-gdb.exe

in my case that was
C:\Users\bjpic\.espressif\tools\riscv32-esp-elf\esp-2021r1-8.4.0\riscv32-esp-elf\bin\riscv32-esp-elf-gdb.exe

Apply.

5) I use the USB serial port as com so I edit the sdkconfig file
Component Settings -> ESP System Settings -> Channel for Console Output to USB Serial/JTAG Controller.

This directs printfs, etc., to the USB serial port.

Check the "on:" ESP-target setup/gear and make sure the right com port is selected. Note that only one com port is used by serial I/O and JTAG.

Note that if you do this debugging will appear to hang and crash if you do not have a serial terminal open!


6) Build the project. It should build, flash the device, and debug. Note that you do not have to disconnect the USB serial port terminal emulator in order to flash the device.

blipton
Posts: 2
Joined: Sat Nov 16, 2024 5:12 pm

Re: Updated "How to" Set Up Eclipse for ESP32-C3 Built in JTAG Debugging

Postby blipton » Mon Nov 18, 2024 2:43 am

It's been a few years, can anyone confirm that these instruction still work with the current versions
(Eclipse 4.33, OpenOcd 0.11, espressif 5.4 )

I can't get it to debug using the esp32-c3 built in jtag debugger. It's possible its something with the generated elf/bin (tool chain/options) or something with OpenOcd/eclipse setup.

ESP_kondalkolipaka
Posts: 199
Joined: Wed Jul 17, 2019 5:26 pm

Re: Updated "How to" Set Up Eclipse for ESP32-C3 Built in JTAG Debugging

Postby ESP_kondalkolipaka » Wed Dec 04, 2024 5:49 pm

Hello,

A lot has changed since our last post. Could you please describe the problem you’re having while debugging with the ESP32C3?

Please make sure to use ESP-IDF OpenOCD Debugging in the IDE to get started. You can find more instructions here
https://docs.espressif.com/projects/esp ... ur-project

Thanks!

BrianP
Posts: 60
Joined: Mon Apr 13, 2020 1:48 pm

Re: Updated "How to" Set UpESP_kondalkolipaka Eclipse for ESP32-C3 Built in JTAG Debugging

Postby BrianP » Thu Dec 05, 2024 3:42 pm

I thought I had posted a reply to your comments ESP_kondalkolipaka

Unfortunately, when I click on https://docs.espressif.com/projects/esp ... ur-project and compare the image of the Debug tab of launch configuration to actual Eclipse they look different. In particular, there is no "Flash Voltage", "Target" or "Board" option.

(I don't know how to post images here)

These are present on the on: setting (ribbon on top) but the example you show also shows an on: setting box.

I have, however made progress though I am not sure why. I changed my USB driver from libusbk (or something like that) to libusb0. For some reason I believe the JTAG controller now shows up as a MicroChip Tool.

I set up a debug configuration for Hello_World and debug opens but I can't get console IO, either through ESP-IDF Serial Monitor or through Putty. I do note that opening and closing Putty causes the message

Info : [esp32c3] Hart unexpectedly reset!
Info : [esp32c3] Reset cause (21) - (USB (UART) core reset)

Which suggests the debugger is aware of the USB serial connection.

I have set Channel for console output to USBSerial/JTAG.

I thought perhaps this was because the program had hit a breakpoint at app_main or something, however, the green "highlighting" for a breakpoint does not appear and only the "Suspend" and "Terminate" icons for debugging are enabled.

edit UPDATE

I decided it would make sense to rebuild the project in RUN to make sure it worked. It did. I then rebuilt in debug mode and had some issues (for reasons I do not understand) but I was able to get debug to not generate errors. Now the serial terminal says

ESP-ROM:esp32c3-api1-20210207
Build:Feb 7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0x0 (USB_BOOT)
Saved PC:0x20000824
wait usb download

edit Update 2

Now I get a window opening up No source available for "(gdb[9].proc[42000].threadGroup[i1],gdb[9].proc[42000].OSthread[1]).thread[1].frame[0]"

as well

Thanks

Who is online

Users browsing this forum: No registered users and 11 guests