ARM cross-compiler » History » Version 3

Version 2 (Vanč Levstik, 14.01.2011 15:02) → Version 3/4 (Vanč Levstik, 14.01.2011 21:18)

h1. Tutorial for cross-compiling for our ARM processor.

Just a short tutorial helping you build Buildroot that compiles programs for ARM. It is made for Ubuntu Linux, but should work on other distros too.

h2. To build the Buildroot

With @apt-get install@, you should get yourself following packages (you probably have some of them already, but just to be sure):
* build-essential - this installs a complete build environment
* libssl-dev
* libncurses-dev
* bison
* flex
* texinfo
* zlib1g-dev
* gettext
* autoconf
* wget
* patch

Then you should set your shell to bash instead of dash, you do this with:
@#sudo dpkg-reconfigure dash@
And then select No

h2. Getting and compiling Buildroot

You can get our Buildroot here: "Buildroot-FRISMS":http://laps.fri.uni-lj.si/fri-sms/datoteke/buildroot-2009.11-fri.tar.bz2
Then you just extract the Buildroot, move into that folder and do:
#make
Compiling takes some time, check that there are no errors.

h2. Compiling our programs

After compiling Buildroot is done, you should add: @\PATH_TO_YOUR_FOLDER\buildroot-2009.11-fri\output\staging\usr\bin@ @\PATH_TO_YOUR_FOLDER\buildroot-2009.11-fri\output\staging\bin@ into your enviroment variable (PATH)
Then your Makefile for compiling programs should look something like this (made for simple helloworld with name main.c):

<pre>
CC=arm-linux-gcc
CFLAGS=-I. --sysroot=/PATH_TO_YOUR_FOLDER/buildroot-2009.11-fri/output/staging
OBJ=main.o

%.o: %.c
$(CC) -c -o $@ $< $(CFLAGS)
main: $(OBJ)
$(CC) -o $@ $^ $(CFLAGS)
.PHONY: clean
clean:
rm -f *.o *~ main
</pre>