Successful ESP32-C3 Built In USB JTAG!
Posted: Mon May 24, 2021 5:24 pm
I have been struggling for some time with two issues. One is that Eclipse had numerous unresolved inclusions. I don't know why but that has disappeared for the moment. It may be that you simply have to wait after a build.
I followed the instructions kindly provided by ESP_Sprite here https://www.esp32.com/viewtopic.php?f=12&t=21007#p76800 to configure my ESP32-C3 Devkit for USB. This is tricky because the resistors are so small, but I got it done.
Thereafter I could compile and upload code via the built in USB. Occasionally, for some reason, I had to manually reset but otherwise it was fine.
I had many challenges getting OpenOCD to work. I was able to use this tool https://visualgdb.com/UsbDriverTool/ to install the libusb-WinUSB driver, which allowed me to connect to the target board.
After much trial and error, I noticed that in the In Debug Configurations, Debugger tab
GDB Client Setup/Actual Executable was
<user> .espressif\tools\xtensa-esp32-elf\esp-2020r3-8.4.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-gdb.exe
I modified this to
<user> .espressif\tools\riscv32-esp-elf\1.24.0.123_64eb9ff-8.4.0\riscv32-esp-elf\bin\riscv32-esp-elf-gdb.exe
I then got an error which I was able to determine was because GDB expected a 64 bit CPU. This is because the default is 64 bit to you need to include
GDB Client Setup/Other Commands
set arch riscv:rv32
After apply, I can now debug
I followed the instructions kindly provided by ESP_Sprite here https://www.esp32.com/viewtopic.php?f=12&t=21007#p76800 to configure my ESP32-C3 Devkit for USB. This is tricky because the resistors are so small, but I got it done.
Thereafter I could compile and upload code via the built in USB. Occasionally, for some reason, I had to manually reset but otherwise it was fine.
I had many challenges getting OpenOCD to work. I was able to use this tool https://visualgdb.com/UsbDriverTool/ to install the libusb-WinUSB driver, which allowed me to connect to the target board.
After much trial and error, I noticed that in the In Debug Configurations, Debugger tab
GDB Client Setup/Actual Executable was
<user> .espressif\tools\xtensa-esp32-elf\esp-2020r3-8.4.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-gdb.exe
I modified this to
<user> .espressif\tools\riscv32-esp-elf\1.24.0.123_64eb9ff-8.4.0\riscv32-esp-elf\bin\riscv32-esp-elf-gdb.exe
I then got an error which I was able to determine was because GDB expected a 64 bit CPU. This is because the default is 64 bit to you need to include
GDB Client Setup/Other Commands
set arch riscv:rv32
After apply, I can now debug