ARM cross-compiler » History » Version 3

« Previous - Version 3/4 (diff) - Next » - Current version
Vanč Levstik, 14.01.2011 21:18


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.

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

Getting and compiling Buildroot

You can get our Buildroot here: Buildroot-FRISMS
Then you just extract the Buildroot, move into that folder and do:
#make
Compiling takes some time, check that there are no errors.

Compiling our programs

After compiling Buildroot is done, you should add: \PATH_TO_YOUR_FOLDER\buildroot-2009.11-fri\output\staging\usr\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):

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