Wiki

Clone wiki

roseline / Tutorial 2 - Compiling applications on the platform

Overview

The OMAP AM3359 processor used by the BeagleBone Black has an architecture type armhf, which is a different architecture than desktop PCs -- typically, i386 or amd64. This means that binaries compiled for your desktop architecture will not run on the board.

The easiest way to build an application for the BeagleBone Black is to compile it on the platform itself. However, there are also some disadvantages to doing this: compilation takes quite some time as you are limited to 1GHz / 512MB RAM, and you'll need to copy the code over to the platform each time.

You'll first want to copy your code and make files to a folder /root/my_code on the BeagleBone, using SCP or a GUI such as Filezilla (sudo apt-get install filezilla on host PC). Then, you'll want to SSH into the BeagleBone and compile the code from the command line. Assuming you have a makefile project, and aaa.bbb.ccc.ddd is the IP of your BeagleBone:

ssh root@aaa.bbb.ccc.ddd
password: roseline
apt-get install build-essential g++ c++
cd /root/test_code
make

If you find it a hassle to copy to and from the board, then you'll probably want to mount an NFS share from your host PC. If you find that it takes too long to compile code on the board, then you'll probabyl want to set up a cross-compiler to compile armhf code on your host PC. Both of these things are covered in later tutorials.

Updated