This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Wondering about GCC Hard FPU Support



In a project that I'm working on (software can be found here), I'm trying to use the FPU on the TM4C123 (the Launchpad LM4F120 part, rebranded). I'm able to compile successfully using -mfloat-abi=soft, but whenever I try -mfloat-abi=hard, I get a whole bunch of  uses VFP register argument errors. The full error printout is listed below:

/usr/bin/arm-none-eabi-ld: error: bin/main.out uses VFP register arguments, ../../TivaWare/driverlib/gcc/libdriver.a(fpu.o) does not
/usr/bin/arm-none-eabi-ld: failed to merge target specific data of file ../../TivaWare/driverlib/gcc/libdriver.a(fpu.o)
/usr/bin/arm-none-eabi-ld: error: bin/main.out uses VFP register arguments, ../../TivaWare/driverlib/gcc/libdriver.a(gpio.o) does not
/usr/bin/arm-none-eabi-ld: failed to merge target specific data of file ../../TivaWare/driverlib/gcc/libdriver.a(gpio.o)
/usr/bin/arm-none-eabi-ld: error: bin/main.out uses VFP register arguments, ../../TivaWare/driverlib/gcc/libdriver.a(interrupt.o) does not
/usr/bin/arm-none-eabi-ld: failed to merge target specific data of file ../../TivaWare/driverlib/gcc/libdriver.a(interrupt.o)
/usr/bin/arm-none-eabi-ld: error: bin/main.out uses VFP register arguments, ../../TivaWare/driverlib/gcc/libdriver.a(ssi.o) does not
/usr/bin/arm-none-eabi-ld: failed to merge target specific data of file ../../TivaWare/driverlib/gcc/libdriver.a(ssi.o)
/usr/bin/arm-none-eabi-ld: error: bin/main.out uses VFP register arguments, ../../TivaWare/driverlib/gcc/libdriver.a(sysctl.o) does not
/usr/bin/arm-none-eabi-ld: failed to merge target specific data of file ../../TivaWare/driverlib/gcc/libdriver.a(sysctl.o)
/usr/bin/arm-none-eabi-ld: error: bin/main.out uses VFP register arguments, ../../TivaWare/driverlib/gcc/libdriver.a(systick.o) does not
/usr/bin/arm-none-eabi-ld: failed to merge target specific data of file ../../TivaWare/driverlib/gcc/libdriver.a(systick.o)
/usr/bin/arm-none-eabi-ld: error: bin/main.out uses VFP register arguments, ../../TivaWare/driverlib/gcc/libdriver.a(timer.o) does not
/usr/bin/arm-none-eabi-ld: failed to merge target specific data of file ../../TivaWare/driverlib/gcc/libdriver.a(timer.o)
/usr/bin/arm-none-eabi-ld: error: bin/main.out uses VFP register arguments, ../../TivaWare/driverlib/gcc/libdriver.a(cpu.o) does not
/usr/bin/arm-none-eabi-ld: failed to merge target specific data of file ../../TivaWare/driverlib/gcc/libdriver.a(cpu.o)

It should be noted that I'm using arm-none-eabi-gcc in Arch Linux x64 to compile this project. I have been using the most recent TivaWare library and in my system, it is located two directories up from the project.

  • Cruz Monrreal II1 said:
    I'm able to compile successfully using -mfloat-abi=soft, but whenever I try -mfloat-abi=hard, I get a whole bunch of  uses VFP register argument errors.

    To remove those errors you need to either:

    1) Re-compile the TivaWare driverlib\gcc\libdriver.a with -mfloat=abi-hard.

    2) Compile your main using  -mfloat-abi=softfp. ‘softfp’ allows the generation of code using hardware floating-point instructions, but still uses the soft-float calling conventions.

     

    Edit: See the Hard FP compilation under GCC thread for more information

  • Cruz Monrreal said:
    I'm able to compile successfully using -mfloat-abi=soft, but whenever I try -mfloat-abi=hard, I get a whole bunch of  uses VFP register argument errors.

    This means that although your source files are compiled as hard-float, the libraries you link your program with are not compiled with hard-floats.

    a. For Cortex-M4F, add the following option to the compiler: -march armv7e-m. If you don't it will default to armv7-m which does not have an FPU. This will take care of linking the correct system libraries.

    b. You will need to re-compile the driverlib (or any other TivaWare part) with the same compiler settings (including -march as above), as the other member advised.

    --------------

    NOTE:

    If you are not sure whether your gcc compiler supports hard floats, you should find out before the steps above. One way to do that is to ask the compiler itself:

    Run the compiler on a command line:

    [prefix]-gcc --target-help

    You should see somewhere if hard ABI is supported:

    [....]
      Known floating-point ABIs (for use with the -mfloat-abi= option):
        hard soft softfp
    [....]

    But you also need the system libraries for hard floats, so also check these:

    [prefix]-gcc --print-multi-lib

    Output for the compiler TI ships with CCS is:

    C:\ti\ccsv5\tools\compiler\gcc-arm-none-eabi-4_7-2012q4\bin>arm-none-eabi-gcc.exe --print-multi-lib
    .;
    thumb;@mthumb
    fpu;@mfloat-abi=hard
    armv6-m;@mthumb@march=armv6s-m
    armv7-m;@mthumb@march=armv7-m
    armv7e-m;@mthumb@march=armv7e-m
    armv7-r/thumb;@mthumb@march=armv7-r
    armv7e-m/softfp;@mthumb@march=armv7e-m@mfloat-abi=softfp@mfpu=fpv4-sp-d16
    armv7e-m/fpu;@mthumb@march=armv7e-m@mfloat-abi=hard@mfpu=fpv4-sp-d16
    armv7-r/thumb/softfp;@mthumb@march=armv7-r@mfloat-abi=softfp@mfpu=vfpv3-d16
    armv7-r/thumb/fpu;@mthumb@march=armv7-r@mfloat-abi=hard@mfpu=vfpv3-d16

    Since Cortex-M4F is actually armv7e-m, we can see there are libraries with hard float support for it. There is also softfp (line just above).

    If you can see your cpu variant in the list and also have the libraries, i would say you can use hard fp without any problems :-)

    Argiris