gcclinkerarmembeddedarmv6

build for ARMv6 with gnueabihf


I try to build an app for ARMv6 but, fail.

I guess the problem is the Toolchain which supports Hard Float but, ARMv6 does not.

Well, first i set -march=armv6, where compilation fails.

/opt/gcc-linaro-arm-linux-gnueabihf-4.8-2014.03_linux/arm-linux-gnueabihf/libc/usr/include/bits/byteswap.h: In function ‘__bswap_32’: /opt/gcc-linaro-arm-linux-gnueabihf-4.8-2014.03_linux/arm-linux-gnueabihf/libc/usr/include/bits/byteswap.h:45:1: sorry, unimplemented: Thumb-1 hard-float VFP ABI

Additionally, i set -mfloat-abi=soft which make the Linker complain:

/opt/gcc-linaro-arm-linux-gnueabihf-4.8-2014.03_linux/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: error: prog uses VFP register arguments, prog.o does not /opt/gcc-linaro-arm-linux-gnueabihf-4.8-2014.03_linux/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: failed to merge target specific data of file prog.o

Well, how do i actually build for ARMv6? Or is there a bug in the Toolchain?


Solution

  • Your toolchain is configured to emit Thumb code by default. The issue with that is that the only Thumb encodings of floating-point instructions are 32-bit Thumb-2 ones, which to all intents and purposes only exist on ARMv7 or later*, and certainly aren't available on plain ARMv6.

    To target pre-v7 architectures, you're best off compiling with -marm to generate ARM code instead of the relatively limited set of 16-bit Thumb instructions.

    * I suspect most people will never knowingly encounter an ARM1156.