Skip to content

ESP32-C3: failing to connect GDB (OCD-580) #233

Closed as not planned
Closed as not planned
@tcbennun

Description

@tcbennun

Development Kit

N/A

Module or chip used

ESP32-C3-MINI-1

Debug Adapter

Built-in USB

OpenOCD version

v0.11.0-esp32-20211220

Operating System

Debian Linux (kernel 5.18)

Using an IDE ?

N/A

OpenOCD command line

openocd -f board/esp32c3-builtin.cfg

JTAG Clock Speed

Any (tried default, tried 1 MHz)...

ESP-IDF version

v4.4.1

Problem Description

  1. Connect module to PC via USB cable.
  2. Run openocd -l openocd.log -d3 -f board/esp32c3-builtin.cfg in a new terminal with ESP-IDF already exported.
  3. Create file named gdbinit with the following contents:
target remote :3333
set remote hardware-watchpoint-limit 2
mon reset halt
flushregs
thb app_main
c
  1. Run riscv32-esp-elf-gdb -ex "set remotelogfile gdb.log" -x gdbinit build/blecent.elf in another new terminal with ESP-IDF already exported.

The result is a failure for GDB to connect to the device. OpenOCD initially connects correctly, but problems occur when GDB is invoked. See logs.

Key line in the OpenOCD log:
Error: 1043 69168 riscv.c:1898 riscv_wait_algorithm(): Algorithm timed out after 40001 ms.

Debug Logs

OpenOCD log: https://gist.github.com/tcbennun/e1625a2c6fd85873721a51334ed65098

GDB log:

w +$qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-events+;exec-events+;vContSupported+;QThreadEvents+;no-resumed+#df
r +<Timeout: 2 seconds>
w -
r <Timeout: 2 seconds>
w -
r <Timeout: 2 seconds>
w -+$vMustReplyEmpty#3a
r <Timeout: 2 seconds>
w $vMustReplyEmpty#3a
r <Timeout: 2 seconds>
w $vMustReplyEmpty#3a
r <Timeout: 2 seconds>
w $vMustReplyEmpty#3a
r <Timeout: 2 seconds><Timeout: 2 seconds>
w -
r <Timeout: 2 seconds>
w -
r <Timeout: 2 seconds>
w -+
End of log

Expected behavior

Expected GDB to connect to OpenOCD and for the program to stop at a temporary breakpoint at the start of app_main.

Screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions