Compiling Bela projects on the board » History » Version 4

Giulio Moro, 2015-07-17 11:19 PM

1 1 Giulio Moro
h1.  Compiling BeagleRT projects on the board
2 1 Giulio Moro
3 1 Giulio Moro
A number of shell scripts are available in the scripts/ folder that allow you to edit your C++ files on the host machine, copy them over to the BBB and have your project built on the BBB without the need to install any tools on your host.
4 1 Giulio Moro
5 1 Giulio Moro
h2. @setup_board.sh@
6 1 Giulio Moro
7 1 Giulio Moro
This script copies the core BeagleRT files to the BeagleBone, REMOVING any previous files found at that location. This should be done before running any of the other build scripts in this directory.
8 1 Giulio Moro
9 1 Giulio Moro
10 1 Giulio Moro
h3. Arguments:
11 1 Giulio Moro
12 1 Giulio Moro
* *-b path* : changes the default path, which is otherwise ~/BeagleRT
13 1 Giulio Moro
14 1 Giulio Moro
h3. Usage:
15 1 Giulio Moro
<pre>
16 1 Giulio Moro
setup_board.sh [-b path]
17 1 Giulio Moro
</pre>
18 1 Giulio Moro
Run it with
19 1 Giulio Moro
<pre>
20 1 Giulio Moro
$ scripts/setup_board.sh
21 1 Giulio Moro
</pre>
22 1 Giulio Moro
You will be prompted with 
23 1 Giulio Moro
<pre>
24 1 Giulio Moro
Warning: this script will DELETE any existing BeagleRT files from your BeagleBone! Continue?
25 1 Giulio Moro
</pre>
26 1 Giulio Moro
Press *y* to accept.
27 1 Giulio Moro
28 1 Giulio Moro
29 1 Giulio Moro
h2. @build_project.sh@
30 1 Giulio Moro
31 1 Giulio Moro
This script copies a directory of source files to the BeagleBone, compiles and runs it. The BeagleRT core files should have first been copied over using the @setup_board.sh@ script supplied with BeagleRT.
32 1 Giulio Moro
The source directory should contain at least one .c, .cpp or .S file.
33 1 Giulio Moro
34 1 Giulio Moro
h3. Arguments:
35 1 Giulio Moro
* *-n* : the executable will not be run after compiling.
36 1 Giulio Moro
* *-b path* : will change the local path on the BeagleBone where the BeagleRT files are found (must match the one used for @setup_board.ssh@.
37 1 Giulio Moro
* *-c* : passes command-line arguments to the BeagleRT program; enclose the argument string in quotes.
38 1 Giulio Moro
39 1 Giulio Moro
h3. Usage:
40 2 Giulio Moro
41 1 Giulio Moro
<pre>
42 1 Giulio Moro
build_project.sh [-nc][-b path/to/BeagleRT/on/BBB] path/to/project/files
43 1 Giulio Moro
</pre>
44 1 Giulio Moro
<pre>
45 1 Giulio Moro
$ scripts/build_project.sh projects/your_project_folder
46 1 Giulio Moro
</pre>
47 1 Giulio Moro
you can list a mix of files and folders. These will be all copied to the ~/BeagleRT/source folder before compiling the project, e.g.:
48 1 Giulio Moro
<pre>
49 1 Giulio Moro
$ scripts/build_project.sh projects/your_project_folder/render.cpp projects/your_project_folder/extras/
50 1 Giulio Moro
# will include the render.cpp file and all the files and folders in extras/
51 1 Giulio Moro
</pre>
52 1 Giulio Moro
53 2 Giulio Moro
54 2 Giulio Moro
h2. @run_project.sh@
55 2 Giulio Moro
56 1 Giulio Moro
This script runs the most recently compiled BeagleRT project on the BBB at the given path.
57 4 Giulio Moro
58 1 Giulio Moro
h3. Arguments
59 1 Giulio Moro
* *-b path* : changes the default path, which is otherwise ~/BeagleRT. 
60 1 Giulio Moro
* *-c commands* : passes command-line arguments to the BeagleRT program; enclose the argument string in quotes.
61 1 Giulio Moro
* *-f* : runs the project in the foreground of the current terminal, within a screen session that can be detached later (ctrl-a ctrl-d to detach from the screen session).
62 4 Giulio Moro
63 1 Giulio Moro
h3. Usage
64 1 Giulio Moro
<pre>
65 1 Giulio Moro
run_project.sh [-b path] [-c "commands"] [-f]
66 1 Giulio Moro
</pre>
67 1 Giulio Moro
68 2 Giulio Moro
69 2 Giulio Moro
h2. @connect_to_project.sh@
70 2 Giulio Moro
71 1 Giulio Moro
This script brings an already running BeagleRT program to the foreground in the terminal, so it can be run interactively (e.g.: you can display the standard output).
72 4 Giulio Moro
73 1 Giulio Moro
h3. Usage:
74 1 Giulio Moro
<pre>
75 1 Giulio Moro
$ scripts/connect_to_project.sh
76 1 Giulio Moro
</pre>
77 1 Giulio Moro
78 1 Giulio Moro
79 2 Giulio Moro
h2. @set_startup.sh@
80 1 Giulio Moro
81 2 Giulio Moro
This script enables or disables running BeagleRT when the board starts up. Run it to make your script start automatically every time you power up the board.
82 1 Giulio Moro
83 2 Giulio Moro
84 2 Giulio Moro
h2. @stop_running.sh@
85 2 Giulio Moro
86 2 Giulio Moro
This script stops the BeagleRT program running on the BeagleBone.
87 2 Giulio Moro
88 2 Giulio Moro
89 2 Giulio Moro
h2. @halt_board.sh@
90 3 Giulio Moro
91 1 Giulio Moro
This script halts the BeagleBone Black. Run it and wait for the on-board LEDs to stop blinking before disconnecting the board.