esp32 debugging. GDB and single stepping.
Posted: Fri Aug 21, 2026 11:33 am
An advanced experiment for anyone with a little time to kill!
I came across the esp-prog-2 device - and noticing that it is an esp32-s3, wondered if a similar setup would be possible.
You'll need an esp32-s3 (I used a zero) and a target device to debug (I used an esp32-wroom-32)
Open a command prompt and run framework\export (where framework is the directory of your espressif toolset (I used v5.5 at C:\Espressif\frameworks\esp-idf-v5.5)) and get the usb-bridge source using:
Set the target to be esp32-s3 using
using make a note of the pins used by the s3 to connect - these are under component config->debug probe configuration and serial handler configuration (nearly at end of the component config section)
Then upload the program to the s3 (put into boot by holding the boot button and pressing reset)
- note set COMn to the correct COM port (or leave out and it will auto detect, by trying all the com ports)
Now reset the s3 (press reset) - and it will show in windows as a flash drive...
Breath...
Wire the s3 to the esp32 (or your target):
TDO → GPIO 15 on an ESP32=WROOM
TCK → GPIO 13
TDI → GPIO 12
TMS → GPIO 14
BOOT -> GPIO 0
RESET -> EN
TxD -> RxD
RxD to TxD
Power and Ground - I used 5V from the S3 to the 5V pin of the esp32.
Create a simple Flowcode test program - I had a UART - and a local .i incrementing and printing in a loop with a delay...
Compile your test program.
At the command line:
Which should run openocd
Open a second command prompt and run framework/export as above
cd to your test program directory and upload the test program (the s3 acts a programmer):
And run gdb Set your_project to the name of your test program (eg gdb_test.elf)
gdb is a powerful debugger - and I can't list all the commands here but:
hbreak app_main // Set a (hardware assisted) breakpoint at the start of your program
c // continue - run to a breakpoint
n // next line (step over in FC simulation)
s // step into
info locals // display local variables
monitor reset halt // Stop and reset the target
help all // see all the commands
Good luck and enjoy!
Martin
I came across the esp-prog-2 device - and noticing that it is an esp32-s3, wondered if a similar setup would be possible.
You'll need an esp32-s3 (I used a zero) and a target device to debug (I used an esp32-wroom-32)
Open a command prompt and run framework\export (where framework is the directory of your espressif toolset (I used v5.5 at C:\Espressif\frameworks\esp-idf-v5.5)) and get the usb-bridge source using:
Code: Select all
git clone https://github.com/espressif/esp-usb-bridge.git
cd esp-usb-bridgeCode: Select all
idf.py set-target esp32s3Code: Select all
idf.py menuconfigThen upload the program to the s3 (put into boot by holding the boot button and pressing reset)
Code: Select all
idf.py -p COMn -b 921600 flashNow reset the s3 (press reset) - and it will show in windows as a flash drive...
Breath...
Wire the s3 to the esp32 (or your target):
TDO → GPIO 15 on an ESP32=WROOM
TCK → GPIO 13
TDI → GPIO 12
TMS → GPIO 14
BOOT -> GPIO 0
RESET -> EN
TxD -> RxD
RxD to TxD
Power and Ground - I used 5V from the S3 to the 5V pin of the esp32.
Create a simple Flowcode test program - I had a UART - and a local .i incrementing and printing in a loop with a delay...
Compile your test program.
At the command line:
Code: Select all
openocd -f interface/esp_usb_bridge.cfg -f target/esp32.cfgOpen a second command prompt and run framework/export as above
cd to your test program directory and upload the test program (the s3 acts a programmer):
Code: Select all
idf.py flashAnd run gdb
Code: Select all
xtensa-esp32-elf-gdb -ex "target extended-remote :3333" build/your_project.elfgdb is a powerful debugger - and I can't list all the commands here but:
hbreak app_main // Set a (hardware assisted) breakpoint at the start of your program
c // continue - run to a breakpoint
n // next line (step over in FC simulation)
s // step into
info locals // display local variables
monitor reset halt // Stop and reset the target
help all // see all the commands
Good luck and enjoy!
Martin