From: eLinux.org
A toolchain is a set of distinct software development tools that are linked (or chained) together by specific stages such as GCC, binutils and glibc (a portion of the GNU Toolchain). Optionally, a toolchain may contain other tools such as a Debugger or a Compiler for a specific programming language, such as ,C++. Quite often, the toolchain used for embedded development is a cross toolchain, or more commonly known as a cross compiler. All the programs (like GCC) run on a host system of a specific architecture (such as x86) but produce binary code (executables) to run on a different architecture (e.g. ARM). This is called cross compilation and is the typical way of building embedded software. It is possible to compile natively, running gcc on your target. Before searching for a prebuilt toolchain or building your own, it's worth checking to see if one is included with your target hardware's Board Support Package (BSP) if you have one.
When talking about toolchains, one must distinguish three different machines :
From these three different machines, we distinguish four different types of toolchain building processes :
The GNU Binutils are the first component of a toolchain. The GNU Binutils contains two very important tools :
Binutils also contains a couple of other binary file manipulation or analysis tools, such as objcopy, objdump, nm, readelf, strip, and so on. The Binutils website has some documentation on all these tools.
The second major component of a toolchain is the compiler. In the embedded Linux, the only realistic solution today is GCC, the GNU Compiler Collection. Nowadays, as input, it not only supports C, but also C++, Java, Fortran, Objective-C and Ada. As output, it supports a very wide range of architectures.
The C library implements the traditional POSIX API that can be used to develop userspace applications. It interfaces with the kernel through system calls, and provides higher-level services.
Realistically, there are nowadays two options for the C Library:
The C library has a special relation with the C compiler, so the choice of the C library must be done when the toolchain is generated. Once the toolchain has been built, it is no longer possible to switch to another library.
The debugger is also usually part of the toolchain, as a cross-debugger is needed to debug applications running on your target machine. In the embedded Linux world, the typical debugger is GDB.
Free Pascal is a professional but free 32 bit / 64 bit compiler for Pascal and ObjectPascal. It supports a wide variety of processors and Linux distributions including the Raspberry Pi.
The Free Pascal toolchain is widely independent from GCC and other external tools. Major components are the Free Pascal compiler (FPC), a command-line tool, a text-mode IDE and, as an optional component, Lazarus, a full-featured GUI-based IDE. FPCUnit is a framework allowing for unit-testing.
On most platforms Free Pascal makes use of the GDB debugger.
There are several ways to get a toolchain :
CodeSourcery develops Sourcery G++, an Eclipse based Integrated Development Environment (IDE) that incorporates the GNU Toolchain (gcc, gdb, etc.) for cross development for numerous target architectures. CodeSourcery provides a "lite" version for ARM, Coldfire, MIPS, SuperH and Power architectures. The toolchains are always very up to date. CodeSourcery contributes enhancements it makes to the GNU Toolchain upstream continually, making it the single largest (by patch count) corporate contributor.
Linaro releases optimized toolchains for recent ARM CPUs (Cortex A8, A9...). These include Linaro's latest contributions to mainline gcc, but backported to stable gcc versions for immediate use by product developers. Linaro actually hires CodeSourcery people to improve ARM toolchains, so the ARM toolchains that you get with Linaro should be at least as good as the CodeSourcery ones.
Native toolchains are available through the standard gcc toolchain in Ubuntu. Cross toolchains are available to Ubuntu users through special packages:
sudo add-apt-repository ppa:linaro-maintainers/toolchain
sudo apt-get install gcc-arm-linux-gnueabi
Now find out the path and name of the cross-compiler executable by looking at the contents of the package:
dpkg -L gcc-arm-linux-gnueabi
Arch Linux users can install:
yaourt -S gcc-linaro-arm-linux-gnueabihf
Linaro also makes source releases which can then be used by any build system (see below).
The DENX Embedded Linux Development Kit (ELDK) provides a complete and powerful software development environment for embedded and real-time systems. It is available for ARM, PowerPC and MIPS processors and consists of:
All components of the ELDK are available for free with complete source code under GPL and other Free Software Licenses. Also, detailed instructions to rebuild all the tools and packages from scratch are included.
The ELDK can be downloaded for free from several mirror sites or ordered on CD-ROM for a nominal charge (99 Euro). To order the CD please contact office@denx.de
Detailed information about the ELDK is available here.
Scratchbox provides toolchains for ARM and x86 target architectures (with PowerPC, MIPS and CRIS in experimental stages but aren't making real progress since years, so Scratchbox should probably be considered ARM and x86 only). Both uClibc and glibc are supported.
Scratchbox simplifies cross compiling software which is built using GNU autotools - Code tests performed by configure are run in an emulator or even on the actual target. The toolchains scratchbox ships with are based on gcc 3.3 and as such are quite old, but stable and well tested. It should be pointed out that scripts to build custom toolchains are also provided with scratchbox allowing more recent gcc versions to be used.
Fedora ARM is a try to port Fedora to ARM. It provides some tools as an ARM toolchain packaged in RPM format. Link: Fedora ARM
For Debian users, the toolchains problem is fairly reliably solved.
For a debian-based box just install pre-built cross toolchains from Debian experimental.
Targets include nearly all debian-supported architectures As of this writing supported compiler is gcc 4.9. You can get older unsupported compilers from emdebian.
You will need to add the target architecture to your list of installable architectures. eg.
dpkg --add-architecture armhf
apt-get update
apt-get install gcc-arm-linux-gnueabihf
Free Pascal is available for several processor architectures from http://www.freepascal.org, the Lazarus IDE from http://www.lazarus.freepascal.org.
Buildroot is a complete build system based on the Linux Kernel configuration system and supports a wide range of target architectures. It generates root file system images ready to be written to flash. In addition to having a huge number of packages which can be compiled into the image, it also generates a cross toolchain to build those packages from source. Even if you don't want to use buildroot for your root filesystem, it is a useful tool for generating a toolchain. Buildroot supports uClibc, glibc, eglibc, and musl.
OpenADK is a complete build system based on the Linux Kernel configuration system and supports a wide range of target architectures. It is similar to buildroot. It generates root file system images ready to be written to flash. In addition to having a huge number of packages which can be compiled into the image, it also generates a cross toolchain to build those packages from source. Even if you don't want to use OpenADK for your root filesystem, it is a useful tool for generating a toolchain. OpenADK supports uClibc, glibc, uClibc-ng, and musl.
Crossdev is specific to developers using Gentoo for their development PCs. It is a script which generates a cross toolchain using the portage build scripts for gcc etc. There are numerous architectures which are supported and both uClibc and glibc toolchains can be built. Link: Gentoo Crossdev info
Crosstool-NG is a well-maintained fork of crosstool, targeted at easier configuration, re-factored code, and a learning base on how toolchains are built, with support for both uClibc and glibc, for debug tools (gdb, strace, dmalloc...), and a wide range of versions for each tools. Different target architectures are supported as well. It offers a kernel-like configuration system to select the different configuration options of the toolchain (component versions, component configuration, etc.). Crosstool-NG has an active and responsive user and developer community.
Crossdev is a project sponsored by Timesys, completely unrelated to the Gentoo cross toolchain generation system. The projects main focus is on a tool called tsrpm which is used to build cross development toolchains and generate cross-compiled software packages. Currently only x86 and select PowerPC architectures are supported. Link: Crossdev
EmbToolkit is the first toolchain building system giving the choice to generate GCC or llvm/clang based toolchain. EmbToolkit supports use of eglibc, glibc or uClibc as C Library and musl C library is also planned at time of writing. EmbToolkit can be used to generate only a toolchain (usable in a external project), but it is also possible to generate various root filesystems.
The OSELAS.Toolchain() project aims at supplying a complete build system for recent GNU toolchains. It uses the PTXdist build system, a userland build system based on Kconfig. The current version 1.99.3.1 of OSELAS.Toolchain() contains support for arm, x86, avr, mips and PowerPC. In addition, there are toolchains for bare metal platforms like Cortex-M3 and AVR-8-Bit.
OSELAS.Toolchain() Feature matrix (v1.99.1, build with PTXdist v1.99.7)
Architeture
CPUtype
gcc
glibc
binutils
kernel header
ARM (eabi)
1136jfs,xscale(-hf),iwmmx,v4t(-hf),v5te,xscale
4.1.2, 4.3.2
2.5, 2.8
2.17, 2.18
2.6.18, 2.6.27
AVR
n/a
3.4.6, 4.1.2, 4.3.2
1.0.5, 1.4.8, 1.6.2
2.17
n/a
X86
i586, i686
4.1.2, 4.3.2
2.5, 2.8
2.17, 2.18
2.6.18, 2.6.27
PowerPC
603e
4.1.2, 4.3.2
2.5, 2.8
2.17, 2.18
2.6.18, 2.6.27
MIPS
mipsel (softfloat)
4.2.3
2.8
2.18
2.6.27
OSELAS.Toolchain() contains some further goodies like gcj support for ARM and mingw Support for x86. Link: OSELAS.Toolchain() Link: PTXdist
Bitbake is the tool used by OpenEmbedded. The best way to get started is probably by just building an existing distribution that uses openembedded (e.g. Ångström, see http://www.angstrom-distribution.org/building-ångström for details).
See ARMCompilers