Skip to content


Subversion checkout URL

You can clone with
Download ZIP
The Ada Microkernel Project
Ada Assembly Makefile
Tree: b468214b34

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


                    The Ada Microkernel Project (TAMP)

  **                                                                 **
  ** See the section titled "The new patch seems to work!" for       **
  ** instructions on how to build the toolchain.                     **


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

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


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

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.0) to the directory
of your choice. With a Debian Squeeze machine, this process takes approximately
2.4GB of disk space.

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. This process requires approximately 1.2GB free space.

  ./ -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>


  cd <tamp>/rts
  arm-none-eabi-gnatmake -P gnat.gpr -XBoard=stm32f4 -v

The current builds of the toolchain can now build the RTS from the GPR file.


We intend to target the following architectures initially:

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

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 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:
Something went wrong with that request. Please try again.