This document shows you how to compile and install the GNU Tools for
the ARM microcontroller under Microsoft Windows. Please note that it is
much easier to install the
precompiled binary image for Windows (as found on this CD-ROM). If
you do choose to recompile the GNU Tools, as explained in this document,
expect to spend about three hours doing so (depending, of course, on the
speed of your machine).
There are two main methods of compiling the GNU Tools: by compiling the
individual source directories (as described in this document), or by recreating the binary package. In
general, the simplest of these methods is the method described here. Recreating the binary package
should be undertaken by system administrators wanting to retain complete
control of their system… or those wanting to update this CD-ROM.
In this document, something like “Start »
Settings » Control Panel” means that you click on the
Start button, select the Settings sub-menu and finally click on Control
Panel. “$
” will indicate the Cygwin shell
prompt. Anything in a bold monospaced font is what you are
expected to type in; an ordinary monospaced
font is used for
the computer’s response. Please note that this document
doesn’t show every response from the computer!
In order to successfully compile, install and run the GNU Tools, you
will need to meet at least the following requirements:
1. |
Microsoft Windows NT 4 or later (including Windows 2000,
Windows XP Home and Windows XP Professional), or Windows 98SE, as your
operating system, |
2. |
A complete installation of the Cygwin Unix Emulator, as found on this
CD-ROM, |
3. |
At least 750 MB of free disk space (after Cygwin has
been installed), |
4. |
At least three hours of free time, and |
5. |
If you are running Microsoft Windows NT, Windows 2000 or Windows
XP Professional, the password for the Administrator account on your
system. |
Compiling and installing the GNU Tools is not that complicated
(although there are rather a lot of steps), but be careful that you type
in the commands exactly as shown. These instructions assume that this
CD-ROM can be found as drive D: on your computer
(/cygdrive/d within the Cygwin environment). If
it is not, simply substitute the actual drive letter for the
“d
”. See the instructions for mounting the
CD-ROM for more details.
1. |
If you are running Microsoft Windows NT, Windows 2000 or Windows
XP Professional, log in as Administrator. If you are running Microsoft
Windows XP Home or Windows 98SE, simply log in. |
2. |
Start a Cygwin command line (usually by selecting
Start » Programs » Cygwin » Cygwin Bash
Shell). |
3. |
Create a directory to contain the sources. Note that at least
600 MB of space is required for both the source code and build files.
In this document, /var/tmp/src will be used for
the sources: |
|
$ | mkdir /var/tmp/src |
$ | cd /var/tmp/src |
|
4. |
Locate the appropriate sources, either on this CD-ROM, or by downloading the source code archives from the
Internet. Assuming the CD-ROM is available at /cygdrive/d, the source code archives can be found in /cygdrive/d/gnutools/src. |
5. |
Unpack the sources: |
|
$ | tar xzvf /cygdrive/d/gnutools/src/binutils-2.14.tar.gz |
$ | tar xzvf /cygdrive/d/gnutools/src/gcc-core-3.3.tar.gz |
$ | tar xzvf /cygdrive/d/gnutools/src/gcc-g++-3.3.tar.gz |
$ | tar xzvf /cygdrive/d/gnutools/src/insight-5.3.tar.gz |
$ | tar xzvf /cygdrive/d/gnutools/src/newlib-1.11.0.tar.gz |
|
|
If you are using sources that you downloaded from the Internet,
you would replace /cygdrive/d/gnutools/src with
the location of those sources, of course. Archives having .tar.gz on the end of their filename require
xzvf as the parameter to the tar command; those
with .tar.bz2 require xjvf . |
6. |
Apply the appropriate patches (on this CD-ROM, or from the Internet) to the sources: |
|
$ | gzip -dc /cygdrive/d/gnutools/src/binutils-2.14.patch.gz | patch -p0 |
$ | gzip -dc /cygdrive/d/gnutools/src/gcc-3.3.patch.gz | patch -p0 |
$ | gzip -dc /cygdrive/d/gnutools/src/insight-5.3.patch.gz | patch -p0 |
$ | gzip -dc /cygdrive/d/gnutools/src/newlib-1.11.0.patch.gz | patch -p0 |
|
|
Please note that parts of these patches may not need to be applied
to later versions of the GNU Tools. You are on your own if you decide to
use versions of software different from those described in this document!
However, you might like to see if later versions of
the patches exist on the Internet before giving up. |
7. |
Create a separate directory, with subdirectories, in which to
build the sources. In this document, /var/tmp/build will be used: |
|
$ | mkdir /var/tmp/build |
$ | cd /var/tmp/build |
$ | mkdir binutils-2.14 gcc-3.3 insight-5.3 newlib-1.11.0 |
|
8. |
Configure the binutils package: |
|
$ | cd /var/tmp/build/binutils-2.14 |
$ | /var/tmp/src/binutils-2.14/configure --target=arm-elf |
|
9. |
Compile the binutils package: |
|
|
10. |
Install the compiled binutils package: |
|
|
11. |
Create a temporary link to the header files: |
|
$ | cd /usr/local/arm-elf |
$ | mkdir sys-include |
$ | ln -s sys-include include |
|
12. |
Configure the gcc package: |
|
$ | cd /var/tmp/build/gcc-3.3 |
$ | /var/tmp/src/gcc-3.3/configure --target=arm-elf --with-newlib --with-headers=/var/tmp/src/newlib-1.11.0/newlib/libc/include |
|
13. |
Compile the gcc package: |
|
|
14. |
Install the compiled gcc package and remove the link
created in step 11: |
|
|
|
$ | cd /usr/local/arm-elf |
$ | rm -fr include sys-include |
|
15. |
Configure the newlib package: |
|
$ | cd /var/tmp/build/newlib-1.11.0 |
$ | /var/tmp/src/newlib-1.11.0/configure --target=arm-elf |
|
16. |
Compile the newlib package: |
|
|
17. |
Install the compiled newlib package: |
|
|
18. |
Configure the insight package: |
|
$ | cd /var/tmp/build/insight-5.3 |
$ | /var/tmp/src/insight-5.3/configure --target=arm-elf |
|
19. |
Compile the insight package: |
|
|
20. |
Install the compiled insight package: |
|
|
21. |
(Optional) Remove the source code and build files to reclaim about
620 MB of disk space (the final binaries take about 125 MB of
space): |
|
$ | cd /var/tmp |
$ | rm -fr src build |
|
22. |
You have successfully compiled and installed the GNU Tools for the
ARM microcontroller! |
In most cases, you will not encounter any problems in compiling and
installing the GNU Tools. There might be exceptions, however. The
following is a list of things you should check if a compilation (a
“make all” step) terminates with an error:
1. |
Check that you entered all commands exactly as specified.
Please note that your browser may split up commands over a number of lines
(depending on the width of your browser window); that does not mean you do
the same! Each shell prompt (“$ ”) indicates a
single command line. |
2. |
If the compilation of gcc aborts mid-way with
multiple error messages, including one about “No such file or
directory” (or something similar, about a non-existant header file),
you may need to check if the symbolic link you created in step 11 still exists. Simply jump back to step 11 and ignore any errors from the
mkdir and/or ln commands in that step. |
3. |
If you get the error message about cygpath.exe
complaining that it “can’t create title mutex” during
the configuration of insight in step 18, and the process seems to hang, then you
need to modify two configuration files. Press CTRL+C to get back to the
Cygwin prompt. Next, use VI to change line 1349 of /var/tmp/src/insight-5.3/tcl/win/configure from
“cyg_conftest=`$CYGPATH $conftest`” to
“cyg_conftest=C:\\cygwin\\tmp\\conftest.rc”. Now
do the same to line 1351 of /var/tmp/src/insight-5.3/tk/win/configure. Now, jump
back to step 18. These instructions assume, of
course, that you have installed the Cygwin Unix Emulator in the C:\cygwin directory. If you continue to have problems,
consult expert help. |