Building your own toolchain
~ Chaitannya Mahatme
Overview of ARM architectures.
This generation introduced the Thumb 16
bit instruction set
Audio controller in the SEGA Dreamcast
DLink DSL604+ Wireless ADSL Router.
Most of Nokia's mobile phone range.
ARM moved from a von Neumann
architecture (Princeton architecture) to a
Harvard architecture with separate
instruction and data bus (and caches),
significantly increasing its potential speed.
Most important change was introduction of
MMU, POSIX complaint OS could be
All smart phones
SIMD instructions which can double
MPEG4 and audio digital signal
processing algorithm speed
Cache is physically addressed, solving
many cache aliasing problems and
reducing context switch overhead.
TI OMAP2 series processors.
All touch based smart phones.
Steps of CrossCompilation
gcc: Run the crosscompiler on the host
machine to produce assembler files for the
as: Assemble the files produced by the
ld: Link those files to make an executable.
You can do this either with a linker on the
target machine, or with a crosslinker on
the host machine.
Specifing target for your toolchain
Armv4l : This makes support for the ARM
v4 architecture, as used in the StrongARM,
ARM7TDMI, ARM8, ARM9.
Armv5l : This makes support for the ARM
v5 architecture, as used in the XScale and
In practice the target name makes almost
no practical difference to the toolchain you
Other EABI options
armnonegnueabi: this is the name as arm
noneeabi (specific to GNU compiler)
armunknowneabi: bare metal
armlinuxeabi: Designed to be used to
build programs with glibc under a Linux
environment. This would what you would
use to build programs for an embeded
linux ARM device.
Other configure options
enableinterwork This allows for
assembling Thumb and ARM code mixed
into the same binaries (for those chips that
enablemultilib Multilib allows the use of
libraries that are compiled multiple times
for different targets/build types.
EABI for Linux
GNU EABI is a new Application Binary
Interface (ABI) for Linux a.k.a Embedded
EABI specifies standard conventions for file
formats, data types, register usage, stack
frame organization, and function
parameter passing of an embedded
Why switch to EABI?
Compilers that support the EABI create
object code that is compatible with code
generated by other such compilers, thus
you can link libraries generated with with
object code generated with a different
Allows use of optimized hardfloat
functions with the system's softfloat
Uses a more efficient syscall convention,
hence faster performance.
Since it's a newly adopted standard, will be
more compatible with future tools.
Setting up build envoirnment.
Preferably use virtual box / Vmware.
Create a new user for the installation.
Set up the configure parameters in the
Create separate dir for build and source.
Set PREFIX dir
Install all the dependencies.
The list of dependencies is on gcc.org
Mandatory dependencies are GMP and
The configure option withnewlib tells gcc
we are using newlib (see below) and
withoutheaders tells GCC not to rely on
any C library (standard or runtime) being
present for the target.
Before doing any configuring or compiling,
you must set the C compiler that you’re
using to be your crosscompiler, otherwise
glibc will compile as a horrible mix of ARM
code and native code
Installing gcc: Part II
Add compiler to path variable
Get more info on