<p><spanclass="warning">NOTE</span>: these instructions are obsolete. Most likely,
they are not applicable to newer versions of the various components (binutils, gcc,
newlib). If you need an ARM toolchain, there is rarely a need to build one yourself.
Instead, get a pre-built one, for example from <ahref="http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/request?id=e023fac2-e611-476b-a702-90eabb2aeca8&downloadlite=scblite2012&fmpath=/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/form">Mentor Graphics</a> or
<p>This tutorial explains how you can create a GCC+Newlib toolchain
that can be used to compile programs for the Cortex (Thumb2)
architecture, thus making it possible to use GCC to compile programs
for the increasingly number of Cortex CPUs out there (<ahref="http://www.luminarymicro.com/">Luminary Micro</a>, i
<ahref="http://www.st.com/mcu/inchtml-pages-stm32.html">ST</a>, with new Cortex CPUs being announced by Atmel and other companies). I
am writing this tutorial because I needed to work on a Cortex CPU for
the eLua project and I couldn't find anywhere a complete set of
instructions for building GCC for this architecture. You'll need such a
toolchain if you want to compile <b>eLua</b> for Cortex-M3 CPUs. Please note that you can also use a
pre-built toolchain to compile <b>eLua</b> (see <ahref="toolchains.html">toolchains</a> for details) so building
one yourself is not strictly required.</p>
<p><spanclass="warning">DISCLAIMER</span>: I'm by no means a specialist in the
GCC/newlib/binutils compilation process. I'm sure that there are better
ways to accomplish what I'm describing here, however I just wanted a
quick and dirty way to build a toolchain, I have no intention in
becoming too intimate with the build process. If you think that what I
did is wrong, inaccurate, or simply outrageously ugly, feel free to <ahref="overview.html#contacts">contact us</a> and I'll make the necessary corrections.
And of course, this tutorial comes without any guarantees whatsoever.</p>
<h2>Prerequisites</h2>
<p>To build your toolchain you'll need:</p>
<ul><li><b>a computer running Linux</b>: I use Ubuntu, but any Linux
will do as long as you know how to find the equivalent of "apt-get" for
your distribution. I won't be going into details about this, google it
and you'll sure find what you need. It is also assumed that the Linux
system already has a "basic" native toolchain installed (gcc/make and
related). This is true for Ubuntu after installation. Again, you might
need to check your specific distribution.</li>
<li><b>GNU binutils</b>: get it from <ahref="http://ftp.gnu.org/gnu/binutils/">here</a>.
At the moment of writing this, the latest versions is 2.19.1, but it refuses to compile for ARM. Same goes for
2.19. In fact, the only newer version of Binutils that seems to work properly is
2.19.50, it can be downloaded from <ahref="ftp://sourceware.org/pub/binutils/snapshots/">here</a>.
This is the version that we are going to use in this tutorial.</li>
<li><b>GCC</b>:as I'm writing this, the latest GCC version is
4.3.3, which I'll be using for this tutorial. Download it from <ahref="http://gcc.gnu.org/mirrors.html">here</a> after choosing a suitable mirror.</li>
<li><b>Newlib</b>: as I'm writing this, the latest official Newlib version is 1.17.0, which I'll be using for this tutorial.
Download it from <ahref="ftp://sources.redhat.com/pub/newlib/index.html">here</a>.</li>
<li>The tutorial assumes that you're using bash as your shell. If you use
something else, you might need to adjust some shell-specific commands. </li></ul>
<p>You need some support programs/libraries in order to compile the toolchain. To install them:</p>