FPU compilation error on 2.6.x

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
User avatar
Tectu
Posts: 1225
Joined: Thu May 10, 2012 9:50 am

FPU compilation error on 2.6.x

Post 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
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: FPU compilation error on 2.6.x

Post by Giovanni »

You are using old makefiles.

Giovanni
User avatar
Tectu
Posts: 1225
Joined: Thu May 10, 2012 9:50 am

Re: FPU compilation error on 2.6.x

Post 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
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: FPU compilation error on 2.6.x

Post 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
User avatar
Tectu
Posts: 1225
Joined: Thu May 10, 2012 9:50 am

Re: FPU compilation error on 2.6.x

Post 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
erfan
Posts: 14
Joined: Sat Apr 18, 2015 4:25 pm

Re: FPU compilation error on 2.6.x

Post 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);
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: FPU compilation error on 2.6.x

Post by Giovanni »

Hi,

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

Giovanni
Post Reply