<p>You need (at least) a toolchain if you decide to build <b>eLua</b> yourself. The toolchain must contain at least a compiler, an assembler, a linker and (most likely) a tool to extract binary
data from the compiled image (in order to build the actual firmware). Also, a program that reports the sizes of different sections in the compiled image is often used to give an idea about the
resource consumption of <b>eLua</b>. You can use as many toolchains as you want for a given target, as long as the build scripts know to handle them. This
section outlines the different toolchain choices available for compiling <b>eLua</b>. Use the links below to navigate directly to your target of interest.</p>
<li>build your own toolchain. Even if you have a toolchain already available, you might want to do this for maximum flexibility and control (for example to control the libc build flags, or to
<li>use a readily available toolchain. This saves you the hassle of building the toolchain yourself, which makes the process quicker and less error-prone.</li>
<p>Because building a toolchain is already covered in another section of the documentation, we'll focus on installing a pre-compiled toolchain here. ARM is a very popular architecture, and because
of this there are a lot of toolchains available for download free of charge. One of the most popular ones comes from <ahref="http://www.codesourcery.com">CodeSourcery</a>, and we'll cover it here for a number of important reasons:</p>
<li>go to <ahref="http://www.codesourcery.com/sgpp/lite/arm/portal/subscription?@template=lite">the CodeSourcery download location</a> for the toolchain.</li>
<li>select from the table the current version in the "EABI" line (the link to the current version is just above the "All versions..." link).</li>
<p>That's all! Make sure that the location of the toolchain is in your $PATH and build <b>eLua</b> with the <b>toolchain=codesourcery</b> option.</p>
<aname="avr32"><h2>Toolchains for AVR32</h2></a>
<p>Currently you have only one option for AVR32: download and install the toolchain from <ahref="http://www.atmel.com">Atmel</a>. Unfortuntely they don't provide an installer, just a bunch of
Linux packages with some dependencies, so the installation process might be a bit tricky. These are the steps you should follow to install Atmel's AVR32 toolchain:</p>
<li>download the correct version for your Linux distribution (in this case Ubuntu) from <ahref="http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4118">here</a>.</li>
<li>unzip the downloaded archive to a temporary directory, you'll get a bunch of .deb packages</li>
<li>install the packages from this command line (the package names are based on version 2.1.4 of the toolchain, change them as needed if you're using a different version):
<p>Currently the only tested procedure for building <b>eLua</b> for i386 is to <ahref="tc_386.html">build an i386 toolchain</a>. Other toolchains might work equally well though, but none was tested so far.
<p>The <b>eLua</b> build system makes provisions for specifying an unlimited number of toolchains for a given target, selectable via the scons <b>toolchain=...</b> option. The default structure
<p>If you need to add a new toolchain or modify an existing one, take a look at the scons build script (SConstruct). A toolchain-related fragment of SConstruct is shown below:</p>
<p>From this fragment it's easy to understand that there are at most two places in SConstruct that must be taken into account when dealing with toolchain:</p>
<li>the definition of <b>toolchain_list</b>. This is a list of all the supported toolchains with all their relevant components (compiler, linker, assembler, image copy tool and size tool).</li>
<li>each <b>eLua</b> platform has a list of permitted toolchains (only the toolchains specified in this list can be used to build an <b>eLua</b> image for that target). The first element of
this list will be automatically used if a <b>toolchain=...</b> option is not specified on the command line.</li>
<p>Please note that in order to add a new toolchain to <b>eLua</b> it's generally not enough to edit just SConstruct. As different toolchains have different command line options, one should also
edit the platform's build configuration file (<i>src/platform/<platform name>/conf.py</i>) and make it aware of the new toolchain. The exact procedure for doing this is highly dependent on
the toolchain and it's well beyond the scope of this tutorial.</p>