Skip to content
The Ada Microkernel Project
Branch: master
Clone or download
Latest commit 9fbc924 May 13, 2015
Type Name Latest commit message Commit time
Failed to load latest commit information.
doc Fixed a typo. Feb 11, 2011
kick/src Moved the comments from the here to the Boot process wiki entry so we… Jun 10, 2012
rts Added a No_Floating_Point restrction. Sep 18, 2013
thirdparty Can now build an RTS for Cortex-M4. Jan 10, 2012
tools/gcc Wrappers for the gnatmake and gnatlink commands that will be used for… Feb 2, 2011
README Fixed typo. May 13, 2015
TODO Add additional languages and arithmetic libs to native toolchain. Sep… Jan 5, 2012


                    The Ada Microkernel Project (TAMP)


Copyright © 2011-2012, Luke A. Guest & David Rees, All Rights Reserved.

License is GPL v2 until further notice and is subject to change during

Prebuilt toolchains


The aim of this project is to create a simple microkernel using Ada as the
implementation language.

To get the toolchain built, enter the thirdparty directory, and copy the file to, edit and then run the following
command to build the native toolchain:

  ./ -t native

This will compile and install the latest version of GCC (4.6.1) to the directory
of your choice. With a Debian Squeeze machine, this process takes approximately
5.3GB of disk space.

The build times on my machine are as follows:

Native: Last Process Took: 170m37.16s
ARM   : Last Process Took: 34m13.37s

As the native toolchain is bootstrapped it is compiled 3 times and then we check it
explicitly, the following are my results of the testsuite (C, Ada, C++):

		=== gcc Summary ===

# of expected passes		78926
# of unexpected failures	34
# of unexpected successes	29
# of expected failures		235
# of unsupported tests		1101
/home/laguest/src/mine/tamp/thirdparty/build/native/gcc-4.6.1/gcc/xgcc  version 4.6.1 (GCC) 

