GDB remote to Raspberry PI with connected LPC Link2?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GDB remote to Raspberry PI with connected LPC Link2?

2,271 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ErikC on Fri Mar 04 08:48:22 MST 2016
Hi all,

Normally, the LPC Link2 is plugged into a USB port of the desktop PC. I would like to move this debug adapter to my Raspberry so that I can debug my application remotely (via ethernet cable). I assume I need to launch the GDB (arm-none-eabi-gdb) on RPi and some settings within LPCXpresso tool should be adapted. Who can tell me how to do?

Erik
0 Kudos
Reply
11 Replies

1,635 Views
lpcware
NXP Employee
NXP Employee
bump
0 Kudos
Reply

1,635 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ErikC on Tue Mar 22 13:29:34 MST 2016
Estabilishing a USB server over IP in Raspberry PI B+ with newest RASPBIAN JESSIE LITE (version 2016-03-18) is passed with following results:

root@raspberrypi:/# sudo usbip --debug bind -b 1-1.3
usbip: debug: /build/linux-tools-WtS4w2/linux-tools-3.16.7-ckt20/drivers/staging                          /usbip/userspace/src/usbip.c:141:[run_command] running command: `bind'
usbip: info: bind device on busid 1-1.3: complete

The appropriate IP port can be found:

root@raspberrypi:/# netstat -tap
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 *:3240                  *:*                     LISTEN      556/usbipd
tcp        0      0 *:ssh                   *:*                     LISTEN      435/sshd
tcp        0     64 192.168.0.6:ssh         192.168.0.25:52025      ESTABLISHED 467/sshd: pi [priv]
tcp6       0      0 [::]:3240               [::]:*                  LISTEN      556/usbipd

That is 3240.

You can make a loopback test to see if this USB bind is working:

root@raspberrypi:/#  usbip list -r 192.168.0.6
Exportable USB devices
======================
- 192.168.0.6
      1-1.3: NXP Semiconductors : unknown product (1fc9:000c)
           : /sys/devices/platform/soc/20980000.usb/usb1/1-1/1-1.3
           : (Defined at Interface level) (00/00/00)

A connection to a Windows PC is still not ok. I have tried to run the VirtualHere client app that will embed a Apple driver "Bonjour". I sometimes see a connection but this is lost regulary, mostly after 1 second. In Device Manager, this virtual USB is never found.

How to solve? Is there a better virtual USB client?
0 Kudos
Reply

1,635 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ErikC on Fri Mar 18 07:04:38 MST 2016
It is expected that a raw connection of a unknown device is possible. Thanks for realisation of the remote connection.

It is correct that I am using Banana Pi. That's pity that the kernel is very old: Linux bananapi 3.4.104-bananian #1 SMP PREEMPT Mon Apr 6 18:25:40 UTC 2015 armv7l GNU/Linux. A big advance is only a SSD drive connected to this Banana Pi.

I will add an existing RPI B+ to my Banana Pi setup, only for debug purpose. Should it be working?
0 Kudos
Reply

1,635 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by djlegge on Fri Mar 18 04:12:34 MST 2016
Are you using a raspberry pi or a banana pi ? Kernel 3.16.7 is pretty old - my RPI is using kernel 4.4.3.
It seems usbip has changed quite a lot recently which is where I have problems because I am using linux kernel 3.13 on my desktop.
Anyway, using my recent RPI (actually an RPI3) I just did :
modprobe usbip-core
modprobe usbip-host
usbip list --local    (find id for NXP device)
usbip bind -b 1-1.4
I then get :
usbip: info: bind device on busid 1-1.4: complete.

After that, I can attempt to connect to it from other machines.
As I understand it, only the raw USB connection is forwarded to a virtual USB on your PC. For this reason, you do not need any driver on the RPI and LPCXpresso would be unaware that it was even working remotely...
0 Kudos
Reply

1,635 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Wed Mar 16 15:34:32 MST 2016

There are no plans at this time for the LPCXpresso IDE to support remote target debug.

Thanks and regards,
LPCXpresso Support
0 Kudos
Reply

1,635 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ErikC on Wed Mar 16 12:21:55 MST 2016
After connecting the LPC-Link2 to the Raspberry Pi, the dmesg command shows:

[ 1558.211543] usb 3-1: new high-speed USB device number 3 using sw-ehci
[ 1558.372795] usb 3-1: New USB device found, idVendor=1fc9, idProduct=000c
[ 1558.385854] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1558.395559] usb 3-1: Product: LPC
[ 1558.401740] usb 3-1: Manufacturer: NXP
[ 1558.408416] usb 3-1: SerialNumber: ABCD
[ 1558.421472] usbip-host 3-1:1.0: usbip-host: register new device (bus 3 dev 3 ifn 0)
[ 1578.069995] usb 3-1: lock for reset

I have executed the following commands to bind this USB device:

apt-get update && apt-get upgrade -y && apt-get install usbip -y
modprobe usbip-core
modprobe usbip-host
usbipd -D

1 root@bananapi ~ # usbip list -l                                                                                :(
- busid 3-1 (1fc9:000c)
   NXP Semiconductors : unknown product (1fc9:000c)

usbip: error: problem getting device attributes: No such file or directory
1 root@bananapi ~ # usbip --debug --log bind --busid 3-1                                                         :(
usbip: debug: /build/linux-tools-Tuhu8g/linux-tools-3.16.7-ckt20/drivers/staging/usbip/userspace/src/usbip.c:141:[run_command] running command: `bind'
usbip: debug: /build/linux-tools-Tuhu8g/linux-tools-3.16.7-ckt20/drivers/staging/usbip/userspace/libsrc/sysfs_utils.c:23:[write_sysfs_attribute] error writing to attribute /sys/bus/usb/drivers/usbip-host/bind
usbip: error: error binding device 3-1 to driver: No such device
usbip: error: could not bind device to usbip-host

