[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: GNAT on armhf


On Tue, Mar 13, 2012 at 9:54 PM, Ludovic Brenta
<ludovic@ludovic-brenta.org> wrote:
> Tero Koskinen writes:
> There is a specific calling convention, in particular as regards
> floating point registers, but I think the compiler deals with that by
> itself.  Also, IIUC, the ABI for ARMv7 supports only the Thumb
> instruction format whereas ARMv6 allows both Thumb and the older, less
> densely packed, format.  It is this calling convention and format that
> prevent software compiled for armhf from running on ARMv6 hardware.  So,
> I think what's needed at this point is "just" someone to bootstrap the
> compiler on the appropriate hardware.

I managed to create some preliminary GNAT binary, which runs on Debian
armhf and generates Debian armhf binaries from Ada source code.

I also did a armhf cross-compiler, which runs on 64-bit Fedora x86_64

Links to gnat binaries:

Cross-compiler, runs on Fedora x86_64

Actual arm-linux-gnueabihf compiler, runs on Debian armhf:

This (second link) is compiled on x86_64 using the compiler in the first link.

I haven't managed to do native build (compile armhf GNAT on Debian armhf
using above armhf compiler), since gcc compilation dies to segfault on
qemu-arm, and I haven't had time to try it on real hardware yet.

In related news, GNAT on Debian armel seems to work pretty ok on Gumstix.

Only problem is that, I cannot compile my modified ACATS test suite (where
all tests go into a single binary), since GNAT dies to out-of-memory error
after a while (Gumstix has 256MB ram + 100MB swap on sd-card, qemu-arm
kills GNAT when it has comsumed more than 400MB memory).

The armhf-gnat building procedure was something like this:

1) Compile armhf binutils, using apt-get source binutils
  - Apply all binutils patches from Debian package
  - configure in following way:
../binutils-2.21.1/configure --target=arm-linux-gnueabihf
--with-sysroot=/home/tkoskine/gumstix/sid-armhf --disable-nls
--disable-multilib --enable-shared

/home/tkoskine/gumstix/sid-armhf is directory containing Debian sid
armhf installation
("sudo debootstrap --foreign --verbose --arch=armhf
--include=vim-nox,openssh-server,ntpdate,less,apt --exclude=nano sid
./sid-armhf http://ftp.fi.debian.org/debian"; or something similar
probably works)

2) Compile armhf cross-compiler, using apt-get source gcc (or was it gnat?)
  - Apply all Debian *arm* and *cross* patches, DO NOT apply Ada patches
  - Configure in following way:
../gcc-4.6.3/configure \
  --prefix=$HOME/gumstix/sid-armhf/cross-tools \
  --target=arm-linux-gnueabihf \
  --with-mpfr \
  --with-gmp \
  --with-mpc \
  --with-mode=thumb \
  --with-float=hard \
  --with-fpu=vfpv3-d16 \
  --with-arch=armv7-a \
  --disable-bootstrap \
  --program-prefix=arm-linux-gnueabihf- \
  --disable-libgomp \
  --disable-nls \
  --disable-shared \
  --disable-libssp \
  --disable-threads \
  --disable-multilib \
  --disable-libmudflap \
  --disable-libquadmath \

  - After this run "make" and correct manually any errors you see (you see some)
  - Run "make install" once "make" ran cleanly

3) Using the compiler from previous phase, compile armhf compiler
  - use same sources as above, again no Ada patches
  - configure in following way:
./gcc-4.6.3/configure \
  --prefix=$HOME/gumstix/sid-armhf/double-cross-tools \
  --build=x86_64-redhat-linux \
  --host=arm-linux-gnueabihf \
  --target=arm-linux-gnueabihf \
  --with-mpfr=${CLFS}/usr \
  --with-gmp=${CLFS}/usr \
  --with-mpc=${CLFS}/usr \
  --with-mode=thumb \
  --with-float=hard \
  --with-fpu=vfpv3-d16 \
  --with-arch=armv7-a \
  --disable-bootstrap \
  --with-sysroot=${CLFS} \
  --program-prefix=arm-linux-gnueabihf- \
  --disable-libgomp \
  --disable-nls \
  --disable-shared \
  --disable-libssp \
  --disable-threads \
  --disable-multilib \
  --disable-libmudflap \
  --disable-libquadmath \

  - Fix RTS_DIR in gnattools/Makefile to be:
RTS_DIR:=$(strip $(subst \,/,$(shell arm-linux-gnueabihf-gnatls -v |
grep adalib )))
  - Run "make", fix manually errors which you encounter
  - Run "make install" once "make" runs cleanly

After a while, you should have your armhf compiler.

"fix errors manually" might be quite tricky. For example, you probably need to
copy crt?.o files around into correct directories if some configure script
complains that gcc isn't able to create executables (see relevant
config.log files
for details).


Reply to: