Compiling Bela projects in Eclipse » History » Version 10

Andrew McPherson, 2014-11-07 11:25 PM

1 1 Andrew McPherson
h1.  Compiling projects with BeagleRT
2 1 Andrew McPherson
3 1 Andrew McPherson
This document contains information on how to compile the BeagleRT software and upload it onto the BeagleBone Black.
4 1 Andrew McPherson
5 1 Andrew McPherson
h2. Required tools
6 1 Andrew McPherson
7 3 Andrew McPherson
This document assumes you have the following tools installed:
8 3 Andrew McPherson
9 1 Andrew McPherson
* Working Linux system, either running natively or on a virtual machine
10 3 Andrew McPherson
* Mercurial version control system (http://mercurial.selenic.com). Available as a package in most Linux distributions.
11 1 Andrew McPherson
* arm-gcc hardfp compiler toolchain (i.e. @arm-linux-gnueabihf-gcc@ and similar. On Ubuntu, these can be installed from packages:
12 1 Andrew McPherson
<pre>
13 1 Andrew McPherson
sudo apt-get install gcc-arm-linux-gnueabihf
14 1 Andrew McPherson
sudo apt-get install g++-arm-linux-gnueabihf
15 2 Andrew McPherson
</pre>
16 6 Andrew McPherson
* Eclipse IDE (http://www.eclipse.org), including the C/C++ development tools
17 1 Andrew McPherson
* Xenomai libraries compiled for ARM hardfp _(details to come)_
18 3 Andrew McPherson
19 3 Andrew McPherson
h2. Getting started
20 3 Andrew McPherson
21 3 Andrew McPherson
# Clone the BeagleRT files from the repository:
22 3 Andrew McPherson
<pre>
23 3 Andrew McPherson
hg clone https://code.soundsoftware.ac.uk/hg/beaglert
24 3 Andrew McPherson
</pre>
25 3 Andrew McPherson
# Launch Eclipse and select a workspace (creating one if necessary).
26 4 Andrew McPherson
# In the Eclipse menu bar, choose _File -> Import..._. Within the dialog box that appears, choose _General -> Existing Projects into Workspace_. Click _Next_.
27 4 Andrew McPherson
# Click the button _Select root directory_ and choose the path to the BeagleRT repository you just cloned.
28 1 Andrew McPherson
# Make sure the @BeagleRT@ project is selected, and under Options, untick _Copy projects into workspace_. Click _Finish_ to complete the project import.
29 6 Andrew McPherson
30 6 Andrew McPherson
h2. Compiling the BeagleRT project
31 6 Andrew McPherson
32 6 Andrew McPherson
# In Eclipse, right-click on the @BeagleRT@ 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_.)
33 6 Andrew McPherson
# The project should compile without errors, and the results should be visible in the Console tab (typically in the bottom pane of the window)
34 6 Andrew McPherson
# If any errors arise, check that you have all the dependencies installed, both header files and libraries.
35 6 Andrew McPherson
36 6 Andrew McPherson
h2. Copying BeagleRT projects to the BeagleBone Black
37 6 Andrew McPherson
38 6 Andrew McPherson
# Once the project has compiled, open a terminal window and @cd@ to the directory where the binary was compiled. For example, if you installed BeagleRT in your home directory: @cd ~/BeagleRT/Release@
39 8 Andrew McPherson
# Copy the BeagleRT executable to the BeagleBone Black using @scp@ (entering your BeagleBone Black password when prompted; you may need to create the @beaglert@ directory first):
40 6 Andrew McPherson
<pre>
41 1 Andrew McPherson
scp BeagleRT root@192.168.7.2:~/beaglert/
42 7 Andrew McPherson
</pre>
43 7 Andrew McPherson
# The first time you install BeagleRT, you also need to copy the @pru_rtaudio.bin@ file to the BeagleBone Black. This can be found at the top level of the BeagleRT repository, and it should be copied to the same directory on the BeagleBone where the BeagleRT executable is located:
44 7 Andrew McPherson
<pre>
45 7 Andrew McPherson
scp pru_rtaudio.bin root@192.168.7.2:~/beaglert/
46 6 Andrew McPherson
</pre>
47 9 Andrew McPherson
48 9 Andrew McPherson
h2. Selecting different BeagleRT examples within the Eclipse project
49 9 Andrew McPherson
50 9 Andrew McPherson
The Eclipse project contains several examples within the @projects@ directory. Follow these steps to choose which one to compile:
51 9 Andrew McPherson
52 9 Andrew McPherson
# 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.
53 9 Andrew McPherson
# Right-click on the folder which is currently enabled (solid black). Choose _Resource Configurations -> Exclude from Build..._
54 9 Andrew McPherson
# Click _Select All_ to disable the code in this folder. Click _OK_.
55 9 Andrew McPherson
# Now right-click on the folder which you want to enable. Choose _Resource Configurations -> Exclude from Build..._
56 9 Andrew McPherson
# Click _Deselect All_ to enable the code in this folder. Click _OK_.
57 10 Andrew McPherson
58 10 Andrew McPherson
h2. Creating a new executable within the BeagleRT project
59 10 Andrew McPherson
60 10 Andrew McPherson
Duplicate one of the existing project folders using the following steps:
61 10 Andrew McPherson
62 10 Andrew McPherson
# Right-click the project folder you want to duplicate and select _Copy_.
63 10 Andrew McPherson
# Right-click on the @projects@ folder and select _Paste_. It will ask you to type in a new name.
64 10 Andrew McPherson
# Follow the steps above (_Resource Configurations_) to enable compiling this new project rather than any of the others.