Compiling Bela projects on the board

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.
You have to cd into the scripts/ folder before running the scripts below.

setup_board.sh

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.

Arguments:

  • -b path : changes the default path, which is otherwise ~/BeagleRT

Usage:

setup_board.sh [-b path]

Run it with
$ ./setup_board.sh

You will be prompted with
Warning: this script will DELETE any existing Bela files from your BeagleBone! Continue?

Press y to accept.

build_project.sh

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.
The source directory should contain at least one .c, .cpp or .S file.

Arguments:

  • -n : the executable will not be run after compiling.
  • -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.
  • -c : passes command-line arguments to the Bela program; enclose the argument string in quotes.
  • -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).
  • -F: runs the project in the foreground of the current terminal, without using screen

Usage:

build_project.sh [-ncfF][-b path/to/Bela/on/BBB] path/to/project/files

$ ./build_project.sh projects/your_project_folder

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.:
$ build_project.sh projects/your_project_folder/render.cpp projects/your_project_folder/extras/
# will include the render.cpp file and all the files and folders in extras/

run_project.sh

This script runs the most recently compiled Bela project on the BBB at the given path.

Arguments:

  • -b path : changes the default path, which is otherwise ~/BeagleRT.
  • -c commands : passes command-line arguments to the Bela program; enclose the argument string in quotes.
  • -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).
  • -F: runs the project in the foreground of the current terminal, without using screen

Usage:

run_project.sh [-b path] [-c "commands"] [-fF]

connect_to_project.sh

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).

set_startup.sh

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.

stop_running.sh

This script stops the Bela program running on the BeagleBone.

halt_board.sh

This script halts the BeagleBone Black. Run it and wait for the on-board LEDs to stop blinking before disconnecting the board.