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 23.08.2012 09:53, Matthew Gretton-Dann wrote:

> The issue comes with building different multilibs for the different
> cores.  This is possible, but difficult to explain, and can involve
> changing bits of the GCC source.  So, I will point you in the
> direction of the ARM Embedded release of GCC:
> https://launchpad.net/gcc-arm-embedded.  This is targetted at
> M-profile cores, and provides appropriate multi-libs.  If its
> appropriate you can use what they provide - there are binaries and
> instructions on how to build from source available.

Ah, interesting. I didn't know this was so complicated. Looked at their
build instructions PDF and it appears that they provided modified
sourcecode which already handles the magic. Probably the source code
changed that you spoke of are already patched in there, I'm assuming.

It's not a big deal to compile multiple gcc variants for me for
different compiler, just something to be aware of.

>>> 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

The only change I did was "--"with-float=hard" instead of "soft", then
it worked perfectly (the --with-fpu switch was apparently missing).
Thank you very much!

> -mcpu/--with-cpu, -mfpu/--with-fpu, -mfloat-abi/--with-float are,
> generally, orthogonal options:
> 
>  -mcpu/--with-cpu selects the integer side instruction set available.
>  -mfpu/--with-fpu selects the FP/Advanced SIMD/WMMX instruction set available.
>  -mfloat-abi/--with-float selects how floating-point instructions may be used.
> 
> The manual gives full details, but in summary:
> 
>  * -mfloat-abi=soft means don't use any Floating-Point instructions
> anywhere, simulate them with integer side instructions.
>  * -mfloat-abi=softfp means you can use FP instructions, but still use
> the standard calling convention which passes float/double arguments in
> integer registers.
>  * -mfloat-abi=hard means you can use FP instructions, and the calling
> convention changes to pass float/double arguments in S/D registers.

Thank you for that explanation as well, it makes things much clearer.

Have a nice day,
Best regards,
Johannes


[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