Building Tools

From RTEMSWiki
Revision as of 18:16, 22 April 2012 by C Rempel (Talk | contribs)

Jump to: navigation, search


This page describes how to build the RTEMS toolchain from sources. Some of the commands need to be tailored for your development host. These directions assume that you already have installed some of the prerequisite tools necessary to compile GCC from source, including gcc for your host. If you have not then building from source will die, but hopefully it will give you some hints about what you need to install.

Start with a directory rtems/. Under that, create two directories: archive and tools.

Tools needed

You will need to download the tarballs of the RTEMS Build Toolset which includes the following:

  • Binutils
  • GCC (gcc-core)
  • GCC (gcc-g++)
  • GDB
  • Newlib
  • GMP (Multi-precision arithmetic library)
  • MPC (Multi-precision complex floating-point library)
  • MPFR (Multi-precision floating-point computation library)

You can find the above mentioned tarballs in and you should select the most recent versions for each. Save these in the archive directory.

Unpack archives

Change directory to the tools directory.

$ tar xjf ../archive/*.tar.bz2 
$ tar xzf ../archive/*.tar.gz

Apply tool patches

The patches can be downloaded from for 4.11 version. You should find the most recent patches for each of the following:


Make sure you check the modified date and pick up the most recent diff file.

Apply the patches

$ cd binutils-x.yy/
$ cat ../../archive/binutils-x.yy.z-rtems4.11-YYYYMMDD.diff | patch -p1 --dry-run
$ cat ../../archive/binutils-x.yy.z-rtems4.11-YYYYMMDD.diff | patch -p1
$ cd ../gcc-x.y.z/
$ cat ../../archive/gcc-core-x.y.z-rtems4.11-YYYYMMDD.diff | patch -p1 --dry-run
$ cat ../../archive/gcc-core-x.y.z-rtems4.11-YYYYMMDD.diff | patch -p1
$ cd ../newlib-x.yy.z/
$ cat ../../archive/newlib-x.yy.z-rtems4.11-YYYYMMDD.diff | patch -p1 --dry-run
$ cat ../../archive/newlib-x.yy.z-rtems4.11-YYYYMMDD.diff | patch -p1
$ cd ..

At every step check for any errors.

configure and build binutils

See the SupportedCPUs page for the target mnemonics. The following uses ${TARGET}, which you can set by exporting a shell variable, for example

$ export TARGET=powerpc-rtems4.11

The usual prefix for RTEMS installations is --prefix=/opt/rtems-4.11

  $ mkdir b-binutils
  $ cd b-binutils
  $ ../binutils-x.yy/configure --target=${TARGET} --prefix=/opt/rtems-4.11
  $ make all
  $ make info
  $ sudo make install
  $ cd ..

Now, set your path to include the just-built executables so that GCC will find them when compiling.

  $ export PATH=/opt/rtems-4.11/bin:${PATH}

configure and build gcc

$ cd gcc-x.y.z/
$ ln -s ../newlibx.yy.z/newlib .
$ cd ..
$ mkdir b-gcc
$ cd b-gcc/
$ ../gcc-x.y.z/configure --target=${TARGET}-rtems4.11 --with-gnu-as --with-newlib --verbose \
    --enable-threads --enable-languages="c,c++" --prefix=/opt/rtems-4.11
$ make all
$ make info
$ sudo make install
$ cd ..


Personal tools

Gedare's Special Help