Remote access to OpenOCD running on Pi 3 B

Open source ARM Debugger

Moderator: phalanx

Post Reply
crylla
Posts: 1
Joined: Fri Jun 22, 2018 5:06 am

Remote access to OpenOCD running on Pi 3 B

Post by crylla » Fri Jun 22, 2018 5:17 am

I have installed OpenOCD onto a Raspberry Pi 3, following the instructions here:

https://github.com/TurtleRover/Turtle-R ... 32-and-RPi

OpenOCD appears to run ok and says that it is listening on port 3333 for GDB commands and on port 444 for telnet commands (it can be issued commands via either protocol)

According to the link above, it should be possible to send GDB or telnet commands remotely from a PC connected to the same network as the RPi.

However, when I try to connect to OpenOCD on port 3333 from a Windows 10 PC running a a gdb client:

(gdb) target remote 169.254.199.164:3333

I get the error message:

169.254.199.164:3333: No connection could be made because the target machine actively refused it.

Similarly, if I try to connect to OpenOCD on port 4444 from a Windows 10 PC via telnet

C:\WINDOWS\system32>telnet 169.254.199.164 4444

I get the error message:

Connecting To 169.254.199.164...Could not open connection to the host, on port 4444: Connect failed

If I run the following command on the Raspberry Pi

netstat -an | grep tcp

I get:

tcp 0 0 127.0.0.1:3333 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:6666 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:5900 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:23 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:4444 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:36842 127.0.0.1:33593 ESTABLISHED
tcp 0 0 169.254.199.164:5900 169.254.224.200:54052 ESTABLISHED
tcp 0 0 127.0.0.1:33593 127.0.0.1:36842 ESTABLISHED
tcp6 0 0 :::5900 :::* LISTEN
tcp6 0 0 :::22

I can establish the following PC to RPi connections:
SSH, VNC and telnet on the standard port 23.

On the RPi, I can connect via telnet to port 4444 at the loopback address 127.0.0.1.

I can also connect to port 3333 at 127.0.0.1. The connection is immediately dropped , presumably because the GDB protocol is not used, however I thing this proves that OpenGDB is listening on this port.

I am not a network expert but I think the problem may be that OpenGDB is listening to ports 3333 and 4444 at the local loopback address 127.0.0.1 instead of the generic 0.0.0.0 (all addresses) address. So connection requests to the RPi's address on the local network are being ignored.

Earlier versions of Raspian and or RPi hardware did seem to work with OpenOCD so I am assuming that this has something to do with changes to the standard RPi network setup.

But eaqualy this could be a fault with OpenOCD not choosing the address correctly.

Does anyone have any ideas on how to solve this?

Here is the contents of my hosts file on the RPi:

127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

127.0.1.1 raspberrypi

I have not been fiddling with any of the standard setup and have only installed OpenOCD and various application like telnet, telnetd and iperf in an attempt at diagnosing the problem.

iamseer
Posts: 4
Joined: Sat May 07, 2011 3:04 am

Re: Remote access to OpenOCD running on Pi 3 B

Post by iamseer » Wed Jul 25, 2018 11:08 pm

I had an exactly same problem today. After a few minutes searching "127.0.0.1" in the source code. I found the solution is actually in manual.

http://openocd.org/doc/html/General-Commands.html

Command: bindto [name]
Specify hostname or IPv4 address on which to listen for incoming TCP/IP connections. By default, OpenOCD will listen on the loopback interface only. If your network environment is safe, bindto 0.0.0.0 can be used to cover all available interfaces.


So just add "bindto 0.0.0.0" in your cfg file then it will work.

Post Reply