| Table of contents |
UPDATE: this page is deprecated - please use the binary tool-chains here; either the uClinux toolchain or the GNUARM toolchain for non-uClinux development.
The GNU toolchain is a set of free, open source, tools that target a large variety of CPU architectures (including most of the ARM variants, and the ARM7TDMI core used in the W90N740). There are four main tools that form the toolchain, the assembler (gas - the GNU assembler), the compiler(s) (gcc - the GNU compiler collection), the linker (ld), and the debugger (gdb - the GNU debugger). The assembler, linker, and a number of other binary utilities are packaged as binutils. For more information about the GNU tools, their history, or their current status, refer to the GCC homepage (http://gcc.gnu.org/) or the Free Software Foundation (http://www.gnu.org).
There are three main ways of installing the toolchain:
Note: to build and use uClinux, we strongly suggest you install the pre-built binary toolchain described below.
To build and use the toolchain, you need a computer with a Unix-like environment, be it Linux (http://www.linux.org), Cygwin (http://www.cygwin.com/) on-top of Windows, or Mac OS X (http://www.apple.com/macosx/). You will need a parallel port on your PC to use the Simple JTAG Adapter. You will also need root/administrator permissions on your PC. I strongly recommend you use Linux, as it will make other things (that you may want to do later) much easier to do.
The following instructions have been tested on Linux (Debian/Sarge), Linux (Mandrake 10), and Mac OS X Panther. The only major difference between these platforms as far as this guide is concerned, is the use of the sudo command - on Mandrake, use su. I have not yet tested them on Cygwin, as I don't currently have a Windows box.
In your home directory, make a new directory in which to build the tool chain (type the following at the command prompt in a console):
$ mkdir arm-tools $ cd arm-tools/ $ export ARM_TOOLS=`pwd`
Download the source archives from here, to the arm-tools directory, then expand them:
$ tar xvjf binutils-2.14.tar.bz2 $ tar xvjf gcc-3.3.3.tar.bz2 $ tar xvjf gdb-6.0.tar.bz2 $ tar xvzf newlib-1.12.0.tar.gz $ tar xvzt jtager-0.3.0-bws.tgz
You can now move the tool source archives out of the way:
$ mkdir sources $ mv *.tar.bz2 sources/ $ mv *.tar.gz sources/
We start by building the GNU binary utilities package, binutils - this package rarely causes any problems:
$ cd binutils-2.14/ $ ./configure --target=arm-elf --enable-interwork --enable-multilib
This command tells the build system to configure itself to build binutils to suit the arm-elf target, in other words, to target the ARM processor, using the ELF binary format. Now we build the package, then install it (by default, it will be installed to /usr/local/arm-elf/):
$ make all $ sudo make install
We now proceed to build gcc, the GNU Compiler Collection (we will only be building the C and C++ compilers). The build is a two-step process; we first build a limited compiler that is only suitable for building the standard libraries, then we build the libraries, then we use them to finish building the compiler. This process is known as bootstrapping the compiler.
The gcc-3.3.3 release had a bug that resulted in the compiler being unable to generate correct ARM/Thumb executables. A patch was released to fix the bug, so we have to apply it first. Download thumb-3.3.3.patch from Source Archives, and copy it to the arm-tools/gcc-3.3.3/ subdirectory.
FIXME: how to apply the patch.
Before we compile and install gcc, we have to edit the configuration file, to enable Big-Endian library support (the Winbond W90N740 CPU is big-endian). Rather than manually set all the required options, we enable the so-called multilib, or multi-configuration library - using it, you can build binaries for ARM 32-bit mode, ARM/Thumb 16-bit mode, mixed 16/32-bit mode (interworking), little-endian or big-endian CPUs, and for CPUs with or without hardware floating point support (the W90N740 has no hardware floating point). Download the config file (t-arm-elf) from here, and copy it to arm-tools/gcc-3.3.3/gcc/config/arm/.
Now compile and build the compiler as follows:
$ cd $ARM_TOOLS $ cd gcc-3.3.3/ $ ./configure --target=arm-elf --enable-languages=c,c++ \ > --with-headers=$ARM_TOOLS/newlib-1.12.0/newlib/libc/include \ > --with-newlib --enable-interwork --enable-multilib $ make all-gcc $ sudo make install-gcc
We now have an ARM C compiler that is (only) suitable for building the C libraries - that is, newlib, a set of C libraries specifically aimed at resource-constrained embedded targets. It must be built in a temporary directory, say, newlib-build:
$ cd $ARM_TOOLS $ mkdir newlib-build $ cd newlib-build/ $ $ARM_TOOLS/newlib-1.12.0/configure --target=arm-elf \ > --enable-interwork --enable-multilib $ make all $ sudo make install
We can finally finish building the gcc compilers:
$ cd $ARM_TOOLS/gcc-3.3.3/ $ make all $ sudo make install
If all the above has proceeded smoothly, we can now build the debugger, gdb:
$ cd $ARM_TOOLS/gdb-6.0 $ ./configure --target=arm-elf --enable-interwork --enable-multilib $ make all $ sudo make install
You should now have arm-elf-gcc (the C compiler), arm-elf-g++ (the C++ compiler), arm-elf-as (the assembler), arm-elf-ld (the linker), and arm-elf-gdb (the debugger), as well as a number of other utilities such as arm-elf-objdump (which allows you to inspect or disassemble binaries) and arm-elf-size (to check the size of a binary). You can now remove the installation directories if you want (because they may be quite large).
$ rm -rdf gcc-3.3.3/ binutils-2.14/ newlin-1.12.0/ gdb-6.0/
If you have problems building the toolchain, or would rather use a pre compiled tool chain, try the binaries at www.gnuarm.com (there are many precompiled tool chains available on the web, but the GNUARM one supports big-endian targets (such as our W90N740 CPU) correctly, and has correct big-endian C libraries.
Alternately, for uClinux development, use the toolchain here. Building a working toolchain for uClinux from source is a very involved process, as many patches need to be found and applied to support the FLAT executable file format.
Onward to Using the GNU Tools, or to JTAGER.