How to crosscompile a hello world C program for ARM

Embed101 picture Embed101 · Jan 14, 2014 · Viewed 11.7k times · Source

I have this simple program with its sources in a 'src' folder and the includes in the 'inc' folder. Normally i compile this with:

gcc -I../inc *.c

This leaves 'a.out' as program which works fine on that pc.

But how do i compile this for my BeagleBone Black (ARM)? With this i am thinking about:

gcc (some arguments to crosscompile for arm) -I../inc *.c

Answer

auselen picture auselen · Jan 14, 2014

Since you say you can use make CROSS_COMPILE=arm-linux-gnueabi- ARCH=arm uImage you should have arm gnueabi toolchain available at your disposal. It should be then as easy as calling it like

arm-linux-gnueabi-gcc -I../inc *.c