In the article on the Debian environment we prepared the linux machine for the development of embedded systems
Debian development envinronment
In the article on building an image for the Orange PI PC we installed the cross build tools for armhf environment
Building Armbian for Orange PI PC
Starting from the clean image of the Debian envinronment we list the steps required to install the cross compiling environment. We log on Debian Desktop as sviluppo/ password.
As a preliminary step we install the cross toolchains in Debian
https://wiki.debian.org/CrossToolchains
Create the file crosstools.list in the /etc/apt/sources.list.d folder
1 |
sudo vi /etc/apt/sources.list.d/crosstools.list |
and add the line
1 |
deb http://emdebian.org/tools/debian/ jessie main |
Save the file and add the key of the repository embedian.org
1 |
sudo apt-get install curl |
1 |
curl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add - |
Install the following packages and add the armhf architecture
1 2 3 |
sudo dpkg --add-architecture armhf sudo apt-get update sudo apt-get install crossbuild-essential-armhf |
We install at this point the Eclipse IDE for Cpp downloading the IDE for Linux 64bit
Unzip the eclipse package under / home /sviluppo.
Install the jre java
1 |
sudo vi /etc/apt/sources.list |
Add the line at the end of the file
1 2 3 |
# Backport Testing on stable # JDK 8 deb http://ftp.de.debian.org/debian jessie-backports main |
Run the following commands
1 2 |
sudo apt-get update sudo apt-get install openjdk-8-jre |
Run Eclipse from the eclipse folder to start the IDE
As a first example we create a simple program in C for BeagleBone.
Create a new project in C, by inserting the following data
Enter the cross compiler prefix and path
Press Finish.
Add to the project a source file in C
Insert the following simple code
1 2 3 4 5 6 7 |
#include <stdio.h> int main() { printf("Hello, world.\n"); return 0; } |
Proceed with the build by selecting the project with the right mouse button and choosing Build Project
Transfer the generated files on BeagleBone. You can use scp or ftp.
Give execution permissions to the file and run it
1 2 |
chmod +x samplec ./samplec |
The result is of course the text inserted in the code