Launch cross-compiled executable on Raspberry Pi from Eclipse

If you have cross compiled your source files as described in the former post, then you probably want to execute your cross compiled binaries on the target machine. The simplest and most time consuming way is just to manually copy over the binaries to Raspberry Pi. Luckily you can save some time, since the Eclipse has a built-in support to copy and execute the binaries remotely. In order to do this just follow the description below.

Run Configuration
Open the “Run Configuration” menu and create a new “C/C++ Remote Application”. As you can see the “Connection” dropdown will be empty by default, and we need to setup a connection to Raspberry Pi.

Default Run Configuration with empty Connection

New Linux Connection
To create a connection click on the “New” button next to the connection dropdown box and select the Linux Connection and configure the connection as shown on the following screenshots.

Configure Raspberry Pi host name (rpi already present in /etc/hosts)

Files Menu

Processes Menu

Shells Menu

SSH Terminals Menu

Remote File setup
You need to setup the location of remote file by clicking on the “Browse” button. Please note that the full qualified path can be browsed, but you need to type the binary executable name as well. In other words the “Remote Absolute File Path for C/C++ Application” field shall contain a path like /home/pi/Workspace/helloworld where the helloworld is the name of the binary executable. It is also important that the directories must be present on the target system and the user what you are using to connect must have sufficient rights to copy the file to that directory.

Properly configured Run Configuration dialog

Run the executable remotely
When you click on the “Run” button, then Eclipse will transfer the executable to the target machine, launch it and display the standard error and output on the Eclipse console:

Console out in Eclipse

Note: As an alternative you can share the data with sshfs or nfs between your workstation and target board.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: