gcc -print-file-name and -mfpu option

Asked by Maximilian Pachl on 2017-11-28

Hello everyone,
I'm trying to compile an application for an ARM Cortex-M3. The application uses printf(). A fpu is specified with -mfpu=fpv4-sp-d16.
In order to find the correct libc the -print-file-name option is used as followed:
arm-none-eabi-gcc -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -print-file-name=libc.a

It points to the non-thumb version of libc:
/opt/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/lib/libc.a

When compiling the application with the same c flags thumb code is generated and is therefore not compatible with the libc.

When omitting the -mfpu=fpv4-sp-d16 parameter gcc points to the right library:
arm-none-eabi-gcc -mcpu=cortex-m4 -print-file-name=libc.a
/opt/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m/libc.a

What point do i miss?

Kind regards,
Maximilian Pachl

Question information

Language:
English Edit question
Status:
Solved
For:
GNU Arm Embedded Toolchain Edit question
Assignee:
No assignee Edit question
Solved by:
Thomas Preud'homme
Solved:
2017-11-28
Last query:
2017-11-28
Last reply:
2017-11-28

Hi Maximilian,

The default floating-point ABI is the softfloat variant. Specifying an FPU with a softfloat variant is a contradiction that GCC does not understand so it falls back to give you the default multilib: the one for Armv4T in arm mode. If you add -mfloat-abi=softfp or -mfloat-abi=hard to your command line you'll get the expected results.

Best regards,

Thomas

Maximilian Pachl (faryon93) said : #2

Thanks Thomas Preud'homme, that solved my question.

Maximilian Pachl (faryon93) said : #3

Hi Thomas,
thanks for your fast and detailed reply. You saved my day!

Best regards,
Maxi