eCos Home

RedBoot Home

About eCos

Supported Hardware

Downloading and Installation



Mailing lists



Anonymous CVS

Contributions and Development Projects



Building the Intel x86 development tools for Linux


eCos requires i386-elf development tools to develop programs for Intel x86 targets. The development tools come in three parts: the GNU compiler collection (GCC), the GNU Debugger (GDB) and the GNU binary utilities, which include the GNU assembler and linker. This page details the steps required to download and build these development tools.

Downloading the tool sources

GNU Binary Utilities

It is recommended that eCos is used with the most recent official release of the GNU Binary Utilities (binutils), currently version 2.10.1. This is available from the binutils area of the main GNU software download site or any of its mirror sites. It is also available at any of the mirror sites for Download sizes are in the region of 5.5MB for .bz2 format archives, or 7MB for .gz format archives.

Weekly and daily snapshots from the CVS repository are also available from the main binutils development site, but these have not been verified for use with eCos.

If you already have binutils sources available but are unsure of their version, you can search the file gas/configure for the string "VERSION" and examine its value.

GNU Compiler Collection

The GNU Compiler Collection web site contains plenty of information about installing and using GCC. A snapshot of the GCC development sources may be used to obtain the most up-to-date compiler with new features and bug fixes. However, it is recommended that the most recent official release (GCC 2.95.2) is used, as it is likely to be more stable.

GCC 2.95.2 sources can be downloaded from the releases page. Both the core distribution and the C++ distribution files are required for eCos. Alternatively, click on the appropriate following links to download the files directly:

Note that the instructions for building GCC here are only intended for use with eCos. In any other environment, the tools may not function correctly. Refer to the CrossGCC FAQ for details about building a standalone version of GCC.

It is strongly recommended you use a mirror site close to you, which will result in a faster download, reduced internet congestion, and reduced load on the central server.

GNU Debugger

Instructions for downloading the GNU Debugger (GDB) are provided on the GDB home page. However, Red Hat has also released an open source graphical front-end to GDB based on Tcl/Tk called Insight, which has a separate home page.

The Insight sources are a superset of the standard GDB sources. It is also still possible to run GDB in command-line mode by using the -nw command-line option when invoking GDB, so there is nothing to lose by using the Insight sources.

The latest release (version 5.0) is recommended and may be downloaded via the GDB home page. Alternatively, click on on one of following links to download the files directly:

Preparing the sources for building

Once the tools sources have been downloaded, they must be prepared before building. These instructions assume that the tool sources will be extracted in the /src directory hierarchy. Other locations may be substituted throughout. Similarly placeholders of the form YYYYMMDD and YYMMDD should be replaced with the actual date of the downloaded files. Ensure that the file system used has sufficient free space available. The contents of each archive will expand to occupy approximately 6 times the space required by the compressed archive itself. To extract the downloaded sources, you will need to have either the bzip2 or gzip compression utilities, depending on your choice of download format. A patch utility (preferably GNU patch) is also required.

