GDB Issue, "Connection refused"

justinmreina
Posts: 26
Joined: Tue Jul 18, 2017 10:39 pm

GDB Issue, "Connection refused"

Postby justinmreina » Sat Aug 26, 2017 2:03 am

I am using the DevKitC with my Segger J-Link EDU and am having trouble establishing JTAG connection in GDB. OpenOCD works with this configuration.

Target: DevKitC
Debugger: Segger J-Link EDU
Method: JTAG (wiring example)
Setup: USB connected, JTAG wiring connected (see above)
Reference Used: JTAG-Debugging - Using the Debugger from the Command Line

Issue
When I try to run xtensa-esp32-elf-gdb, I get the following response -

Code: Select all

erguser@ergdev-esp32:~/esp/hello_world$ xtensa-esp32-elf-gdb -x gdbinit build/hello-world.elf 
GNU gdb (crosstool-NG crosstool-ng-1.22.0-61-gab8375a) 7.10
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-build_pc-linux-gnu --target=xtensa-esp32-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from build/hello-world.elf...done.
gdbinit:1: Error in sourced command file:
:3333: Connection refused.
(gdb) 
Why is the connection refused? Am I missing a step?

User avatar
ESP_krzychb
Posts: 400
Joined: Sat Oct 01, 2016 9:05 am
Contact:

Re: GDB Issue, "Connection refused"

Postby ESP_krzychb » Sat Aug 26, 2017 8:06 am

Hi justinmreina,

- What is shown on OpenOCD console?
- What is your OS?

justinmreina
Posts: 26
Joined: Tue Jul 18, 2017 10:39 pm

Re: GDB Issue, "Connection refused"

Postby justinmreina » Sat Aug 26, 2017 6:54 pm

Hey krzychb,
Great to hear from you, looking forward to debugging this.

OS:
  • Ubuntu 16.04 LTS (Virtualbox, Win10 Host)
Command:
  • ./src/openocd -s tcl -f interface/jlink.cfg -f board/esp-wroom-32.cfg
Result: (file)
  • erguser@ergdev-esp32:~$ cd ~/esp/openocd-esp32
    erguser@ergdev-esp32:~/esp/openocd-esp32$ dmesg | grep tty
    [ 0.000000] console [tty0] enabled
    [ 1.721594] tty tty25: hash matches
    [ 848.465053] usb 2-3: cp210x converter now attached to ttyUSB0
    erguser@ergdev-esp32:~/esp/openocd-esp32$ ./src/openocd -s tcl -f interface/jlink.cfg -f board/esp-wroom-32.cfg
    Open On-Chip Debugger 0.10.0-dev-gcc5b0f7 (2017-08-25-18:11)
    Licensed under GNU GPL v2
    For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
    adapter speed: 20 kHz
    force hard breakpoints
    Info : No device selected, using first device.
    Info : J-Link V9 compiled Dec 16 2016 15:34:10
    Info : Hardware version: 9.40
    Info : VTarget = 3.317 V
    Info : clock speed 20 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 : esp32: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
    Info : esp32: Core was reset (pwrstat=0x5F, after clear 0x0F).
    Info : esp32: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
    Info : esp32: Core was reset (pwrstat=0x5F, after clear 0x0F).
    <justin pressed reset button (EN) on DevKitC>
    Info : esp32: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
    Info : esp32: Core was reset (pwrstat=0x5F, after clear 0x0F).
    Info : esp32: Debug controller was reset (pwrstat=0xE5, after clear 0x5F).
    Info : esp32: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
    Info : esp32: Core was reset (pwrstat=0x5F, after clear 0x0F).
    Info : esp32: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
    Info : esp32: Core was reset (pwrstat=0x5F, after clear 0x0F)
Thoughts? Let me know if anything else is needed! :)

User avatar
ESP_krzychb
Posts: 400
Joined: Sat Oct 01, 2016 9:05 am
Contact:

Re: GDB Issue, "Connection refused"

Postby ESP_krzychb » Sun Aug 27, 2017 10:22 am

Hey justinmreina,

You have provided very well organized logs :D

1. What part of OpenOCD log is shown before you attempt to connect gdb? My looks as follows:

Code: Select all

krzysztof@TK-HP:~/esp/openocd-esp32$ src/openocd -s tcl -f interface/ftdi/esp32_devkitj_v1.cfg -f board/esp-wroom-32.cfg
Open On-Chip Debugger 0.10.0-dev-gcc5b0f7a (2017-08-27-11:04)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
none separate
adapter speed: 20000 kHz
force hard breakpoints
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
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 : Target halted. PRO_CPU: PC=0x400D17B3 (active)    APP_CPU: PC=0x400840A7 
After running gdb, OpenOCD log shows the following:

Code: Select all

Info : accepting 'gdb' connection on tcp/3333
Info : Use core0 of target 'esp32'
Info : Target halted. PRO_CPU: PC=0x40091D07 (active)    APP_CPU: PC=0x400D0DAC 
Info : Auto-detected flash size 4194303 KB
Info : Using flash size 4194303 KB
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 : Target halted. PRO_CPU: PC=0x5000004B (active)    APP_CPU: PC=0x00000000 
esp32: target state: halted
Info : esp32: Core was reset (pwrstat=0x1F, after clear 0x0F).
Info : Target halted. PRO_CPU: PC=0x40000400 (active)    APP_CPU: PC=0x40000400 
esp32: target state: halted
Info : Target halted. PRO_CPU: PC=0x400D17B3 (active)    APP_CPU: PC=0x400840A7 
2. Since you are getting "Connection refused" maybe this is some permission issues.
Have you tried running gdb as a superuser "sudo xtensa-esp32-elf-gdb -x gdbinit build/hello-world.elf"?

3. If "sudo" does not help, then please post logs with increased debug level following http://esp-idf.readthedocs.io/en/latest ... ing-issues

4. Are you using the latest master of "esp-idf" to compile and load "hello-world" example or some previous version? Which one?

justinmreina
Posts: 26
Joined: Tue Jul 18, 2017 10:39 pm

Re: GDB Issue, "Connection refused"

Postby justinmreina » Mon Aug 28, 2017 8:17 pm

I do not have 'interface/ftdi/esp32_devkitj_v1.cfg', does this perform JTAG over USB for the DevKitC? How might I get this file?

I will get to this later today, your help here is really appreciated, thanks!

User avatar
ESP_krzychb
Posts: 400
Joined: Sat Oct 01, 2016 9:05 am
Contact:

Re: GDB Issue, "Connection refused"

Postby ESP_krzychb » Sat Sep 02, 2017 5:58 pm

justinmreina wrote:I do not have 'interface/ftdi/esp32_devkitj_v1.cfg', does this perform JTAG over USB for the DevKitC? How might I get this file?
No, this file is applicable for on board JTAG of ESP-WROVER-KIT. You can get it under https://github.com/espressif/openocd-es ... itj_v1.cfg

Who is online

Users browsing this forum: No registered users and 122 guests