{"id":8189,"date":"2023-07-13T15:47:00","date_gmt":"2023-07-13T22:47:00","guid":{"rendered":"https:\/\/visualgdb.com\/w\/?p=8189"},"modified":"2025-09-09T19:26:19","modified_gmt":"2025-09-10T02:26:19","slug":"debugging-the-esp32-c6-device-via-jtag","status":"publish","type":"post","link":"https:\/\/visualgdb.com\/tutorials\/esp32\/esp32-c6\/","title":{"rendered":"Debugging the ESP32-C6 device via JTAG"},"content":{"rendered":"<p>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-&gt;VisualGDB-&gt;Manage VisualGDB Packages.<\/p>\n<ol>\n<li>Start Visual Studio and open the VisualGDB ESP32 IDF\/ADF Project Wizard:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2023\/07\/01-newprj-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8190\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2023\/07\/01-newprj-1.png\" alt=\"\" width=\"1014\" height=\"675\" \/><\/a><\/li>\n<li>Enter the name and location for your project: <a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2023\/07\/02-prjname-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8191\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2023\/07\/02-prjname-1.png\" alt=\"\" width=\"1014\" height=\"675\" \/><\/a><\/li>\n<li>Select &#8220;Create a new project -&gt; CMake (recommended)&#8221;: <a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2023\/07\/03-cmake-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8192\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2023\/07\/03-cmake-1.png\" alt=\"\" width=\"856\" height=\"693\" \/><\/a><\/li>\n<li>On the next page select the ESP32 toolchain and pick the ESP32C6 device: <a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2023\/07\/04-target.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8193\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2023\/07\/04-target.png\" alt=\"\" width=\"856\" height=\"693\" \/><\/a><strong>Update:<\/strong> For better compatibility with the latest ESP32 tools, we recommend selecting the <a href=\"https:\/\/visualgdb.com\/documentation\/espidf\/consolidated\/\">consolidated toolchain<\/a> instead.<\/li>\n<li>Select the sample project you would like to clone. In this tutorial we will use the most basic &#8220;Blinking LED&#8221; sample:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2023\/07\/05-blink.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8194\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2023\/07\/05-blink.png\" alt=\"\" width=\"856\" height=\"693\" \/><\/a><\/li>\n<li>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:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2023\/07\/usb.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8201\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2023\/07\/usb.jpg\" alt=\"\" width=\"1280\" height=\"563\" \/><\/a><\/li>\n<li>VisualGDB will detect the on-board JTAG interface and will suggest using it. Press &#8220;Test&#8221; to verify that the device responds via JTAG: <a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2023\/07\/06-debug.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8195\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2023\/07\/06-debug.png\" alt=\"\" width=\"856\" height=\"693\" \/><\/a><\/li>\n<li>If the testing fails, make sure you are using the latest OpenOCD (2023-07-13 or later):<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2023\/07\/07-test.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8196\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2023\/07\/07-test.png\" alt=\"\" width=\"786\" height=\"713\" \/><\/a>If the device test warns that all device registers are 0, but otherwise succeeds, you can safely ignore the warning and proceed.<\/li>\n<li>Press &#8220;Finish&#8221; to create the project. Once it is created, press Ctrl-Shift-B to build it:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2023\/07\/08-blink.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8197\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2023\/07\/08-blink.png\" alt=\"\" width=\"1220\" height=\"841\" \/><\/a><\/li>\n<li>Set a breakpoint on the call to <strong>blink_led()<\/strong> and press F5 to begin debugging. VisualGDB will automatically program the FLASH memory and start the program, triggering the breakpoint: <a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2023\/07\/09-bkpt.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8198\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2023\/07\/09-bkpt.png\" alt=\"\" width=\"1220\" height=\"841\" \/><\/a><\/li>\n<li>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:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2023\/07\/10-tick.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8199\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2023\/07\/10-tick.png\" alt=\"\" width=\"1220\" height=\"841\" \/><\/a><\/li>\n<li>You can use the VisualGDB Project Properties window to edit various project settings. E.g. you can conveniently edit the ESP-IDF configuration values: <a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2023\/07\/11-settings.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8200\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2023\/07\/11-settings.png\" alt=\"\" width=\"1102\" height=\"771\" \/><\/a><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial shows how to use VisualGDB to create, build and debug a basic project for the ESP32-C6 device. Before<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[89],"tags":[138],"_links":{"self":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/8189"}],"collection":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/comments?post=8189"}],"version-history":[{"count":3,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/8189\/revisions"}],"predecessor-version":[{"id":9032,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/8189\/revisions\/9032"}],"wp:attachment":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/media?parent=8189"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/categories?post=8189"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/tags?post=8189"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}