Re: GCC with Cortex-M4 hard float link error "X uses VFP register arguments, Y does not"

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

 



On 22 August 2012 17:38, Johannes Bauer <dfnsonfsduifb@xxxxxx> wrote:
> Hi Matt,
>
> On 22.08.2012 17:37, Matthew Gretton-Dann wrote:
>
>>> I'm guessing it's trying to link newlib stuff in from the libcrt* which
>>> might not be compiled with hard float, can that be correct? Then why
>>> would gcc's multilib show the correct strings? Could somebody please
>>> explain to me what I'm doing wrong?
>>
>> A couple of questions which may help diagnose the issue:
>>
>> 1) How have you configured GCC? (What does gcc -v show?)
>
> Using built-in specs.
> COLLECT_GCC=arm-none-eabi-gcc
> COLLECT_LTO_WRAPPER=/home/joe/bin/arm/libexec/gcc/arm-none-eabi/4.7.1/lto-wrapper
> Target: arm-none-eabi
> Configured with: ../configure --prefix=/home/joe/bin/arm/
> --enable-interwork --enable-multilib --with-newlib
> --with-headers=/tmp/newlib-1.19.0/newlib/libc/include
> --target=arm-none-eabi --disable-nls --disable-shared --disable-threads
> --with-gnu-ld --with-gnu-as --disable-libssp --disable-libmudflap
> --disable-libgomp --with-dwarf2 -v --disable-werror --with-cpu=cortex-m3
> --with-cpu=cortex-m4 --with-tune=cortex-m3 --with-tune=cortex-m4
> --with-mode=thumb --enable-target-optspace --with-float=hard
> --with-float=soft --enable-languages=c,c++
> Thread model: single
> gcc version 4.7.1 (GCC)

The multiple --with-cpu/--with-tune/--with-float options are
confusing, although probably OK as 'rightmost' should win.

You only need one of each of --with-cpu, --with-tune, and
--with-float.  [As an aside --with-cpu implies --with-tune for the
same CPU].

What I think you are missing is a default FPU though.  Add
--with-fpu=fpv4-sp-d16 to the configure line, and that should help.

In summary I think you want the following --with-* options on your command line:

   --with-cpu=cortex-m4 --with-fpu=fpv4-sp-d16 --with-mode=thumb
--with-float=soft

>> 2) What does the following command say is the directory in use?
>>
>>   arm-none-eabi-gcc -Wall -O2 -g -mcpu=cortex-m4 -mfloat-abi=hard -mthumb \
>>       -std=c99 -c -o foo.o foo.c -print-multi-directory
>
> This shows surprisingly little (only the CWD):
> .

This means that GCC has selected the default library to use, which
isn't what you want.  If the compiler has been configured correctly
then I would expect the output to be 'fpu'.

Once you've rebuilt GCC you will also need to build newlib again.
Your configuration options for that should be fine - as it will pick
the multilibs up from GCC.

I hope this helps.

Matt

-- 
Matthew Gretton-Dann
Linaro Toolchain Working Group
matthew.gretton-dann@xxxxxxxxxx


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux