BBB Remote Debugging

From Klaus' wiki
Jump to: navigation, search

The general BeagleBone Black pages are here.

In the instructions below click twice on the pictures in order to get a high resolution version, that is easier to read. Two clicks are necessary because you click one time for opening the file and a second time for opening it in high resolution

gdbserver

In order to be able to debug remote the remote board needs a suitable gdbserver. There is one already onboard - or it can be downloaded using apt-get, but that one does not operate correct with the toolchain downloaded previously.

But luckily there is a suitable gdbserver included with the gnueabihf tools.

]$ scp /opt/toolchains/gnueabihf/bin/gdbserver <username>@<your BBB IP>:~/

If you set-up password-less login over SSH (see this page for details) your life will be much easier.

Copy your program to the BBB

You can test your newly developed ARM program on your BBB.

]$ scp <path to your project>/Debug/<yourbinary> <username>@<Your BBB IP address>:~

Log on to your BBB and try

]$ ./<yourbinary>

and inspect the output.

Remote debugging from Eclipse

Next thing is to set up remote debugging.

Configure Eclipse

In Eclipse select the Run menu and select Debug Configurations

RemoteDebugging2.png

First mark the C/C++ Remote debugging and then click on the new button to the upper left corner of the dialogue.

You'll get a dialogue like this:

RemoteDebugging3.png

Setup the connection

Press the New button to the right of the Connection line.

This will open a dialogue for setting up the connection to the BBB. We'll use SSH.

RemoteDebugging4.png

You can use the local IP address or any other configured for the BBB.

RemoteDebugging5.png

Returning to the main Debug Configuration dialogue you'll see that the Connection now has been filled in with the details you just provided.

RemoteDebugging6.png

Setting path on remote

Next you'll have to specify the complete path of your program to execute on the BBB. The program will be sent over the SSH connection before launching the gdbserver - so any changes made on the development host will be reflected on the binary on the BBB.

Here I just placed the binary in my home directory, but it could be anywhere suitable.

RemoteDebugging7.png

Configuring the debugger

Next thing to do is to click on the Debugger tab in the top of the dialogue. In this part of the settings you'll have to specify a complete path and name of the debugger - in this case we'll use the Linaro supplied residing in /opt/toolchains/gnueabihf

RemoteDebugging8.png

Access to shared libraries

Also click on the Shared libraries tab and click Add and navigate to /opt/toolchains/gnueabihf/libc/lib and add that. This will remove some error messages during debugging.

RemoteDebugging15.png

Path to the remote gdbserver

Adjust the path to the gdbserver on the BBB.

RemoteDebugging16.png

Launch

You are now ready to debug. Press the Debug button.

RemoteDebugging9.png

You're asked a password for your login on the BBB.

RemoteDebugging10.png

And the you're told what system you're debugging.

RemoteDebugging11.png

And finally the debugger launches the program that has been transfered to the remote BBB and the gdbserver is launched with the program a a parameter and you can debug you application just like any other application.

Use the keyboard

Finally, if you want the F11 key to launch the debugger rather than fiddling around with the mouse trying to find the little debug button, open menu Window->Preferences and locate the setting as showed on the figure below. Select the Always launch the previously launched application. After your initial launch of the application to debug subsequent launches can be done by hitting F11. I find that rather convenient.

Debug remote.png

Thanks to...

This set-up has been heavily inspired by this site and the video by D. Molloy at YouTube.