We will need to use cross compiler to build the application on X86 machine, in cases that the application is big enough that the building process on pcDuino3 itself will take too much time.
To do the cross compilation for a pcDuino3 with Lbuntu 12, we must do that on a X86 PC with Ubuntu 12.04. It can be either 32 bit or 64 bit. But it must be Ubuntu 12.04. The toolchain that we are going to use isĀ arm-linux-gnueabihf-gcc /g++ 4.6.3.
1. Install gcc cross compile tool on Ubuntu12.04
$sudo apt-get install gcc-arm-linux-gnueabihf
2. Install g++ cross compile toolchain on Ubuntu12.04
$sudo apt-get install g++-arm-linux-gnueabihf
3. Cross compile:
Open a file by ryping ‘$vi helloword.c’.
Enter the following code:
#include <stdio.h> int main(void) { printf("Hello World!\n"); }
4. Build the code:
$arm-linux-gnueabihf-gcc helloword.c -o helloword
Now we can copy helloword to pcDuino3 and execute it there.
Leave a Reply
You must be logged in to post a comment.