Cross compiling for Cortex A9

Karel Gardas karel.gardas at centrum.cz
Mon Jul 14 08:28:30 UTC 2014


On 07/12/14 07:27 AM, Michael Jones wrote:
> Karel,
>
> I have failed to figure out how to make this happen:
>
> ("target arch", "ArchARM {armISA = ARMv7, armISAExt = [VFPv3,NEON], armABI = HARD}”)
>

This is result of running ./configure on arm/ubuntu12.04 -- so I don't 
cross-compile, but rather compile natively. This is still preferred way 
to be able to run testsuite AFAIK...

> I have added poky to the list of vendors in aclocal.m4 then configured like this:
>
> /configure --target=arm-poky-linux-gnueabi --with-gcc=arm-poky-linux-gnueabi-gcc
>
> But I end up with ARMv5.
>
> I am new to Autotools and the Haskell build system, so I am not sure what controls this. I assume the idea is that the gcc cross-compiler compiles some code that checks for versions when it evaluates stuff like:
>
>      AC_COMPILE_IFELSE([
>          AC_LANG_PROGRAM(
>              [],
>              [#if defined(__ARM_ARCH_2__)  || \
>                   defined(__ARM_ARCH_3__)  || \
>                   defined(__ARM_ARCH_3M__) || \
>                   defined(__ARM_ARCH_4__)  || \
>                   defined(__ARM_ARCH_4T__) || \
>

You arm-poky-linux-gnueabi-gcc -v tells what? Also
arm-poky-linux-gnueabi-gcc -dM -E - < /dev/null may tell you something.

> So I then suspect the compiler needs options like -mcpu=cortex-a9 -mfpu=neon to make the proper version defined, so that the code can check the architecture.

It depends on how the compiler is configured. -v will tell you. Mine 
looks like:

karel at panda:~$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabi/4.6/lto-wrapper
Target: arm-linux-gnueabi
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 
4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs 
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr 
--program-suffix=-4.6 --enable-shared --enable-linker-build-id 
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext 
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu 
--enable-libstdcxx-debug --enable-libstdcxx-time=yes 
--enable-gnu-unique-object --enable-plugin --enable-objc-gc 
--enable-multilib --disable-sjlj-exceptions --with-arch=armv7-a 
--with-float=softfp --with-fpu=vfpv3-d16 --with-mode=thumb 
--disable-werror --enable-checking=release --build=arm-linux-gnueabi 
--host=arm-linux-gnueabi --target=arm-linux-gnueabi
Thread model: posix
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)


Please note --with-arch=armv7-a --with-float=softfp --with-fpu=vfpv3-d16 
--with-mode=thumb -- I'm sure you will also be able to build a 
cross-compiler using those option, so it'll generate ARMv7A code by 
default, use just half of VFPv3 regs (VFPv3-D16) and generate Thumbs 
isns by default (not ARM).

Karel


More information about the Glasgow-haskell-users mailing list