make[2]: [check-parallel-gcc] Error 1 (ignored)
make[2]: Leaving directory `/home/laguest/src/mine/tamp/thirdparty/build/native/gcc-4.6.1/gcc'
Test Run By laguest on Mon Jan  9 15:58:46 GMT 2012

		=== acats Summary ===
# of expected passes		2321
# of unexpected failures	0

		=== gnat Summary ===

# of expected passes		869
# of unexpected failures	1
# of expected failures		10
# of unresolved testcases	1
# of unsupported tests		2

		=== g++ Summary ===

# of expected passes		27536
# of expected failures		164
# of unsupported tests		359

The toolchain has been built on the following machines:

* Ubuntu 10.4; GNAT/GCC 4.4.3
* Debian Squeeze; GNAT/GCC 4.4.5, GNAT/GPL GCC 4.3.6

You then need to build a target toolchain, here we are targeting ARM:
NB. Currently, on my machine, this process requires approximately 1.2GB
free disk space to build the native toolchain and the arm-none-eabi

  ./ -t arm-none-eabi


After building the toolchain, you will then require a runtime library for the
board you intend to build TAMP for.

  ./ <boardname>

Where <boardname> can be stm32f4.

N.B: Just a quick note to say that GNAT is extremely flaky. I did manage using a
previous toolchain build to build an RTS using gnatmake and a project file;
for some reason, this is not working providing me with an internal compiler
error (or ICE):

arm-none-eabi-gcc -c -gnat05 -gnatg -O2 -ffunction-sections -fdata-sections --RTS=/home/laguest/src/mine/tamp/thirdparty/../rts/boards/stm32f4 -I- -gnatA /home/laguest/src/mine/tamp/rts/src/common/
Message: namet.adb:655

arm-none-eabi-gnatmake: INTERNAL ERROR. Please report.

So, for the moment, I will use a makefile with the script.


We intend to target the following architectures initially:

* ARM, using the STM32F4DISCOVERY board.
* PIC32, using the ChipKIT UNO32 board.

We will expand on the supported targets as we progress.

Getting started

TAMP uses GCC-4.6.1 due to the total inability of previous versions to build an
Ada cross compiler. We've managed to use the information from [12] & [13] to
create an Ada compiler targetted to a Zero Footprint Runtime so we can start
to build an application for bare hardware and still have some support from the
language, like exceptions.

So the first thing you will need is a toolchain:

1) Native Toolchain for your host OS, you need the same version of GNAT to build GNAT.
2) Cross Toolchain for the target you want to build TAMP for (i.e. ARM)

cd thirdparty

Edit for your enviroment, i.e. installation directory.
For help on commands: ./ --help 

Note: You can use sudo to install as root, but that would create root owned dirs.

By default the native compiler will also run the testsuite.

**** IMPORTANT!!!! ****

If you decide to use the SVN GCC tree rather than a snapshot of GCC 4.6, you
will need to update the tree yourself if you want to get a newer revision:

cd src/gcc
svn update

N.B: I've enforced this as using the script to update the tree causes the
patches to be overwritten and the build will fail, not only that, the cross
build will completely destroy the TAMP native build! It is very important
that this is understood!


Building the native compiler will also run the testsuite on GNAT, there is no
flag to turn this on/off yet so you will require the following packages:

  dejagnu, expect, tcl, bison, flex, patch.

  libusb for stlink, see

Common problems

* When building the cross gnattools, if the following error occurs:

  make.adb:7388:07: "Create_Temp_Output_File" is undefined

GNAT is not using the right version of the compiler to build itself! Check
that the native tools have built and installed themselves properly into $TAMP
otherwise the gnatmake found will be the system one and s-os_lib may not
have Create_Temp_Output_File subprogram defined.

* The configure script has stated that GNAT Tools will not be built:

Make sure the following flag is not on the configure line "-disable-libada"

The new patch seems to work!

Here are the instructions on building the toolchain for native and arm-none-eabi.

I've added a 4.6.1 patch that attempts to enable GCC to build fully without
horrible hacks, I have managed to get this to build with no errors. The patch 
is based on the info from [13].

I tested this with the following packages:

gcc-4.6.1 (C, C++, Ada)

Before you try this, make sure there are no arm-none-eabi-* tools in your $PATH

Obviously, you will require the gcc-4.6.1.diff patch applied to GCC.

Even though I mention above in the "common problems" I totally forgot about that
and yes, you do have to build the native GCC first.

1) Extract all source archives.
2) Make symbolic links from gcc to mpc, mpfr, gdb, gmp:
   cd gcc-4.6.1
   ln -s ../mpfr-3.0.1 mpfr
   ln -s ../gmp-5.0.2 gmp
   ln -s ../mpc-0.9 mpc
   ln -s ../gdb-7.3 gdb

3) Native

../../../src/gcc-4.6.1/configure --prefix=$HOME/opt/tamp --enable-multilib --enable-shared --with-gnu-as --with-gnu-ld --enable-languages=c,c++,ada --without-ppl --without-cloog --with-system-zlib --disable-libgomp --without-libffi  --without-libiconv-prefix --disable-libmudflap --disable-nls --disable-libstdcxx-pch  &> ../log.native.gcc.config.txt

make -j4 bootstrap &> ../log.gcc.make.txt
make install &> ../log.gcc.make.install.txt

export PATH=$HOME/opt/tamp/bin:$PATH

4) Cross

../../../src/binutils-2.22/configure --prefix=$HOME/opt/tamp --target=arm-none-eabi --enable-interwork --enable-multilib --disable-nls --disable-shared --disable-threads --with-gcc --with-gnu-as --with-gnu-ld --without-ppl --without-cloog &> ../log.binutils.config.txt

make -j4 &> ../log.binutils.make.txt
make install &> ../log.binutils.make.install.txt

../../../src/gcc-4.6.1/configure --prefix=$HOME/opt/tamp --target=arm-none-eabi --enable-interwork --enable-multilib --with-newlib --disable-nls --disable-shared --disable-threads --disable-lto --with-gnu-as --with-gnu-ld --enable-languages=c --disable-libssp --without-headers --without-ppl --without-cloog &> ../log.gcc1.config.txt

make all-gcc  &> ../log.gcc1.make.txt
make install-gcc &> ../log.gcc1.make.install.txt

../../../src/newlib-1.19.0/configure --prefix=$HOME/opt/tamp --target=arm-none-eabi --enable-interwork --enable-multilib --disable-nls --disable-shared --disable-threads  --with-gnu-as --with-gnu-ld --without-ppl --without-cloog &> ../log.newlib.config.txt

make -j4 &> ../log.newlib.make.txt
make install &> ../log.newlib.make.install.txt

# GCC2

../../../src/gcc-4.6.1/configure --prefix=$HOME/opt/tamp --target=arm-none-eabi --enable-interwork --enable-multilib --with-newlib --disable-nls --disable-shared --disable-threads --disable-lto --with-gnu-as --with-gnu-ld --enable-languages=c,c++,ada --disable-libssp --without-ppl --without-cloog &> ../log.gcc2.config.txt

make -j4 &> ../log.gcc2.make.txt
make install &> ../log.gcc2.make.install.txt


When building with gcc-4.6.2, there is a failure in newlib, apparently the fix is to add this


to the configure command, but this also fails later down the line in GCC itself. So, I will not be using 4.6.2
until we can get a patch.

Sample outputs

$ arm-none-eabi-gnatlink -v

Copyright (C) 1995-2010, Free Software Foundation, Inc.
Usage: arm-none-eabi-gnatlink switches mainprog.ali [non-Ada-objects] [linker-options]

  mainprog.ali   the ALI file of the main program

  -f    force object file list to be generated
  -g    Compile binder source file with debug information
  -n    Do not compile the binder source file
  -R    Do not use a run_path_option
  -v    verbose mode
  -v -v very verbose mode

  -o nam     Use 'nam' as the name of the executable
  -b target  Compile the binder source to run on target
  -Bdir      Load compiler executables from dir
  --GCC=comp Use comp as the compiler
  --LINK=nam Use 'nam' for the linking rather than 'gcc'

  [non-Ada-objects]  list of non Ada object files
  [linker-options]   other options for the linker

$ arm-none-eabi-gnatls -v

GNATLS 4.6.1
Copyright (C) 1997-2010, Free Software Foundation, Inc.

Source Search Path:

Object Search Path:

Project Search Path:

I think I finally have something to build on.


I've submitted the following bug as the compiler cannot create a libgnat.a from
a GPR file, this has to be done via make, it is no longer a blocker: - CLOSED

Using Long_Long_Integer in a divide generates a call to __aeabi_ldivmod, which
means we could really do with sorting out a proper target build for GNAT so
we don't have to hack it together. This will then build GCC support libs.

LPCXpresso1769 JTAG

We need to remove the LPC-Link board from the LPXpresso1769 board. This then
leaves us open for an external JTAG debugger. The following are my notes and
given I know next to nothing about electronics, some help here would be

These are from [5]:

      J4 Xpresso1769 side (page 4: SWD/JTAG Interface)
Pins  Name
 2    VIO_3V3X
14    EXT_POWX
16    GNDX

Pin  2 = TRST_N (From page 5: LPC176X Side)
Pin 12 = SRST??

I came to the conclusion that Pin 12 would be the soft reset if pin 2 is
the test reset. Or are these the other way around?

External JTAG interfaces

This section will list various external JTAG debugger's and their pinouts and
we will gradually provide schematics for connecting them to J4 on the
LPCXpresso1769 board.

Opendous-JTAG [7], [10]

Pin	Function  LPCXpresso
0	TDI       10
1	TMS        4
2	TRST      ??
3	SRST      ??
4	TCK        6
5	TDO        8

USBprog [8]

Would this be possible?

FTDI V2DIP1-32 [9]

Would this be possible? Cheap, OpenOCD already works with the FTDI chip. Just
need to know which pins on this board would become with JTAG pins.

From oliver117 (on #Ada - Oliver Kleinke):

J4 pin connections

 2    VIO_3V3X               Vcc
 4    JTAG_TMS_SWDIOX        TMS
 8    JTAG_TDO_SWOX          TDO
10    JTAG_TDIX              TDI
12    JTAG_RESETX            RESET/SRST
14    EXT_POWX               connected to USB power (5V)
16    GNDX                   GND


1 Vcc  |  2 TMS
3 GND  |  4 TCK
5 GND  |  6 TDO
7 RTCK |  8 TDI
9 GND  | 10 nRESET/nSRST

ARM JTAG Header -> Board
1 -> 2
2 -> 4
3, 5, 9-> 16
4 -> 6
6 -> 8
7 -> (no RTCK on board, connect to GND)
8 -> 10
10 -> 12
(optional 5v) -> 14




[1] Cortex™-M3 Technical Reference Manual:

[2] ARMv7-M Architecture Reference Manual:

[3] Procedure Call Standard for the ARM Architecture:

[4] Run-time ABI for the ARM architecture:

[5] LPCXpresso1769 schematics:

[6] Strict Conformance to the ARM:

[7] Opendous-JTAG:

[8] USBprog:

[9] FTDI V2DIP1-32:

[10] eStick:

[11] GNAT Pro User's Guide Supplement for Cross Platforms:

[12] GNAT Pro User's Guide Supplement for High-Integrity Edition Platforms:

[13] Ada’05 compiler for ARM based systems:
You can’t perform that action at this time.