BuildCrossCompiler

Building and Installing an Ada Cross Compiler Tool Suite

Prerequisites

Get the following source packages

  • binutils (assembler, linker, etc.), 2.24
  • gcc (compiler), 4.9.2
  • avr-libc (C run time system, start-up code, linker scripts), 1.8.1
  • avr-ada (Ada run time system, gcc and binutils patches), 1.2.3

You need a native GNAT compiler on your system. Nowadays almost all Linux distributions contain the Ada enabled gcc. If your system compiler is not yet gcc-4.9, get the latest gcc-4.9 sources and build a new native compiler first (for at least C and Ada).

On Windows use the MinGW installer mingw-get to install gcc and the dev versions of gmp, mpfr, mpc and pthread. At the time of this writing (January 2014) MinGW is still at gcc-4.8. The easieast way is to install gcc-4.9 with Ada support from the GCC-TDM project http://tdm-gcc.tdragon.net/. In the msys shell set the PATH so that gcc from TDM is seen before the MinGW compiler.

You need the GNU binutils and the avr-libc library. The first is available on any GNU mirror. Take version 2.24. The latter is available from the AVR libc home page. Any version after 1.0 will do. I use the release 1.8.0.

The gcc sources must be from the 4.9 branch of gcc. I did all my tests and modifications on gcc-4.9.2.

Get the latest binutils and gcc patches from the AVR-Ada project. They are included in the full AVR-Ada source release in the directories patches/gcc/4.9.2/ and patches/binutils/2.24/.

Building the compiler

Have a look at the shell script build-avr-ada.sh in the tools/build/ directory. It automates the build process and we use it exclusively for building our compilers and tools. For a full description of how to use the current build script see the [BuildScript] page.

Experience by one of the developers for the previous version (is outdated by now)

Using Ubuntu Linux 8.10 (Intrepid Beta), I had to take the following steps:

  • download binutils-2.18, gcc-4.3.2 and avr-libc-1.6.2
  • check out WinAVR from CVS
  • copy and remove the patches as described:

    $ cp -a patches/gcc/4.3.0 patches/gcc/4.3.2
    $ cd patches/gcc/4.3.2
    $ rm 40-0-gcc-4.3.0-bug-10768.patch
    $ rm 40-1-gcc-4.3.0-bug-30243.patch
    $ rm 40-8-gcc-4.3.0-bug-35519.patch
    $ rm 40-9-gcc-4.3.0-bug-35542.patch
    $ rm 41-0-gcc-4.3.0-bug-34932.patch
    $ rm 41-1-gcc-4.3.0-bug-leaf.patch

  • copy the three attached binutils patches to patches/binutils/2.18 (see the AVR-Ada mailing list archives as of 2008-10-24)

Note: The configure-makeinfo patch fixes one bug, backported from 2.19. The other patches are necessary because of stricter rules of gcc-4.3.2. Then:

  • check out avr-ada from SVN
  • change the directories in the script
  • run the script

Related

Wiki: BuildScript