<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.ethernut.de/nutwiki/index.php?action=history&amp;feed=atom&amp;title=Documents%2FARM_ELF_Toolchain_Build</id>
		<title>Documents/ARM ELF Toolchain Build - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://www.ethernut.de/nutwiki/index.php?action=history&amp;feed=atom&amp;title=Documents%2FARM_ELF_Toolchain_Build"/>
		<link rel="alternate" type="text/html" href="http://www.ethernut.de/nutwiki/index.php?title=Documents/ARM_ELF_Toolchain_Build&amp;action=history"/>
		<updated>2026-04-29T00:24:11Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.26.2</generator>

	<entry>
		<id>http://www.ethernut.de/nutwiki/index.php?title=Documents/ARM_ELF_Toolchain_Build&amp;diff=315&amp;oldid=prev</id>
		<title>Harald: Created page with &quot;&lt;div id=&quot;content&quot;&gt;  = Building a GNU Toolchain for ARM on Linux =  The GNU toolchain is a collection of free programming tools, which allows to create executables for a large...&quot;</title>
		<link rel="alternate" type="text/html" href="http://www.ethernut.de/nutwiki/index.php?title=Documents/ARM_ELF_Toolchain_Build&amp;diff=315&amp;oldid=prev"/>
				<updated>2017-07-13T07:14:22Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;div id=&amp;quot;content&amp;quot;&amp;gt;  = Building a GNU Toolchain for ARM on Linux =  The GNU toolchain is a collection of free programming tools, which allows to create executables for a large...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;div id=&amp;quot;content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Building a GNU Toolchain for ARM on Linux =&lt;br /&gt;
