Debugging the ESP32-C6 device via JTAG

This tutorial shows how to use VisualGDB to create, build and debug a basic project for the ESP32-C6 device. Before you begin, make sure you install the latest ESP32 toolchain and the ESP32 Debug Methods package via Tools->VisualGDB->Manage VisualGDB Packages.

  1. Start Visual Studio and open the VisualGDB ESP32 IDF/ADF Project Wizard:
  2. Enter the name and location for your project:
  3. Select “Create a new project -> CMake (recommended)”:
  4. On the next page select the ESP32 toolchain and pick the ESP32C6 device: If your toolchain does not show the ESP32C6 device, or uses a lower ESP-IDF version than 5.1, you are likely using an older toolchain. You can always download the latest toolchain via the VisualGDB Package Manager or on this page.
  5. Select the sample project you would like to clone. In this tutorial we will use the most basic “Blinking LED” sample:
  6. The ESP32C6-WROOM module shown in this tutorial has an on-board JTAG. Connect it to the USB port, and optionally connect the USB-to-UART port as well:
  7. VisualGDB will detect the on-board JTAG interface and will suggest using it. Press “Test” to verify that the device responds via JTAG:
  8. If the testing fails, make sure you are using the latest OpenOCD (2023-07-13 or later):If the device test warns that all device registers are 0, but otherwise succeeds, you can safely ignore the warning and proceed.
  9. Press “Finish” to create the project. Once it is created, press Ctrl-Shift-B to build it:
  10. Set a breakpoint on the call to blink_led() and press F5 to begin debugging. VisualGDB will automatically program the FLASH memory and start the program, triggering the breakpoint:
  11. ESP32-C6 is based on the RISC-V core that supports background memory reads. Hence, you can use the Live Watch window to view the state of various variables without stopping the target:
  12. You can use the VisualGDB Project Properties window to edit various project settings. E.g. you can conveniently edit the ESP-IDF configuration values: