ARM Linking Error "Uses VFP register arguments, main.elf does not" on windows 8 only?

16,280

Solution 1

The solution was actually very simple, it was related to the PATH variable not being set correctly by the toolchain's installer. To solve it in windows 8, go to Environment Variables => System Variables and I added "C:\Program Files (x86)\GNU Tools ARM Embedded\4.8 2014q1\bin" to the path variable. The installer had put it under "User Variables for Name" and that, forever reason, didn't work.

Solution 2

This answer may appear at the surface to be unrelated, but there is an indirect cause of this error message.

First, the "Uses VFP register..." error message is directly caused from mixing mfloat-abi=soft and mfloat-abi=hard options within your build. This setting must be consistent for all objects that are to be linked.

The indirect cause of this error may be due to the Eclipse editor getting confused by an error in the project's ".cproject" file. The Eclipse editor frequently reswizzles file links and sometimes it breaks itself when you make changes to your directory structures or file locations. This can also affect the path settings to your gcc compiler - for a subset of your project's files. While I'm not yet sure of exactly what causes this failure, replacing the .cproject file with a backup copy corrected this problem for me. In my case I noticed .java.null.pointer errors after adding an include directory path. I also found that a different path to the gcc compiler was being used for some of my sources that were local to the workspace, but not all of them. The two gcc compilers were using different float settings for unknown reasons - hence the VFP register error.

I compared the .cproject settings with a older copy and observed differences in entries for the sources causing the trouble - even though the overriding of project settings was disabled. By replacing the .cproject file with the old version the problem went away, and I'm leaving this as a reminder of what happened.

Share:
16,280

Related videos on Youtube

user747638
Author by

user747638

Updated on June 27, 2022

Comments

  • user747638
    user747638 almost 2 years

    I'm trying to get started on using an ARM STM32F4 Discovery Board and I'm getting some weird compiling errors when using the "GNU Tools" on Windows 8

    Currently my code is very simple:

    #include "stm32f4xx_conf.h"
    
    int main(void)
    {}
    

    This compiles using the "make" command perfectly find on Ubuntu 12 and windows 7, however I get the following error in Windows 8. I installed the same toolchain on all machines.

    C:/Program Files (x86)/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/bin/ld.exe: error C:\Users\MyName\AppData\Local\Temp\cckUTM2f.o users VFP register arguments, main.elf does not

    I have narrowed down this error down to the flag "-mfloat-abi=hard", which when switched to "-mfloat-abi=soft", lets the code compile, however this conflicts other files that are previously compiled with "-mfloat-abi=hard".

    Does anybody know why this would only occur on Windows 8 and how to fix it? If more information is needed, let me know. Sorry in advance if this is a nooby-question as I'm very new to this!

  • Dorin
    Dorin almost 4 years
    This solution worked for me. The problem was that source files were compiled with the flag -mhard-float, while the linker din not used it. So, do not mix the FloatingPoint flags between compiler and linker

Related