How to debug an ESP32 with an Arduino project and GDB?

× Not what you are looking for? Did you want USB/WiFi debug, trace and performance monitoring instead?

The ESP-WROOM-32 Module has been adopted many boards, all of which can now be debugged using an External Hardware debugger, directly in Visual Studio, with vMicro!

External Debug Interface: JTAG

To see a list of all debuggers currently supported within vMicro please click here.

NOTE: If using External JTAG debugging any SDCard functionality will need to be removed as this conflicts with the JTAG pin assignments.
           All boards support the vMicro Software Debugger which only requires the Serial interface to work


External Debugger Connections

To connect your JTAG debugger to the ESP32 board you will need to connect the below pins:

ESP32 JTAG Connections

 

Olimex Tiny Connected to ESP32 JLink Connected to ESP32 ESPPROG Connected to ESP32
Olimex Tiny Connected to ESP32 JLink to ESP32 Wiring               ESPPROG to ESP32 Wiring
F2232H Dual Connected to ESP32 ESP Devkit to External ESP32
F2232H Dual to ESP32 Wiring               ESP Devkit Hijack to External ESP32 Wiring
NOTE: Pinouts for connections differ between boards - See Images & Links

 

Then you will also need to connect your Debugger to the PC on one USB port, and the ESP32 on another USB Port

 

Software Setup

There is also a video guide to the software and driver setup described below

Ensure you have Visual Studio and the vMicro Extension Installed

Open your Sketch and select the Debug > Hardware, and the relevant Debugger you have available

Visual Studio Toolbar Selections for ESP32

NOTE - The vMicro > Debugger > Compiler Optimization MUST be set to "No Optimization" for this board to function with the debugger

You may need to install an additional USB Driver on Interface 0 of your debugger to allow it to function with this software - check in the debugger list here

Remember - If you have installed a new driver, you may have to do it again if you connect the debugger to a different USB port next time.....

 

Start Debugger

  1. Ensure you have the Debug Configuration selected from the Configuration Manager Window
  2. If you know where you want the first breakpoint in your code, add it now
  3. To start the debugging process, you can either:
    • "Debug > Attach to Process" button if your code has already been uploaded to the ESP32 board
    • "Debug > Start Debugging" if your code has not been uploaded
ESP32 Debugging in vMicro and Visual Studio

Congratulations - you should have the debugger running, and further windows can be opened from the "Debug > Windows" menu once you have started debugging

 

There is also a video guide on this below: