Beaglebone Black

The BeagleBone LCD7 Cape provides an LCD solution with touchscreen capability for BeagleBone boards.
http://elinux.org/CircuitCo:BeagleBone_LCD7

1


 

Cross-Compiling an Application for BeagleBone on a Linux PC

How to Cross-Compile any application program for the Angstrom Distribution of Linux running on the ARM processor populated on the BeagleBone, in your desktop (OSD):

Step1:  First step is to download the SDK used for cross-compilation from the below link:
http://www.angstrom-distribution.org/toolchains/angstrom-2011.03-i686-linux-armv7a-linux-gnueabi-toolchain.tar.bz2

Step2: Now the SDK has to be unzipped by issuing the below command from the directory in which the downloaded tar file has been stored.

$ sudo tar -C / -xjf angstrom-2011.03-i686-linux-armv7a-linux-gnueabi-toolchain.tar.bz2

This will create the new directory /usr/local/angstrom/arm/

Step3: Before we can start using the commands for compiling our source files, the build environment has to be setup by issuing the below command:

$ . /usr/local/angstrom/arm/environment-setup   (Note. Take care of the space after dot)

Step4: To cross-compile a normal C file the below command has to be issued:

$ arm-angstrom-linux-gnueabi-gcc    -o   <desired executable name>   <C-source filename>
e.g. :

$ arm-angstrom-linux-gnueabi-gcc   -o   helloworld   hello.c

Shown above is the command equivalent to gcc . The executables corresponding to such commands reside in the directory:
/usr/local/angstrom/arm/bin . In the above example an executable named helloworld will get generated after hello.c has been
successfully cross-compiled.

How to execute the application after successful cross-compilation:
After the executable helloworld has been generated, it has to be transferred to the BeagleBone to execute. The following steps need to be followed for this:

Step1: To transfer the executable from the HOST PC to BeagleBone the following command has to be issued:
$ scp <filename with path> beaglebone_user_id@BeagleBone_IP:.
e.g. :
$ scp home/aeb3kor/helloworld root@10.170.104.71:.

In the above example root is the user id of the BeagleBone .
Step2: Once the transfer has successfully happened, we can execute helloworld on the BeagleBone by issuing the command:

root@BeagleBone ~# ./helloworld

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

Leave a comment