Eclipse with the BeagleBone

In this post I am going to teach you how to setup Eclipse to compile code for the BeagleBone. In this setup I am going to focus on making C++ programs, therefore I am going to only focus on preparing Eclipse for C++. One thing to keep in mind is the fact that there are many different programming languages that you can use with the BeagleBone, not just C++.

To start off with, I am using a Ubuntu computer, if you dont have have Ubuntu currently installed you can look at making a VirtualBox with and Ubuntu OS.

Installing Software

The first step is going to be installing Eclipse, There are two different ways that this can be done. This first would be by going to the Eclipse website and downloading the Eclipse IDE for C++ (Download Here) The other option is to run the following command in Terminal:

sudo apt-get install eclipse

When installing Eclipse I personally took the first option and downloaded it from the website inorder to get the newest version of Eclipse.

The next step is to install the gcc complier for ARM Linux. To do so run the following command in terminal:

sudo apt-get install gcc-4.4-arm-linux-gnueabi

The next thing that we are going to do is install the C++ toolchain in Eclipse. To do this we are going to need to open eclipse, and for now we can use the default workspace. Once Eclipse is open go to Help > Install New Software

This should open a new window, under the Work With box, chose Available Software Sites

We are going to look for Programming Language > C++ Development Tools and install that one. Another optional install is the C++ Library API Documentation Hover Help.

At this time we are also going to the Mobile and Device Development drop down and install C/C++ DSF GDB Debugger Integration, C/C++ Remote Launch, Remote System Explorer End-User Runtime, and Remote System Explorer User Actions. These will be used later for remote programming and debugging.

After this is installed Eclipse should ask to restart, so do so!

Setting Up An Eclipse Project

Reopen Eclipse and set your workspace to wherever you want it and then create a new project: File > New > Project In the New Project Window chose C++ Project

Create a New Build Configuration

In the Project Explorer, right-click the project name and select Build Configurations > Manage

Click New to create a configuration for cross-compiling.

In the Name box, enter the name of the configuration (BeagleBone). Under Copy settings from, select Existing configuration and Debug.

Click OK and OK to return to the project.

Next we are going to go into the project menu at the top: Project > Properties

At the C/C++ Build item, click the arrow to expand the options and click Settings.

In the Configuration box, select BeagleBone

The next step is to click on GCC C++ Compiler and where Command is we are going to enter arm-linux-gnueabi-g++

After that go to GCC C Compiler and where Command is we are going to enter arm-linux-gnueabi-gcc

We are going to do that again at the GCC C++ Linker and where Command is we are going to enter arm-linux-gnueabi-g++

And finally we are going to go to GCC Assembler and where Command is we are going to enter arm-linux-gnueabi-as

Next we are going to add in the Includes for the compiler..

so expand C/C++ General > Paths and Symbols and make sure that the Includes tab is chosen and click on GNU C and click the Add button on the right. We should be able to enter /usr/arm-linux-gnueabi/include/ and hit OK

Next we are going to to the same for GNU C++ and click the Add button on the right. We should be able to enter /usr/arm-linux-gnueabi/include/c++/4.6.3/ and hit OK

Next we are going to click on the Library Paths tab and click Add button on the right. We should be able to enter /usr/arm-linux-gnueabi/lib/and hit OK

Click OK and to return to the project.

In the Project Explorer, right-click the project name and select Build Configurations > Set Active and select BeagleBone or whatever you named your build configuration. This should get you started on working with Eclipse and the BeagleBone. Soon I will post up how to send the file to the BeagleBone and how to remotely run and debug the program using Eclipse.

Go Top
comments powered by Disqus