&lt;br /&gt;
The GNU toolchain is a collection of free programming tools, which allows to create executables for a large number of target systems, using several different programming languages. It is further capable of creating executables for a platform other than the development environment. This is called cross compiling.&lt;br /&gt;
&lt;br /&gt;
Generally there are two ways of installing an executable toolchain:&lt;br /&gt;
&lt;br /&gt;
* Using a package manager to install the executables.&lt;br /&gt;
* Building the executables from source code.&lt;br /&gt;
&lt;br /&gt;
This document describes, how to build a C/C++ cross compiler toolchain for the ARM CPU. It will be build from source code on a Linux PC running Debian Etch.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
Depending on your environment, the build procedure may fail at various stages. In such cases some basic knowledge about installing, updating or replacing Debian packages will be required.&lt;br /&gt;
&lt;br /&gt;
The following tool version had been used here&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;coding&amp;quot;&amp;gt;$ gcc --version&lt;br /&gt;
gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)&lt;br /&gt;
&lt;br /&gt;
$ make --version&lt;br /&gt;
GNU Make 3.81&lt;br /&gt;
&lt;br /&gt;
$ autoconf --version&lt;br /&gt;
autoconf (GNU Autoconf) 2.61&lt;br /&gt;
&lt;br /&gt;
$ automake --version&lt;br /&gt;
automake (GNU automake) 1.10&lt;br /&gt;
&lt;br /&gt;
$ bison --version&lt;br /&gt;
bison (GNU Bison) 2.3&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;br /&gt;
Further, the following relevant packages and libraries had been installed, among many others of course.&lt;br /&gt;
* libc6-dev 2.3.6.ds1-13&lt;br /&gt;
* libncurses5-dev 5.5-5&lt;br /&gt;
* binutils 2.17-3&lt;br /&gt;
&lt;br /&gt;
Note, that earlier and later releases of these tools and libraries may or may not work.&lt;br /&gt;
== Getting the Source Archives ==&lt;br /&gt;
&lt;br /&gt;
'''binutils-2.17.tar.bz2'''&amp;lt;br /&amp;gt;&lt;br /&gt;
GNU binary utilities, a set of tools to manipulate binary objects.&amp;lt;br /&amp;gt;&lt;br /&gt;
Available at [http://www.gnu.org/software/binutils/ www.gnu.org/software/binutils]&lt;br /&gt;
&lt;br /&gt;
'''gcc-4.1.2.tar.bz2'''&amp;lt;br /&amp;gt;&lt;br /&gt;
GNU compiler collection.&amp;lt;br /&amp;gt;&lt;br /&gt;
Available at [http://gcc.gnu.org/ gcc.gnu.org]&lt;br /&gt;
&lt;br /&gt;
'''newlib-1.14.0.tar.gz'''&amp;lt;br /&amp;gt;&lt;br /&gt;
Standard C library for embedded systems.&amp;lt;br /&amp;gt;&lt;br /&gt;
Available at [http://www.sourceware.org/newlib/ www.sourceware.org/newlib]&lt;br /&gt;
&lt;br /&gt;
'''insight-6.5.tar.bz2'''&amp;lt;br /&amp;gt;&lt;br /&gt;
Graphical user interface for and including GDB, the GNU debugger.&amp;lt;br /&amp;gt;&lt;br /&gt;
Available at [http://sourceware.org/insight/ www.sourceware.org/insight]&lt;br /&gt;
&lt;br /&gt;
== Unpacking the Source Archives ==&lt;br /&gt;
&lt;br /&gt;
Move all archives to a directory of your choice. We will call this our top build directory. Change to this directory and expand all archives by using the following command sequence:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;coding&amp;quot;&amp;gt;$ tar xjf binutils-2.17.tar.bz2&lt;br /&gt;
$ tar xjf gcc-4.1.2.tar.bz2&lt;br /&gt;
$ tar xzf newlib-1.14.0.tar.gz&lt;br /&gt;
$ tar xjf insight-6.5.tar.bz2&amp;lt;/pre&amp;gt;&lt;br /&gt;
The archives are no longer needed and may be moved to a separate directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;coding&amp;quot;&amp;gt;$ mkdir ~/sources&lt;br /&gt;
$ mv *.tar.bz2 ~/sources/&lt;br /&gt;
$ mv *.tar.gz ~/sources/&amp;lt;/pre&amp;gt;&lt;br /&gt;
== Building binutils ==&lt;br /&gt;
&lt;br /&gt;
Although possible, we will not build the packages directly in their source directories. Instead we will create specific directories for building the executables.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;coding&amp;quot;&amp;gt;$ mkdir binutils-arm-build&amp;lt;/pre&amp;gt;&lt;br /&gt;
Change to the build directory and configure binutils for our target.&lt;br /&gt;
&amp;lt;pre class=&amp;quot;coding&amp;quot;&amp;gt;$ cd binutils-arm-build&lt;br /&gt;
$ ../binutils-2.17/configure --target=arm-elf --prefix=/usr \&lt;br /&gt;
  --enable-interwork --enable-multilib --disable-nls --disable-shared \&lt;br /&gt;
  --disable-threads --mandir=/usr/share/man --infodir=/usr/share/info&amp;lt;/pre&amp;gt;&lt;br /&gt;
Start building with make.&lt;br /&gt;
&amp;lt;pre class=&amp;quot;coding&amp;quot;&amp;gt;$ make&amp;lt;/pre&amp;gt;&lt;br /&gt;
If everything went fine, install binutils by calling make install as root.&lt;br /&gt;
&amp;lt;pre class=&amp;quot;coding&amp;quot;&amp;gt;# make install&amp;lt;/pre&amp;gt;&lt;br /&gt;
Finally return to the top build directory as a normal user.&lt;br /&gt;
&amp;lt;pre class=&amp;quot;coding&amp;quot;&amp;gt;$ cd ..&amp;lt;/pre&amp;gt;&lt;br /&gt;
== Building a Limited Compiler ==&lt;br /&gt;
&lt;br /&gt;
Two steps are required to build the GNU compiler. We will first build a limited version, which is capable of compiling the standard libraries. Create a specific build directory first.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;coding&amp;quot;&amp;gt;$ mkdir gcc-arm-build&lt;br /&gt;
$ cd gcc-arm-build&amp;lt;/pre&amp;gt;&lt;br /&gt;
Configuring the compiler requires root access.&lt;br /&gt;
&amp;lt;pre class=&amp;quot;coding&amp;quot;&amp;gt;# ../gcc-4.1.2/configure --target=arm-elf --prefix=/usr --disable-nls \&lt;br /&gt;
  --disable-shared --disable-threads --with-gcc --with-gnu-ld --with-gnu-as \&lt;br /&gt;
  --with-stabs --enable-interwork --enable-multilib --enable-languages=&amp;amp;quot;c,c++&amp;amp;quot; \&lt;br /&gt;
  --with-newlib --with-headers=../newlib-1.14.0/newlib/libc/include \&lt;br /&gt;
  --disable-libssp --disable-libstdcxx-pch --disable-libmudflap \&lt;br /&gt;
  --mandir=/usr/share/man --infodir=/usr/share/info&lt;br /&gt;
# make all-gcc&lt;br /&gt;
# make install-gcc&amp;lt;/pre&amp;gt;&lt;br /&gt;
Return to the top build directory when done.&lt;br /&gt;
&amp;lt;pre class=&amp;quot;coding&amp;quot;&amp;gt;$ cd ..&amp;lt;/pre&amp;gt;&lt;br /&gt;
== Building newlib ==&lt;br /&gt;
&lt;br /&gt;
We will now use limited compiler to build the libraries in a dedicated build directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;coding&amp;quot;&amp;gt;$ mkdir newlib-arm-build&lt;br /&gt;
$ cd newlib-arm-build&amp;lt;/pre&amp;gt;&lt;br /&gt;
Not sure if we need root access for configuration and building. At least it is required for the installation process.&lt;br /&gt;
&amp;lt;pre class=&amp;quot;coding&amp;quot;&amp;gt;# ../newlib-1.14.0/configure --target=arm-elf --prefix=/usr --enable-interwork \&lt;br /&gt;
  --enable-multilib --with-float=soft --mandir=/usr/share/man --infodir=/usr/share/info&lt;br /&gt;
# make&lt;br /&gt;
# make install&amp;lt;/pre&amp;gt;&lt;br /&gt;
Finally go back to the top build directory.&lt;br /&gt;
&amp;lt;pre class=&amp;quot;coding&amp;quot;&amp;gt;$ cd ..&amp;lt;/pre&amp;gt;&lt;br /&gt;
== Building the Final GCC ==&lt;br /&gt;
&lt;br /&gt;
After having build the libraries, we are now able to build the full compiler. Change to the GCC build directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;coding&amp;quot;&amp;gt;$ cd gcc-arm-build&amp;lt;/pre&amp;gt;&lt;br /&gt;
Start the build process as root.&lt;br /&gt;
&amp;lt;pre class=&amp;quot;coding&amp;quot;&amp;gt;# make all&lt;br /&gt;
# make install&amp;lt;/pre&amp;gt;&lt;br /&gt;
Leave the GCC build directory.&lt;br /&gt;
&amp;lt;pre class=&amp;quot;coding&amp;quot;&amp;gt;$ cd ..&amp;lt;/pre&amp;gt;&lt;br /&gt;
== Building Insight ==&lt;br /&gt;
&lt;br /&gt;
Configure and build Insight including GDB.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;coding&amp;quot;&amp;gt;$ mkdir insight-arm-build&lt;br /&gt;
$ cd insight-arm-build&lt;br /&gt;
$ ../insight-6.5/configure --target=arm-elf --prefix=/usr \&lt;br /&gt;
  --enable-interwork --enable-multilib --disable-nls \&lt;br /&gt;
  --mandir=/usr/share/man --infodir=/usr/share/info&lt;br /&gt;
$ make&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;coding&amp;quot;&amp;gt;                  We need root access to install the executables.&lt;br /&gt;
# make install&amp;lt;/pre&amp;gt;&lt;br /&gt;
Once again, return to the top build directory.&lt;br /&gt;
&amp;lt;pre class=&amp;quot;coding&amp;quot;&amp;gt;$ cd ..&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>Harald</name></author>	</entry>

	</feed>