Compiling Bela projects on the board » History » Version 11

Giulio Moro, 2015-12-25 10:59 AM

1 10 Giulio Moro
h1.  Compiling Bela projects on the board
2 1 Giulio Moro
3 10 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. This way you can, e.g.: keep using your favourite text editor and feel a bit geek on the CLI.
4 10 Giulio Moro
You have to cd into the @scripts/@ folder before running the scripts below.
5 1 Giulio Moro
6 1 Giulio Moro
h2. @setup_board.sh@
7 1 Giulio Moro
8 11 Giulio Moro
This script copies the core Bela 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.
9 1 Giulio Moro
10 1 Giulio Moro
11 1 Giulio Moro
h3. Arguments:
12 1 Giulio Moro
13 1 Giulio Moro
* *-b path* : changes the default path, which is otherwise ~/BeagleRT
14 1 Giulio Moro
15 1 Giulio Moro
h3. Usage:
16 5 Giulio Moro
17 1 Giulio Moro
<pre>
18 1 Giulio Moro
setup_board.sh [-b path]
19 1 Giulio Moro
</pre>
20 1 Giulio Moro
Run it with
21 1 Giulio Moro
<pre>
22 7 Giulio Moro
$ ./setup_board.sh
23 1 Giulio Moro
</pre>
24 1 Giulio Moro
You will be prompted with 
25 1 Giulio Moro
<pre>
26 11 Giulio Moro
Warning: this script will DELETE any existing Bela files from your BeagleBone! Continue?
27 1 Giulio Moro
</pre>
28 1 Giulio Moro
Press *y* to accept.
29 1 Giulio Moro
30 1 Giulio Moro
31 1 Giulio Moro
h2. @build_project.sh@
32 1 Giulio Moro
33 11 Giulio Moro
This script copies a directory of source files to the BeagleBone, compiles and runs it. The Bela core files should have first been copied over using the @setup_board.sh@ script supplied with Bela.
34 1 Giulio Moro
The source directory should contain at least one .c, .cpp or .S file.
35 1 Giulio Moro
36 1 Giulio Moro
h3. Arguments:
37 5 Giulio Moro
38 1 Giulio Moro
* *-n* : the executable will not be run after compiling.
39 11 Giulio Moro
* *-b path* : will change the local path on the BeagleBone where the Bela files are found (must match the one used for @setup_board.ssh@.
40 11 Giulio Moro
* *-c* : passes command-line arguments to the Bela program; enclose the argument string in quotes.
41 8 Andrew McPherson
* *-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).
42 8 Andrew McPherson
* *-F*: runs the project in the foreground of the current terminal, without using screen
43 1 Giulio Moro
44 1 Giulio Moro
h3. Usage:
45 2 Giulio Moro
46 1 Giulio Moro
<pre>
47 11 Giulio Moro
build_project.sh [-ncfF][-b path/to/Bela/on/BBB] path/to/project/files
48 1 Giulio Moro
</pre>
49 1 Giulio Moro
<pre>
50 7 Giulio Moro
$ ./build_project.sh projects/your_project_folder
51 1 Giulio Moro
</pre>
52 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.:
53 1 Giulio Moro
<pre>
54 7 Giulio Moro
$ build_project.sh projects/your_project_folder/render.cpp projects/your_project_folder/extras/
55 1 Giulio Moro
# will include the render.cpp file and all the files and folders in extras/
56 1 Giulio Moro
</pre>
57 1 Giulio Moro
58 2 Giulio Moro
59 2 Giulio Moro
h2. @run_project.sh@
60 2 Giulio Moro
61 11 Giulio Moro
This script runs the most recently compiled Bela project on the BBB at the given path.
62 1 Giulio Moro
63 5 Giulio Moro
h3. Arguments:
64 5 Giulio Moro
65 1 Giulio Moro
* *-b path* : changes the default path, which is otherwise ~/BeagleRT. 
66 11 Giulio Moro
* *-c commands* : passes command-line arguments to the Bela program; enclose the argument string in quotes.
67 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).
68 8 Andrew McPherson
* *-F*: runs the project in the foreground of the current terminal, without using screen
69 1 Giulio Moro
70 5 Giulio Moro
h3. Usage:
71 5 Giulio Moro
72 1 Giulio Moro
<pre>
73 9 Andrew McPherson
run_project.sh [-b path] [-c "commands"] [-fF]
74 1 Giulio Moro
</pre>
75 1 Giulio Moro
76 1 Giulio Moro
77 1 Giulio Moro
h2. @connect_to_project.sh@
78 1 Giulio Moro
79 11 Giulio Moro
This script brings an already running Bela program to the foreground in the terminal, so it can be run interactively (e.g.: you can display the standard output).
80 1 Giulio Moro
81 2 Giulio Moro
h2. @set_startup.sh@
82 1 Giulio Moro
83 11 Giulio Moro
This script enables or disables running Bela when the board starts up. Run it to make your script start automatically every time you power up the board. If the *-n* argument is passed, auto-running at startup is disabled. Otherwise, it is enabled. Like @run_project.sh@, the *-c* argument allows command line arguments to be passed to the program. The *-l* argument will run the Bela program in a loop, automatically restarting it if it quits or crashes.
84 1 Giulio Moro
85 2 Giulio Moro
86 2 Giulio Moro
h2. @stop_running.sh@
87 2 Giulio Moro
88 11 Giulio Moro
This script stops the Bela program running on the BeagleBone.
89 2 Giulio Moro
90 2 Giulio Moro
91 2 Giulio Moro
h2. @halt_board.sh@
92 3 Giulio Moro
93 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.