Compiling Bela projects in Eclipse » History » Version 35

« Previous - Version 35/36 (diff) - Next » - Current version
Andrew McPherson, 2016-03-08 09:51 PM


Compiling Bela projects in Eclipse

This document contains information on how to compile the Bela software and upload it onto the BeagleBone Black.

Required tools

This document assumes you have the following tools installed:

On Linux

Requires:
  • Working Linux system, either running natively or on a virtual machine
  • Mercurial version control system (http://mercurial.selenic.com). Available as a package in most Linux distributions.
  • arm-gcc hardfp compiler toolchain (i.e. arm-linux-gnueabihf-gcc and similar. On Ubuntu, these can be installed from packages:
    sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
    
  • Eclipse IDE (http://www.eclipse.org), including the C/C++ development tools
  • xenomai libraries and include files are already on the BBB's SD card. You can copy them over to your machine as follows:
    cd ~
    ssh root@192.168.7.2 "cd /usr/; tar -zcvf ~/xenomai.tar.gz xenomai" 
    rsync -avz --remove-source-files root@192.168.7.2:xenomai.tar.gz .
    cd  /usr/arm-linux-gnueabihf/include/
    sudo tar -xvf ~/xenomai.tar.gz
    rm ~/xenomai.tar.gz
    
  • Make sure that the following line is in your Eclipse project's includes
    /usr/arm-linux-gnueabihf/include/xenomai/include

    and the following line is in your Eclipse project's libraries search path
    /usr/arm-linux-gnueabihf/include/xenomai/lib

On a 64bit MacOS X

  • You can get the arm cross-compiler toolchain from here http://www.welzels.de/blog/projekte/arm-cross-toolchain/, which will place the binaries into your /usr/local/linaro/arm-linux-gnueabihf/bin/ folder
  • xenomai libraries and include files are already on the BBB's SD card. You can copy them over to your machine as follows:
    cd ~ &&\
    ssh root@192.168.7.2 "cd /usr/; tar -zcvf ~/xenomai.tar.gz xenomai/include xenomai/lib include/ne10" &&\
    rsync -avz --remove-source-files root@192.168.7.2:xenomai.tar.gz . &&\
    cd /usr/local/linaro/arm-linux-gnueabihf/include &&\
    sudo tar -xvf ~/xenomai.tar.gz &&\
    sudo mv include/ne10 ./ &&\
    sudo rm -rf ./include &&\
    rm ~/xenomai.tar.gz
    
  • Make sure that the following lines are in your Eclipse project's includes
    /usr/local/linaro/arm-linux-gnueabihf/include/xenomai/include
    /usr/local/linaro/arm-linux-gnueabihf/include/ne10/

    and the following line is in your Eclipse project's libraries search path
    /usr/local/linaro/arm-linux-gnueabihf/include/xenomai/lib/

Other operating systems

You have several options:
  1. find your own way and share it here
  2. use the Ubuntu VirtualBox image provided [ask for link].
  3. compile on the board: Compiling Bela projects on the board

Getting started

  1. Make sure you own a copy of the Bela files, if you do not already:
    hg clone https://code.soundsoftware.ac.uk/hg/beaglert
    
  2. Launch Eclipse and select a workspace (creating one if necessary).
  3. In the Eclipse menu bar, choose File -> Import.... Within the dialog box that appears, choose General -> Existing Projects into Workspace. Click Next.
  4. Click the button Select root directory and choose the path to the Bela repository you just cloned.
  5. Make sure the Bela project is selected, and under Options, untick Copy projects into workspace. Click Finish to complete the project import.

Compiling the Bela project

  1. In Eclipse, right-click on the Bela project folder in the left-hand column, and choose Build Project. (If you don't see the list of projects, make sure the C/C++ Perspective is active in Eclipse, and choose Window -> Show View -> Project Explorer.)
  2. The project should compile without errors, and the results should be visible in the Console tab (typically in the bottom pane of the window)
  3. If any errors arise, check that you have all the dependencies installed, both header files and libraries.

Copying Bela projects to the BeagleBone Black

Once the project has compiled, Eclipse should automatically copy it over to the Beaglebone in the ~/BeagleRT folder, prompting you twice for the password in case you did not set up the ssh keys.
If the project is not copied automatically:
  1. open a terminal window and cd to the directory where the binary was compiled. For example, if you installed Bela in your home directory: cd ~/BeagleRT/Release
  2. Copy the Bela executable to the BeagleBone Black using scp (entering your BeagleBone Black password when prompted; you may need to create the Bela directory first):
    scp BeagleRT root@192.168.7.2:~/BeagleRT/
    

Selecting different Bela examples within the Eclipse project

The Eclipse project contains several examples within the projects directory. Follow these steps to choose which one to compile:

  1. Only one of the folders within projects should be enabled at a time. This one will be in solid black text; the remainder will be grey.
  2. Right-click on the folder which is currently enabled (solid black). Choose Resource Configurations -> Exclude from Build...
  3. Click Select All to disable the code in this folder. Click OK.
  4. Now right-click on the folder which you want to enable. Choose Resource Configurations -> Exclude from Build...
  5. Click Deselect All to enable the code in this folder. Click OK.

Creating a new executable within the Bela project

Duplicate one of the existing project folders using the following steps:

  1. Right-click the project folder you want to duplicate and select Copy.
  2. Right-click on the projects folder and select Paste. It will ask you to type in a new name.
  3. Follow the steps above (Resource Configurations) to enable compiling this new project rather than any of the others.