The following steps should be followed at a sh, ksh or bash prompt. Users of the csh and tcsh shells should replace 2>&1 with |& throughout:

  1. Create a directory for each set of tool sources, avoiding directory names containing spaces as these can confuse the build system:
        mkdir -p /src/binutils /src/gcc /src/gdb
  2. Extract the sources for each tool directory in turn. For bzip2 archives:

        cd /src/binutils
        bunzip2 < binutils-2.10.1.tar.bz2 | tar xvf -
        cd /src/gcc
        bunzip2 < gcc-core-2.95.2.tar.bz2 | tar xvf -
        bunzip2 < gcc-g++-2.95.2.tar.bz2 | tar xvf -
        cd /src/gdb
        bunzip2 < insight-5.0.tar.bz2 | tar xvf -

    For gzip archives:

        cd /src/binutils
        gunzip < binutils-2.10.1.tar.gz | tar xvf -
        cd /src/gcc
        gunzip < gcc-core-2.95.2.tar.gz | tar xvf -
        gunzip < gcc-g++-2.95.2.tar.gz | tar xvf -
        cd /src/gdb
        gunzip < insight-5.0.tar.gz | tar xvf -

    The following directories should be generated and populated during the extraction process:


    If the standard GDB source distribution was downloaded rather than Insight, then the GDB tools source directory will be /src/gdb/gdb-5.0 rather than /src/gdb/insight-5.0.

  3. You may now need to apply a small number of source patches that are required to fix outstanding problems and add eCos support to the tools. Patches may be downloaded using most browsers by either shift-clicking or right-clicking on the link to the patch. You must not view the link and cut-and-paste because white space must be preserved exactly.

    Download the ecos-gcc-2952.pat patch to a file and apply it:

        cd /src/gcc/gcc-2.95.2
        patch -p0 < ecos-gcc-2952.pat

    You must then reset the source file timestamps to ensure that makefile dependencies are handled correctly:

        contrib/egcs_update --touch

    If any of the patches fail to apply you should see if there is some obvious problem by attempting to apply the patch manually. If this is not possible, report the problem to the ecos-discuss mailing list.

    If the patch utility reports the following message:

        Reversed (or previously applied) patch detected! Assume -R? [n]

    then type n because this indicates the patch has already been applied in the master sources.

Building the tools

Before attempting to build the tools, ensure that the GNU native compiler tools directory is on the PATH and precedes the current directory. The following build procedures will fail if . is ahead of the native tools in the PATH.

Approximate disk space requirements for building the development tools are as follows:

Binary Utilities30MB20MB

Following successful building and installation of each set of tools, the associated build tree may be deleted to save space if necessary. These instructions assume that the tools will be built in the /tmp/build directory hierarchy and installed to /tools. Other locations may be substituted throughout:

  1. Configure the GNU Binary Utilities:

        mkdir -p /tmp/build/binutils
        cd /tmp/build/binutils
        /src/binutils/binutils-2.10.1/configure --target=i386-elf \
          --prefix=/tools \
          --exec-prefix=/tools/H-i686-pc-linux-gnu \
          -v 2>&1 | tee configure.out

    If there are any problems configuring the tools, you can refer to the file configure.out as a permanent record of what happened.

  2. Build and install the GNU Binary Utilities:

        make -w all install 2>&1 | tee make.out

    If there are any problems building the tools, you can use the file make.out as a permanent record of what happened.

  3. Configure GCC, ensuring that the GNU Binary Utilities are at the head of the PATH:

        PATH=/tools/H-i686-pc-linux-gnu/bin:$PATH ; export PATH    (for sh, ksh and bash users)
        set path = ( /tools/H-i686-pc-linux-gnu/bin $path )        (for csh and tcsh users)
        mkdir -p /tmp/build/gcc
        cd /tmp/build/gcc
        /src/gcc/gcc-2.95.2/configure --target=i386-elf \
          --prefix=/tools \
          --exec-prefix=/tools/H-i686-pc-linux-gnu \
          --with-gnu-as --with-gnu-ld --with-newlib \
          -v 2>&1 | tee configure.out

  4. Build and install GCC:

        make -w all-gcc install-gcc \
          LANGUAGES="c c++" 2>&1 | tee make.out

  5. Configure Insight:

        mkdir -p /tmp/build/gdb
        cd /tmp/build/gdb
        /src/gdb/insight-5.0/configure --target=i386-elf \
          --prefix=/tools \
          --exec-prefix=/tools/H-i686-pc-linux-gnu \
          -v 2>&1 | tee configure.out

  6. Build and install Insight:

        make -w all install 2>&1 | tee make.out

On completion, the Intel x86 development tool executable files will be located at /tools/H-i686-pc-linux-gnu/bin. This directory should be added to the head of your PATH.


If you encounter difficulties in building or using the development tools, first check the eCos FAQ and the ecos-discuss mailing list archive to see if the topic has come up before. Initial queries may be directed to the ecos-discuss list. However, there are other mailing lists which may be more appropriate if a problem is clearly related to a particular tool: Before sending messages to the mailing lists, you would also be advised to consult the various web sites associated with each list, to see if there is any relevant documentation or FAQs: It is also worth noting that all these mailing lists have searchable archives.