Sunday, April 13, 2014

Setting up for Cross-Compilation with Eclipse (CDT)

In order to program the BBB cross-compilation is necessary. Because the system I will be using to program the board is x86 architecture and the BBB is using ARM architecutre. So I will be setting Eclipse to do this and will show the entire process that I used in order accomplish this task. I am running Ubuntu 12.04 LTS on my personal desktop to do this (not a virtual system).

Installing Eclipse (CDT)

Figure 1: Installing Eclipse
Before you can set it up you need to install it first, if you have not already. So I opened a terminal and installed Eclipse along with C/C++ development tools, and the compilers for C/C++. As can be seen in Figure 1 I already had it installed on my system. To install it though the terminal enter:      

sudo apt-get install eclipse eclipse-cdt      
sudo apt-get install g++ gcc

After doing that I had my best results by updating everything before I progressed any further.

Because we are compiling to a separate system I also needed to install these in Eclipse:

  • Remote System Explorer End-User Runtime
  • C/C++ Remote Launch
To install those I opened Eclipse and went to Help>>Install New Software. A window popped up like in Figure 2 below. I then clicked on the down arrow at the top of the page and selected Indigo Update Site. Remote System Explorer End-User Runtime is located under general purpose tools. C/C++ Remote Launch is located under Mobile and Device Development. 

Figure 2: Installing add-ons 

Making it ARM Ready

Next step I did was install the toolchain for the BBB. In the terminal I entered:

Figure 3: Checking it installed properly
sudo apt-get install gcc-arm-linux-gnueabi

sudo apt-get install g++-arm-linux-gnueabi

It takes a minute or to, but afterwards if you type arm-linux and press tab a couple times you should end up with something similar to what is shown in Figure 3.

Figure 4: Hello World
At this point a C++ project can be made in Eclipse. For first time set-up I just chose the Hello World C++ Project, that way I can test it right away, Figure 4. By clicking on the hammer to build it and the green button with a white arrow(Run) on it it should display "Hello World". To send it to the BBB you have to change the build settings. By right clicking on your project you can go to properties>>C/C++ Build>>Settings. Going back to Figure 3 I had to input the proper commands for each. Figure 5 shows all four changes that I made.  

Figure 5: Changing Build Settings

Setting up Remote Application

To send the program to run on the BBB, go to run configurations under the run button. Double click on C/C++ Remote Application and create a new connection. The remote system type is Linux, the host name should be the ip address of your BBB. The address from the USB host would be It will change if you are using the Ethernet port  and do not have a static IP setup. I have been using a static ip but will show how for the USB because I do not have it as a connection type in Eclipse. Follow the Figures on how to configure the connection.

Figure 6: Making new connection

The last part is to give it a file path. Figure 6 shows an example of how that can be done. The part marked by a blue box is what the name of the program will be inside your BBB. The red boxes are what I changed. Click run and it should send it to the BBB. It will automatically run it as soon as you send it. You can also call it from the BBB by typing ./ProgramName while ssh-ing to the BBB.

Figure 11: File Path


cross-compile-for-beaglebone-black by Michael H Leonard

No comments:

Post a Comment