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 the GNU Tools, you will need to meet
at least the following requirements:
Compiling 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. |
Due to a number of limitations of Microsoft Windows and the Cygwin
Unix Emulator, the final output will appear “in place” in
/usr/local. This means, however, that this
directory must be empty prior to compilation. The easiest way to do this
is to enter: |
|
|
|
Please check before-hand that there is nothing in /usr/local that you wish to keep! If there is, you will
need to move it to another directory; you can move it back in
afterwards. |
4. |
Create a directory to contain the sources. Note that at least
900 MB of space is required for the source code, build and
installation files. In this document, /var/tmp/src will be used for the sources: |
|
$ | mkdir /var/tmp/src |
$ | cd /var/tmp/src |
|
5. |
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. |
6. |
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 . |
7. |
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. |
8. |
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 |
|
9. |
Configure the binutils package: |
|
$ | cd /var/tmp/build/binutils-2.14 |
$ | /var/tmp/src/binutils-2.14/configure --target=arm-elf |
|
|
Please note that you can (and probably should) specify compiler
options on the command line. You can do this by specifying variable
definitions in front of configure . The following command
line, for example, enables both optimisation level 2 and debugging (the
-O2 and -g compiler options, respectively): |
|
$ | CFLAGS="-O2 -g" /var/tmp/src/binutils-2.14/configure --target=arm-elf |
|
|
If you do specify compiler options on the command line, you will
need to do so for every other configure step as well
(ie, steps 13, 16 and 19). |
10. |
Compile the binutils package: |
|
|
11. |
Install the compiled binutils package: |
|
|
12. |
Create a temporary link to the header files: |
|
$ | cd /usr/local/arm-elf |
$ | mkdir sys-include |
$ | ln -s sys-include include |
|
13. |
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 |
|
14. |
Compile the gcc package: |
|
|
15. |
Install the compiled gcc package and remove the
link created in step 12: |
|
|
|
$ | cd /usr/local/arm-elf |
$ | rm -fr include sys-include |
|
16. |
Configure the newlib package: |
|
$ | cd /var/tmp/build/newlib-1.11.0 |
$ | /var/tmp/src/newlib-1.11.0/configure --target=arm-elf |
|
17. |
Compile the newlib package: |
|
|
18. |
Install the compiled newlib package: |
|
|
19. |
Configure the insight package: |
|
$ | cd /var/tmp/build/insight-5.3 |
$ | /var/tmp/src/insight-5.3/configure --target=arm-elf |
|
20. |
Compile the insight package: |
|
|
21. |
Install the compiled insight package: |
|
|
22. |
Create the final package directory. In this document, /var/tmp/final will be used: |
|
|
23. |
Change to the root directory and create the package file. You
should substitute date with an appropriate date, such as
2003-06: |
|
$ | cd / |
$ | tar cvf /var/tmp/final/arm-elf-gnutools-win32-date.tar usr/local |
$ | cd /var/tmp/final |
$ | gzip -9 arm-elf-gnutools-win32-date.tar |
|
24. |
Create the uninstallation program, using the mkuninst
script found on the CD-ROM: |
|
$ | /cygdrive/d/utils/unsw/src/mkuninst -F arm-elf-gnutools-win32-date.tar.gz |
|
25. |
(Optional) Remove the source code and build files to reclaim about
620 MB of disk space (the binaries installed into /usr/local take about 125 MB of space; the final
package requires about 35 MB): |
|
$ | cd /var/tmp |
$ | rm -fr src build |
|
26. |
You have successfully compiled the GNU Tools for the ARM
microcontroller! You can find the final package file in the /var/tmp/final directory. |
In most cases, you will not encounter any problems in compiling 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:
If none of these suggestions help you, it is probably time to search
for answers on the Internet, or to consult expert help. Happy
compiling!