GNAT/RTEMS is used to refer to the configuration of the GNU Ada compiler (GNAT) when used with RTEMS as the run-time environment. GNAT/RTEMS provides a very full featured Ada programming and run-time environment. An early version of GNAT/RTEMS was validated ( on the SPARC/ERC32. RTEMS has long had support for the Ada programming languages with the earliest work done against gnat 2.x. In fact, the GNAT/RTEMS port predates the other ports of GNAT to embedded RTOS environments.

History and Status

These instructions have been used to build for various targets and ACATS results have been reported for multiple targets including sparc, mips, powerpc, and x86 versions of RTEMS with multiple GCC versions.

  • arm-rtems4.9 - ACATS results have been reported using Skyeye with edb7312 BSP
  • bfin-rtems4.9 - no attempt to run anything (eventually Skyeye)
  • i386-rtems4.9 - ACATS results have been reported using qemu with pc386 BSP
  • m68k-rtems4.9 - no attempt to run anything (eventually Skyeye with csb360 BSP)
  • mips-rtems4.9 - ACATS results have been reported using qemu with jmr3904 BSP
  • powerpc-rtems4.9 - ACATS results have been reported using psim with psim BSP
  • sparc-rtems4.9 - ACATS results have been reported using sis with erc32 BSP

There are a few patches and GCC PRs to track them. Since the GCC 4.2.x release series, there has been work on the GNAT/RTEMS run-time to add support for Ada hardware interrupt tasks, Ada task stack checking and GNAT sockets interface. Each PR should have multiple versions of the patches.

As on 10 September, the GCC SVN trunk has all patches except one small piece of the Ada Hardware Interrupt Task Support.

These instructions have been used to build GNAT/RTEMS with GCC 4.2.3, 4.3.2, and the GCC SVN trunk for the multiple target/bsp combinations and report ACATS results. Since these tests are run regularly from both OAR and the GCC Compile Farm, please refer to the GCC Test Results Mailing List to find the latest results reported.

History of these Instructions

Laurent Guerby originally wrote these instructions using the sparc-rtems4.7 target and erc32 BSP. His times are based on a Pentium M 1.7 GHz SuSE 9.3 machine.

JoelSherrill most recently updated these instructions in September 2008. My times are from old runs using a 2.00 Ghz T2500 Centrino Duo running Fedora Core 7. For those, I used the RTEMS RPMs as much as possible and ONLY built the packages that were absolutely necessary. In all cases, you should use the latest patches available which correspond to shipping RPMs. These should always be in the RTEMS source code at rtems/contrib/crossrpms/patches and at

Cindy Cicalese updated these instructions on 13 February 2008 based upon testing psim on Fedora 7 with RTEMS 4.9. Cindy wrote a set of scripts that largely automate this process. Joel used these and reports a total build time of approximately 1 hour from autotools to two RTEMS BSPs.

As of September 2009, Laurent Guerby has made great progress in adding multilib support for Ada. When this effort is completed, we can again consider offering prebuilt GNAT binaries.

General Ada Programming/RTEMS Build Instructions

These instructions assume the following strings in the instructions are replaced with values appropriate for you. These may not work if you use these as environment variables, so do this at your own risk.

  • INSTALL_DIR is the prefix (installation directory) for the toolchain installation
  • TARGET is the target code (tested with TARGET=sparc-rtems4.7)
  • BSP the RTEMS BSP (tested with BSP=erc32)

It is critical that you have a recent enough C/Ada native GCC in your $PATH before beginning.

Please perform each configure/make/make install trio in a separate empty build directory. In the directions below, the versions for RTEMS 4.9 are used. If you are building RTEMS 4.8, update the commands below with the appropriate older versions. Also set PATH=INSTALL_DIR/bin:$PATH.

Finally, some weird behavior has been observed when trying to build GCC on Fedora using an NTFS file system.

Source Code and Patches

If you are building from source code, download all of the necessary source code archives, unpackage them, and apply the appropriate patches.

Please use the latest patches available for the tool versions you are using. These should always be in the RTEMS source code at rtems/contrib/crossrpms/patches and at

As of September 2008, the current source code and patches for RTEMS 4.9 are as follows:

Component Version Source Code Diff Date Diff
autoconf 2.62 ftp N/A
automake 1.10.1 ftp N/A
binutils 2.18 ftp 2008-02-11 ftp
gcc 4.3.2 ftp core: 2008-06-28
Ada: 2008-09-10
newlib 1.16.0 ftp 2008-08-27 ftp
gdb 6.8 ftp 2008-04-29 ftp

As of 21 December 2007, the current source code and patches for RTEMS 4.8 are as follows:

Component Version Source Code Diff Date Diff
autoconf 2.61 ftp N/A
automake 1.10 ftp N/A
binutils 2.17 ftp 2006-10-21 ftp
gcc 4.2.0 ftp core: 2007-06-13
Ada: 2007-07-05
newlib 1.15.0 ftp 2007-12-21 ftp
gdb 6.6 ftp 2007-12-16 ftp

Rather than building from source code, you may be able to use the pre-built versions of the code provided for various architectures at For example, an RPM for autoconf 2.61 for Fedora 7 is available at However, be aware that problems have been identified if the version of the pre-built binutils has an INSTALL_DIR different from the one you are using for the other tools. It is also possible to install the binutils RPMs in a non-default location using rpm2cpio and mv, but this may cause problems in finding "as" on some platforms.

Building autoconf and automake (1 minute)

mkdir b-autoconf
cd b-autoconf
../autoconf-2.62/configure --prefix=INSTALL_DIR
make install
mkdir b-automake
cd b-automake
../automake-1.10.1/configure --prefix=INSTALL_DIR
make install

Building binutils (3 minutes)

mkdir b-bin
cd b-bin
../binutils-2.18/configure  --verbose --disable-nls \
--target=TARGET --prefix=INSTALL_DIR
make install

GCC and newlib Setup

It is usually necessary to build a native C/Ada native GCC of EXACTLY the same version as the version you are building cross to target RTEMS. So, starting from a relatively recent native C and Ada GCC, you will probabaly need to build a new native C and Ada GCC. You will then proceed to build a C cross-compiler and then a C and Ada cross-compiler.

Be sure to patch your gcc newlib with the latest RTEMS newlib patch mentioned BEFORE linking newlib and libgloss into the gcc tree.

Add newlib and libgloss links in the gcc source top level directory.

cd ../gcc-4.3.2/
ln -s ../newlib-1.16.0/newlib ../newlib-1.16.0/libgloss .

Build Native C and Ada Compiler (1 hour)

mkdir b-native
cd b-native
../gcc-4.3.2/configure --enable-languages=c,ada --prefix=INSTALL_DIR
make install

NOTE: On some hosts, you may be able to add --disable-multilib and reduce the build time. However on some hosts, particularly x86_64, this results in a broken compiler installation.

Build non-multilib C Cross-Compiler (12 minutes)

Building GNAT is a bit idiosyncratic. You must build and install a toolset WITHOUT Ada first since building the GNAT run-time depends on at least an installed C Library. In addition, as mentioned earlier, the Ada run-time libraries are not built multilib so you must compile them with CPU dependent CFLAGS which match those required by your intended target CPU.

mkdir b-gcc1
cd b-gcc1
../gcc-4.3.2/configure --enable-threads=rtems  --with-gnu-as --disable-multilib \
  --with-gnu-ld --with-newlib  --verbose --with-system-zlib --disable-nls \
  --enable-version-specific-runtime-libs \
  --enable-languages=c --target=TARGET --prefix=INSTALL_DIR
make install

NOTE: Be sure to have a native GCC Ada compiler of the same of similar version. Otherwise, it is possibly the cross-GNAT will fail to compile with a mysterious looking error.

Build non-multilib C and Ada Cross-Compiler (21 minutes)

mkdir b-gcc2
cd b-gcc2
../gcc-4.2.3/configure --enable-threads=rtems  --with-gnu-as --disable-multilib \
  --with-gnu-ld --with-newlib  --verbose --with-system-zlib --disable-nls \
  --enable-version-specific-runtime-libs \
  --enable-languages=c,ada --target=TARGET --prefix=INSTALL_DIR
make install

You can include c++ in the list of languages if you wish.

Or Slower Build of multilibed C, C++, and Ada Cross-Compiler (XX minutes)

Note: untested,

../gcc-4.3.2/configure --enable-threads=rtems  --with-gnu-as \
  --with-gnu-ld --with-newlib  --verbose --with-system-zlib --disable-nls \
  --enable-version-specific-runtime-libs --enable-libada \
  --enable-languages=c,c++,ada --target=TARGET --prefix=INSTALL_DIR
make install

Build GDB (4 minutes)

mkdir b-gdb
cd b-gdb
../gdb-6.8/configure --verbose --disable-nls \
  --enable-sim --enable-sim-timebase --enable-sim-hardware \
  --target=TARGET --prefix=INSTALL_DIR
make install

Build RTEMS from CVS (4 minutes)

First, get the RTEMS source code. For RTEMS 4.10, use:

cvs -z3 -d login
cvs -z3 -d co -P rtems

For RTEMS 4.9, use:

cvs -z3 -d login
cvs -z3 -d co -r rtems-4-9-branch -P rtems

For RTEMS 4.8, use:

cvs -z3 -d login
cvs -z3 -d co -r rtems-4-8-branch -P rtems

Then, build RTEMS:

cd rtems
cd ..
mkdir b-rtems
cd b-rtems
../rtems/configure --disable-multilib --disable-cxx --enable-posix \
  --enable-networking --enable-ada \
  --target=TARGET --prefix=INSTALL_DIR --enable-rtemsbsp=BSP
make install

Note: autoconf must be recent and include RTEMS patches.

Compile and Test

Now checkout the ada-examples CVS module and compile some simple Ada programs. The file Makefile.shared at the top of the ada-examples source contains the rules that are intended to be able to compile and link these examples with any RTEMS BSP. If the BSP performs a transformation to get from the ".exe" to the downloadable ".ralf", then you will either have to edit Makefile.shared to add this information or do the transformation by hand.

Note 1: It appears that gnat (gcc 4.2.x and 4.3.x) is mangling target names with periods in them. CPU-rtems4.7 is turning into CPU-rtems4.

Note 2: It appears that gnat (gcc 4.1 CVS) is always looking for the cross tools in /usr/bin. Unchecked in 4.2.0.

Old Build Instructions with GCC 3.2

make -C gcc cross-gnattools
make -C gcc ada.all.cross
make install
Last modified on 11/28/18 at 09:27:54 Last modified on 11/28/18 09:27:54