Is it due to unknown device because there is no driver available for Raspberry Pi?
0 Kudos
Reply

1,635 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by djlegge on Fri Mar 11 08:57:10 MST 2016
Not really, but thanks anyway.
A recent RPI has the latest (?) usbip (usbip-utils 2.0) available via apt-get and it seems to work, as far as I can tell. The problem I have is that the (client) versions which work with Ubuntu 14.04s old kernel are all much older and don't seem to like the newer server on the RPI side.
I'm going to wait for Ubuntu 16.04 (only next month) and hopefully it will just work, as I can't spare the time to mess with it now.
Good luck..
0 Kudos
Reply

1,635 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ErikC on Fri Mar 11 08:42:07 MST 2016
Thanks for pointing to usbip.

Does the following help?

http://blog.3mdeb.com/2014/08/18/linux-rpi-and-usb-over-ip/
0 Kudos
Reply

1,635 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by djlegge on Fri Mar 11 04:49:31 MST 2016
Have a look at using usbip / usbipd on the raspberrypi. This allows you to share usb devices over ethernet.
You will have to run usbip also on your PC, in client mode. It's certainly available for linux and I think windows too.
I tried it with Ubuntu but the version of usbip supplied with Ubuntu 14.04 is too old and to work with the RPI and I lost interest at that point....should be possible though.
0 Kudos
Reply

1,635 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by miccio on Fri Mar 04 11:00:55 MST 2016
something similar to this? https://github.com/synthetos/PiOCD/wiki/Using-a-Raspberry-Pi-as-a-JTAG-Dongle
0 Kudos
Reply

1,635 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by vtw.433e on Fri Mar 04 10:47:33 MST 2016
The GDB shipped with LPCXpresso is built to run on an Intel x86 processor running Windows (or Linux or Mac, depending on the version you have downloaded). So, your first job is going to be to port GDB to ARM architecture, running on Linux (unless you can find somebody that has already done that for you)....

Update:
Your next problem is that the LPCXpresso debug software (redlinkserv) also needs to run on your Pi. That is NXP proprietary software so you will need to ask them for a version that has been ported to the Pi... I doubt that they have done that...

0 Kudos
Reply