Page 1 of 1

FPU compilation error on 2.6.x

Posted: Wed Aug 20, 2014 12:50 pm
by Tectu
Hi,

I am trying to compile the ARMCM4-STM32F407-DISCOVERY demo from the stable_2.6.x branch with FPU enabled and I am facing the following compiler error:

Code: Select all

Compiling crt0.c
arm-none-eabi-gcc: error: unrecognized argument in option '-mfloat-abi=yes'
arm-none-eabi-gcc: note: valid arguments to '-mfloat-abi=' are: hard soft softfp
../../os/ports/GCC/ARMCMx/rules.mk:183: recipe for target 'build/obj/crt0.o' failed
make: *** [build/obj/crt0.o] Error 1

I am using the GNU ARM GCC 4.8.4:

Code: Select all

[tectu@TecTop ARMCM4-STM32F407-DISCOVERY]$ arm-none-eabi-gcc --version
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.8.4 20140526 (release) [ARM/embedded-4_8-branch revision 211358]
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Note: The project compiles fine with FPU disabled.
Note: LTO is disabled as well.


Any ideas? I never had issues compiling with FPU support in the past (quite a few months ago, thought).


~ Tectu

Re: FPU compilation error on 2.6.x

Posted: Wed Aug 20, 2014 1:01 pm
by Giovanni
You are using old makefiles.

Giovanni

Re: FPU compilation error on 2.6.x

Posted: Wed Aug 20, 2014 1:07 pm
by Tectu
I am using the unmodified Makefile from the 2.6.x demo. I think that one should work without any problems?
Just to be sure I just deleted the entire repository and cloned it again, checked out the 2.6.x branch and same problem. Can you please confirm that it is working for you?


~ Tectu

Re: FPU compilation error on 2.6.x

Posted: Wed Aug 20, 2014 1:37 pm
by Giovanni

Code: Select all

# Enables the use of FPU on Cortex-M4 (no, softfp, hard).
ifeq ($(USE_FPU),)
  USE_FPU = hard
endif


This part.

Giovanni

Re: FPU compilation error on 2.6.x

Posted: Wed Aug 20, 2014 1:41 pm
by Tectu
I'm an idiot... Didn't read the Makefile comment, used to use 'yes' from the old days...
Sorry for the trouble.

~ Tectu

Re: FPU compilation error on 2.6.x

Posted: Sun Jan 17, 2016 2:43 pm
by erfan
Hi Giovanni,
I tried the following simple code in ChibiOS 3.04 without enabling FPU in makefiles and it works well!
I'm newbie on MCUs and I got curios about it. So would you please tell what is the difference between enabling and disabling FPU in makefiles while the the floating point computation works even USE_FPU is set no in makefiles?
Thanks,

Code: Select all

    float fa = (320 / 11)*9.3;
    uint16_t da = (uint16_t)fa;
    float fb = (240 / 10)*1.8;
    int db = (int)fb;
    int de = da + db;

    chprintf(chp, "float fa = (320 / 11) * 9.3 = %f\r\n", fa);
    chprintf(chp, "uint16_t da = (uint16_t)fa = %u\r\n", da);
    chprintf(chp, "float fb = (240 / 10) * 1.8 = %f\r\n", fb);
    chprintf(chp, "int db = (int)fb = %d\r\n", db);
    chprintf(chp, "int de = da + db = %d\r\n", de);

Re: FPU compilation error on 2.6.x

Posted: Sun Jan 17, 2016 3:03 pm
by Giovanni
Hi,

The float calculations are done in SW if the FPU is disabled, the difference is only in performance.

Giovanni