GDB + OpenOCD not working
Posted: Wed Aug 08, 2018 6:42 am
My setup:
Ubuntu 16.04
ESP-IDF (latest)
openocd-esp32 (latest)
Eclipse (latest)
ESP32 DEVKITC DOIT equivalent
JLINK V9 JTAG clone
I think my openocd is working because I can see below message:
Info : No device selected, using first device.
Info : J-Link V9 compiled Apr 20 2018 16:47:26
Info : Hardware version: 9.40
Info : VTarget = 3.354 V
Info : Reduced speed from 20000 kHz to 15000 kHz (maximum).
Info : Reduced speed from 20000 kHz to 15000 kHz (maximum).
Info : clock speed 20000 kHz
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core was reset (pwrstat=0x5F, after clear 0x0F).
Info : Detected debug stubs @ 3ffb2b20 on core0 of target 'esp32'
cpu0: Current bits set: BreakIn BreakOut RunStallIn
cpu1: Current bits set: BreakIn BreakOut RunStallIn
Info : esp32: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core was reset (pwrstat=0x5F, after clear 0x0F).
Info : Detected debug stubs @ 3ffb2b20 on core0 of target 'esp32'
Then I try to debug the hello word example in Eclipse. I have followed ESP-IDF instructions to configure GDB debugger. I get error message when I try to connect GDB to Openocd
Error in final launch sequence:
Failed to execute MI command:
-target-select remote localhost:3333
Error message from debugger back end:
Bogus trace status reply from target: timeout
Failed to execute MI command:
-target-select remote localhost:3333
Error message from debugger back end:
Bogus trace status reply from target: timeout
Bogus trace status reply from target: timeout
On openocd side, these are the log messages:
Info : esp32: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core was reset (pwrstat=0x5F, after clear 0x0F).
Info : Detected debug stubs @ 3ffb2b20 on core0 of target 'esp32'
Info : accepting 'gdb' connection on tcp/3333
Info : Target halted. PRO_CPU: PC=0x400E0F7A (active) APP_CPU: PC=0x00000000
Info : Not full dbg stub table 1 of 2
Error: timed out while waiting for target halted / 4 - 2
Error: timed out while waiting for target halted / 4 - 2
Error: Faied to wait algorithm (-4)!
jaylink: Failed to receive data from device: LIBUSB_ERROR_TIMEOUT.
Error: timed out while waiting for target halted / 4 - 2
Warn : xtensa_write_memory: esp32: target not halted
Error: failed to restore 28 bytes of working area at address 0x3ffc0590
Warn : xtensa_write_memory: esp32: target not halted
Error: failed to restore 28 bytes of working area at address 0x400916f8
Warn : xtensa_write_memory: esp32: target not halted
Error: failed to restore 1300 bytes of working area at address 0x3ffc007c
Warn : xtensa_write_memory: esp32: target not halted
Error: failed to restore 5880 bytes of working area at address 0x40090000
Warn : xtensa_write_memory: esp32: target not halted
Error: failed to restore 124 bytes of working area at address 0x3ffc0000
Error: Algorithm run faied (-4)!
Error: Faied to run flasher stub (-4)!
Error: Failed to get flash mappings (-4)!
Error: auto_probe failed
Error: Connect failed. Consider setting up a gdb-attach event for the target to prepare target for GDB connect, or use 'gdb_memory_map disable'.
Error: attempted 'gdb' connection rejected
Info : Halt timed out, wake up GDB.
jaylink: Failed to receive data from device: LIBUSB_ERROR_TIMEOUT.
I tried some of instructions to configure GDB for openocd ESP32, but I am not sure where I should place .gdbinit and also not sure have I written the file correctly.
Please help.
Ubuntu 16.04
ESP-IDF (latest)
openocd-esp32 (latest)
Eclipse (latest)
ESP32 DEVKITC DOIT equivalent
JLINK V9 JTAG clone
I think my openocd is working because I can see below message:
Info : No device selected, using first device.
Info : J-Link V9 compiled Apr 20 2018 16:47:26
Info : Hardware version: 9.40
Info : VTarget = 3.354 V
Info : Reduced speed from 20000 kHz to 15000 kHz (maximum).
Info : Reduced speed from 20000 kHz to 15000 kHz (maximum).
Info : clock speed 20000 kHz
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core was reset (pwrstat=0x5F, after clear 0x0F).
Info : Detected debug stubs @ 3ffb2b20 on core0 of target 'esp32'
cpu0: Current bits set: BreakIn BreakOut RunStallIn
cpu1: Current bits set: BreakIn BreakOut RunStallIn
Info : esp32: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core was reset (pwrstat=0x5F, after clear 0x0F).
Info : Detected debug stubs @ 3ffb2b20 on core0 of target 'esp32'
Then I try to debug the hello word example in Eclipse. I have followed ESP-IDF instructions to configure GDB debugger. I get error message when I try to connect GDB to Openocd
Error in final launch sequence:
Failed to execute MI command:
-target-select remote localhost:3333
Error message from debugger back end:
Bogus trace status reply from target: timeout
Failed to execute MI command:
-target-select remote localhost:3333
Error message from debugger back end:
Bogus trace status reply from target: timeout
Bogus trace status reply from target: timeout
On openocd side, these are the log messages:
Info : esp32: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core was reset (pwrstat=0x5F, after clear 0x0F).
Info : Detected debug stubs @ 3ffb2b20 on core0 of target 'esp32'
Info : accepting 'gdb' connection on tcp/3333
Info : Target halted. PRO_CPU: PC=0x400E0F7A (active) APP_CPU: PC=0x00000000
Info : Not full dbg stub table 1 of 2
Error: timed out while waiting for target halted / 4 - 2
Error: timed out while waiting for target halted / 4 - 2
Error: Faied to wait algorithm (-4)!
jaylink: Failed to receive data from device: LIBUSB_ERROR_TIMEOUT.
Error: timed out while waiting for target halted / 4 - 2
Warn : xtensa_write_memory: esp32: target not halted
Error: failed to restore 28 bytes of working area at address 0x3ffc0590
Warn : xtensa_write_memory: esp32: target not halted
Error: failed to restore 28 bytes of working area at address 0x400916f8
Warn : xtensa_write_memory: esp32: target not halted
Error: failed to restore 1300 bytes of working area at address 0x3ffc007c
Warn : xtensa_write_memory: esp32: target not halted
Error: failed to restore 5880 bytes of working area at address 0x40090000
Warn : xtensa_write_memory: esp32: target not halted
Error: failed to restore 124 bytes of working area at address 0x3ffc0000
Error: Algorithm run faied (-4)!
Error: Faied to run flasher stub (-4)!
Error: Failed to get flash mappings (-4)!
Error: auto_probe failed
Error: Connect failed. Consider setting up a gdb-attach event for the target to prepare target for GDB connect, or use 'gdb_memory_map disable'.
Error: attempted 'gdb' connection rejected
Info : Halt timed out, wake up GDB.
jaylink: Failed to receive data from device: LIBUSB_ERROR_TIMEOUT.
I tried some of instructions to configure GDB for openocd ESP32, but I am not sure where I should place .gdbinit and also not sure have I written the file correctly.
Please help.