Skip to content

ESP32-S3 platformio unified debugger not working #1656

@dvankley

Description

@dvankley

I'm using a ESP32-S3-MINI-1U-N4R2 on a custom board and trying to get a basic PlatformIO hello world to work with the debugger with no success.

The project I'm using is https://github.com/platformio/platform-espressif32/tree/master/examples/espidf-hello-world. I've added

while (1) {
    printf("Test...\n");
    vTaskDelay(1000 / portTICK_PERIOD_MS);
}

before the restart at the bottom to try to avoid situations where the program finishes running and resets before the debugger attaches.

I'm attempting to use the built-in debug probe on the main ESP32-S3 USB port (GPIO19-20 on this module). I believe the wiring is correct because I am able to use the "Upload and Monitor" target to flash the board and watch output successfully. I am also able to flash and debug pure ESP-IDF projects successfully. I'm primarily using CLion but see the same results with VS Code.

My platformio.ini is:

[env:test]
platform = platformio/espressif32
framework = espidf
monitor_speed = 115200
board = esp32-s3-devkitc-1
board_upload.flash_size = 4MB
upload_protocol = esp-builtin
debug_speed = 1000
;debug_init_break = thb app_main
build_type = debug

When I try to debug with PlatformIO with a breakpoint at https://github.com/platformio/platform-espressif32/blob/master/examples/espidf-hello-world/src/hello_world_main.c#L21, I see the following output:

Preparing firmware for debugging...
Processing test (platform: platformio/espressif32; framework: espidf; board: esp32-s3-devkitc-1)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32-s3-devkitc-1.html
PLATFORM: Espressif 32 (6.12.0) > Espressif ESP32-S3-DevKitC-1-N8 (8 MB QD, No PSRAM)
HARDWARE: ESP32S3 240MHz, 320KB RAM, 8MB Flash
DEBUG: Current (esp-builtin) On-board (esp-builtin) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-espidf @ 3.50500.0 (5.5.0) 
 - tool-cmake @ 3.30.2 
 - tool-esp-rom-elfs @ 0.0.1+20241011 
 - tool-esptoolpy @ 2.40900.250804 (4.9.0) 
 - tool-ninja @ 1.9.0 
 - tool-openocd-esp32 @ 2.1100.20220706 (11.0) 
 - tool-riscv32-esp-elf-gdb @ 12.1.0+20221002 
 - tool-xtensa-esp-elf-gdb @ 12.1.0+20221002 
 - toolchain-esp32ulp @ 1.23800.240113 (2.38.0) 
 - toolchain-riscv32-esp @ 14.2.0+20241119 
 - toolchain-xtensa-esp-elf @ 14.2.0+20241119
Reading CMake configuration...
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in debug mode
Compiling .pio/build/test/src/hello_world_main.c.o

<compiler output omitted>

Linking .pio/build/test/bootloader.elf
Building .pio/build/test/bootloader.bin
esptool.py v4.9.0
Creating esp32s3 image...
Merged 2 ELF sections
Successfully created esp32s3 image.
Linking .pio/build/test/firmware.elf
Retrieving maximum program size .pio/build/test/firmware.elf
Checking size .pio/build/test/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   4.0% (used 13128 bytes from 327680 bytes)
Flash: [==        ]  19.6% (used 205657 bytes from 1048576 bytes)
Building .pio/build/test/firmware.bin
esptool.py v4.9.0
Creating esp32s3 image...
Merged 2 ELF sections
Successfully created esp32s3 image.
========================= [SUCCESS] Took 23.58 seconds =========================

Environment    Status    Duration
-------------  --------  ------------
test           SUCCESS   00:00:23.583
========================= 1 succeeded in 00:00:23.583 =========================
Reading symbols from /Users/path/platform-espressif32/examples/espidf-hello-world/.pio/build/test/firmware.elf...
PlatformIO Unified Debugger -> https://bit.ly/pio-debug
PlatformIO: debug_tool = esp-builtin
PlatformIO: Initializing remote target...
Warning: 'flushregs', an alias for the command 'maintenance flush register-cache', is deprecated.
Use 'maintenance flush register-cache'.

Open On-Chip Debugger  v0.11.0-esp32-20220706 (2022-07-06-15:49)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
Info : esp_usb_jtag: VID set to 0x303a and PID to 0x1001
Info : esp_usb_jtag: capabilities descriptor set to 0x2000
adapter speed: 40000 kHz

Warn : Transport "jtag" was already selected
adapter speed: 1000 kHz

Info : tcl server disabled
Info : telnet server disabled
Info : esp_usb_jtag: serial (24:EC:4A:2F:4E:04)
Info : esp_usb_jtag: Device found. Base speed 40000KHz, div range 1 to 255
Info : clock speed 1000 kHz
Info : JTAG tap: esp32s3.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32s3.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : [esp32s3.cpu0] Debug controller was reset.
Info : [esp32s3.cpu0] Core was reset.
Error: Unexpected OCD_ID = 00000000
Error: Unexpected OCD_ID = 00000000
Error: Unexpected OCD_ID = 00000000
Error: Unexpected OCD_ID = 00000000
Warn : target esp32s3.cpu1 examination failed
Error: Unexpected OCD_ID = 00000000
Error: Unexpected OCD_ID = 00000000
Info : starting gdb server for esp32s3.cpu0 on pipe
Info : accepting 'gdb' connection from pipe
Info : [esp32s3.cpu0] Target halted, PC=0x40041A7C, debug_reason=00000000
Info : Set GDB target to 'esp32s3.cpu0'
Warn : No symbols for FreeRTOS!
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3c020020, 41 KB
Info : Flash mapping 1: 0x20020 -> 0x42000020, 94 KB
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Info : Auto-detected flash bank 'esp32s3.cpu0.flash' size 4096 KB
Info : Using flash bank 'esp32s3.cpu0.flash' size 4096 KB
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3c020020, 41 KB
Info : Flash mapping 1: 0x20020 -> 0x42000020, 94 KB
Info : Using flash bank 'esp32s3.cpu0.irom' size 96 KB
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3c020020, 41 KB
Info : Flash mapping 1: 0x20020 -> 0x42000020, 94 KB
Info : Using flash bank 'esp32s3.cpu0.drom' size 44 KB
Info : New GDB Connection: 1, Target esp32s3.cpu0, state: halted
Warn : negative reply, retrying
0x40041a7c in ?? ()
Error: FreeRTOS: uxTopUsedPriority is not defined, consult the OpenOCD manual for a work-around!
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (1251 ms). Workaround: increase "set remotetimeout" in GDB
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (1248 ms). Workaround: increase "set remotetimeout" in GDB
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (1257 ms). Workaround: increase "set remotetimeout" in GDB
Info : JTAG tap: esp32s3.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32s3.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Error: Unexpected OCD_ID = 00000000
Info : [esp32s3.cpu0] requesting target halt and executing a soft reset
Info : [esp32s3.cpu0] Debug controller was reset.
Info : [esp32s3.cpu0] Core was reset.
Info : [esp32s3.cpu0] Target halted, PC=0x500000EF, debug_reason=00000000
Info : [esp32s3.cpu1] requesting target halt and executing a soft reset
Error: Target not examined yet
Info : [esp32s3.cpu0] Core was reset.
Info : [esp32s3.cpu0] Target halted, PC=0x40000400, debug_reason=00000000
Info : [esp32s3.cpu1] Debug controller was reset.
Info : [esp32s3.cpu1] Core was reset.
Info : [esp32s3.cpu1] Target halted, PC=0x40000400, debug_reason=00000000
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (3823 ms). Workaround: increase "set remotetimeout" in GDB
Info : PROF: Erased 45056 bytes in 5568.05 ms
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (1757 ms). Workaround: increase "set remotetimeout" in GDB
Info : JTAG tap: esp32s3.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32s3.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : [esp32s3.cpu0] requesting target halt and executing a soft reset
Info : [esp32s3.cpu0] Debug controller was reset.
Info : [esp32s3.cpu0] Core was reset.
Info : [esp32s3.cpu0] Target halted, PC=0x500000EF, debug_reason=00000000
Info : [esp32s3.cpu1] requesting target halt and executing a soft reset
Info : [esp32s3.cpu0] Core was reset.
Info : [esp32s3.cpu0] Target halted, PC=0x40000400, debug_reason=00000000
Info : [esp32s3.cpu1] Debug controller was reset.
Info : [esp32s3.cpu1] Core was reset.
Info : [esp32s3.cpu1] Target halted, PC=0x40000400, debug_reason=00000000
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (3799 ms). Workaround: increase "set remotetimeout" in GDB
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Info : PROF: Erased 98304 bytes in 6017.55 ms
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (2229 ms). Workaround: increase "set remotetimeout" in GDB
Info : PROF: Compressed 41736 bytes to 14146 bytes in 2.469000ms
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (12528 ms). Workaround: increase "set remotetimeout" in GDB
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (1196 ms). Workaround: increase "set remotetimeout" in GDB
Info : PROF: Data transferred in 1097.01 ms @ 12.5928 KB/s
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
Info : PROF: Wrote 41736 bytes in 25166.2 ms (data transfer time included)
Info : PROF: Compressed 94606 bytes to 55758 bytes in 6.212000ms
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (23460 ms). Workaround: increase "set remotetimeout" in GDB
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (1373 ms). Workaround: increase "set remotetimeout" in GDB
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (1271 ms). Workaround: increase "set remotetimeout" in GDB
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (1270 ms). Workaround: increase "set remotetimeout" in GDB
Info : PROF: Data transferred in 4331.61 ms @ 12.5706 KB/s
Info : [esp32s3.cpu0] Target halted, PC=0x403B2482, debug_reason=00000001
JTAG tap: esp32s3.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
JTAG tap: esp32s3.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
[esp32s3.cpu0] requesting target halt and executing a soft reset
Info : PROF: Wrote 94606 bytes in 28201.3 ms (data transfer time included)
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (11255 ms). Workaround: increase "set remotetimeout" in GDB
Info : JTAG tap: esp32s3.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32s3.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : [esp32s3.cpu0] requesting target halt and executing a soft reset
Info : [esp32s3.cpu0] Debug controller was reset.
Info : [esp32s3.cpu0] Core was reset.
Info : [esp32s3.cpu0] Target halted, PC=0x500000EF, debug_reason=00000000
Info : [esp32s3.cpu1] requesting target halt and executing a soft reset
Info : [esp32s3.cpu0] Core was reset.
Info : [esp32s3.cpu0] Target halted, PC=0x40000400, debug_reason=00000000
Info : [esp32s3.cpu1] Debug controller was reset.
Info : [esp32s3.cpu1] Core was reset.
Info : [esp32s3.cpu1] Target halted, PC=0x40000400, debug_reason=00000000
Info : JTAG tap: esp32s3.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32s3.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : [esp32s3.cpu0] requesting target halt and executing a soft reset
[esp32s3.cpu0] Debug controller was reset.
[esp32s3.cpu0] Core was reset.
[esp32s3.cpu0] Target halted, PC=0x500000EF, debug_reason=00000000
[esp32s3.cpu1] requesting target halt and executing a soft reset
[esp32s3.cpu0] Core was reset.
Info : [esp32s3.cpu0] Debug controller was reset.
Info : [esp32s3.cpu0] Core was reset.
Info : [esp32s3.cpu0] Target halted, PC=0x500000EF, debug_reason=00000000
Info : [esp32s3.cpu1] requesting target halt and executing a soft reset
Info : [esp32s3.cpu0] Core was reset.
[esp32s3.cpu0] Target halted, PC=0x40000400, debug_reason=00000000
[esp32s3.cpu1] Debug controller was reset.
[esp32s3.cpu1] Core was reset.
[esp32s3.cpu1] Target halted, PC=0x40000400, debug_reason=00000000
Info : [esp32s3.cpu0] Target halted, PC=0x40000400, debug_reason=00000000
Info : [esp32s3.cpu1] Debug controller was reset.
Info : [esp32s3.cpu1] Core was reset.
Info : [esp32s3.cpu1] Target halted, PC=0x40000400, debug_reason=00000000
PlatformIO: Initialization completed
Note: automatically using hardware breakpoints for read-only addresses.
The target architecture is set to "auto" (currently "xtensa").
PlatformIO: Resume the execution to `debug_init_break = thb app_main`
PlatformIO: More configuration options -> https://bit.ly/pio-debug

At that point, I see the program appear to break at 0x40041a7c of a diassembled version of the binary. Resuming from that point produces no further output.

Hardware resetting the board produces another illusory break at 0x40000401 and an infinite loop of:

Info : [esp32s3.cpu0] Debug controller was reset.
Info : [esp32s3.cpu0] Core was reset.
Info : [esp32s3.cpu0] Debug controller was reset.
Info : [esp32s3.cpu0] Core was reset.

I've tried a variety of configurations suggested by forums and AI with no success.
Any input would be appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions