written by Shawn Nock on 2016-07-04

GNAT GPL 2016 (arm-eabi) does not support armv6-m. So maybe you want this support or to customize something else about the installation.

  1. Download the following sources from AdaCore:

  2. Make output directory

    OUTDIR=/opt/gnat-arm
    mkdir -p $OUTDIR
    chown $USER $OUTDIR
    
  3. Make / Populate Sources Directory
    mkdir gnatgpl; cd gnatgpl
    tar xf ~/Downloads/mpc-1.0.2.tar.gz
    tar xf ~/Downloads/mpfr-3.1.2.tar.gz
    tar xf ~/Downloads/gmp-5.1.3.tar.gz
    tar xf ~/Downloads/binutils-2.25.51p-gpl-2016-src.tar.gz
    tar xf ~/Downloads/gcc-4.9-gpl-2016-src.tar.gz
    tar xf ~/Downloads/gnat-gpl-2016-src.tar.gz
    tar xf ~/Downloads/gcc-interface-4.9-gpl-2016-src.tar.gz
    
  4. Link and patch the sources as required
    ln -s $PWD/gcc-interface-4.9-gpl-2016-src gnat-gpl-2016-src/src/ada/gcc-interface
    ln -s $PWD/gnat-gpl-2016-src/src/ada gcc-4.9-gpl-2016-src/gcc
    wget https://gist.githubusercontent.com/nocko/c6148cc67694513b55fcbe4dda9c3615/raw/eda01b4dcf635120a0c21ea23ae0a34e0d7ea841/gnat-gpl-2016-cortex-m0.patch
    patch -p0 < gnat-gpl-2016-cortex-m0.patch
    cd gcc-4.9-gpl-2016-src
    ln -s ../mpc-1.0.2 mpc
    ln -s ../mpfr-3.1.2 mpfr
    ln -s ../gmp-5.1.3 gmp
    
  5. Build binutils
    cd ..
    mkdir build-binutils; cd build-binutils;
    ../binutils-2.25.51p-gpl-2016-src/configure --prefix=$OUTDIR --target=arm-eabi
    make -j4 CFLAGS="-Wno-error -Wno-error=misleading-indentation -Wno-error=parentheses"
    make install
    cd ..
    
  6. Add newly built binutils to PATH export PATH=$OUTDIR/bin:$PATH
  7. Build GCC
    mkdir build-gcc; cd build-gcc
    ../gcc-4.9-gpl-2016-src/configure --enable-languages=ada,c --with-gnu-as --with-gnu-ld --disable-nls --without-libiconv-prefix --disable-libstdcxx-pch --disable-libada --enable-checking=release --disable-libssp --enable-multilib --prefix=$OUTDIR --target=arm-eabi
    make -j4 all-gcc 
    make install-gcc 
    make -j4 all-target-libgcc
    make install-target-libgcc