ARM compilation error, VFP registers used by executable, not object file

后端 未结 11 684
面向向阳花
面向向阳花 2020-11-28 07:47

I have been having this problem for the last few days and I can\'t get my head around what is really happening here, or what is the problem.

I have a makefile with t

相关标签:
11条回答
  • 2020-11-28 08:16

    I encountered the issue using Atollic for ARM on STM32F4 (I guess it applies to all STM32 with FPU).

    Using SW floating point didn't worked well for me (thus compiling correctly).

    When STM32cubeMX generates code for TrueStudio (Atollic), it doesn't set an FPU unit in C/C++ build settings (not sure about generated code for other IDEs).

    Set a FPU in "Target" for (under project Properties build settings):

    • Assembler
    • C Compiler
    • C Linker

    Then you have the choice to Mix HW/SW fp or use HW.

    Generated command lines are added with this for the intended target:

    -mfloat-abi=hard -mfpu=fpv4-sp-d16
    

    armatollic

    0 讨论(0)
  • 2020-11-28 08:17

    I was facing the same issue. I was trying to build linux application for Cyclone V FPGA-SoC. I faced the problem as below:

    Error: <application_name> uses VFP register arguments, main.o does not
    

    I was using the toolchain arm-linux-gnueabihf-g++ provided by embedded software design tool of altera.

    It is solved by exporting: mfloat-abi=hard to flags, then arm-linux-gnueabihf-g++ compiles without errors. Also include the flags in both CC & LD.

    0 讨论(0)
  • 2020-11-28 08:24

    I have found on an arm hardfloat system where glibc binutils and gcc were crosscompiled, using gcc gives the same error.

    It is solved by exporting-mfloat-abi=hard to flags, then gcc compiles without errors.

    0 讨论(0)
  • 2020-11-28 08:31

    Use the same compiler options for linking also.

    Example:

    gcc  -mfloat-abi=hard fpu=neon -c -o test.cpp test.o
    gcc  -mfloat-abi=hard fpu=neon -c test1.cpp test1.o
    gcc test.o test1.o mfloat-abi=hard fpu=neon HardTest
    
    0 讨论(0)
  • 2020-11-28 08:35

    "Note that the hard-float and soft-float ABIs are not link-compatible; you must compile your entire program with the same ABI, and link with a compatible set of libraries." https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html arm-none-eabi-gcc.exe

    Silicon Labs "kjostera" "Employee" response to EFR32 Flex Gecko (crossreference Cortex-M4F): "So code compiled with the softfp ABI is not link time compatible with code compiled with hardfp ABI. So since we currently only support RAIL library compiled using the softfp ABI, this means that you will have to build your application as well using the softfp ABI." "Note that using softfp ABI does not mean that your code cannot use FPU instructions. Any code doing floating point arithmetic will use the FPU when the compiler thinks that it makes sense." "kjostera" then goes on to demonstrate that the GCC 7 generated Assembly for both the case of -mfloat-abi=softfp and -mfloat-abi=hard, the vmul.f32 instruction is invoked and the instruction count is 10 for softfp and 9 for hard. https://www.silabs.com/community/mcu/32-bit/forum.topic.html/enable_fpu_in_rail-p-SEYr https://www.silabs.com/documents/public/data-sheets/efr32fg1-datasheet.pdf https://www.silabs.com/documents/public/reference-manuals/efr32xg12-rm.pdf https://www.silabs.com/documents/public/reference-manuals/efr32xg13-rm.pdf https://www.silabs.com/documents/public/reference-manuals/efr32xg14-rm.pdf

    0 讨论(0)
提交回复
热议问题