2.6.0 & FPU

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

Moderator: RoccoMarco

Post Reply
User avatar
russian
Posts: 368
Joined: Mon Oct 29, 2012 3:17 am
Has thanked: 16 times
Been thanked: 14 times

2.6.0 & FPU

Post by russian »

I am migrating my project from 2.4.3 to 2.6.0 and it dies on startup, while printing the first line of the console greeting.

I was able to isolate the problem to CORTEX_USE_FPU in chconf.h - everything works without FPU option (#define CORTEX_USE_FPU FALSE) but breaks when I change this to TRUE. I am using stm32f4 discovery, optimization none -O0 and "-mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -fsingle-precision-constant" - these flags used to work for me with 2.4.3

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

Re: 2.6.0 & FPU

Post by Tectu »

I don't know about the FPU thing but lately there were some issues with the -O0 thing. Since you posted on the ChibiOS/GFX sub forum, I assume that you're using that as well, right? Can you please try to compile the application with -O2? The talk is going on here.


~ Tectu
User avatar
russian
Posts: 368
Joined: Mon Oct 29, 2012 3:17 am
Has thanked: 16 times
Been thanked: 14 times

Re: 2.6.0 & FPU

Post by russian »

I am reproducing this with my "hello Chibi" application - so, no GFX here, just a shell. Anyway, I have recompiled it with -O2 but it did not help :(
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: 2.6.0 & FPU

Post by Giovanni »

Could you try one of the standard demos and see if it fails for you when enabling the FPU? this would allow me to test this on my side.

Giovanni
User avatar
russian
Posts: 368
Joined: Mon Oct 29, 2012 3:17 am
Has thanked: 16 times
Been thanked: 14 times

Re: 2.6.0 & FPU

Post by russian »

Standard demo compiled with standard Makefile (with the addition of 'USE_FPU = yes') does work.

I have adjusted the Makefile to compile my project and it also works fine now with FPU. Historically I was always using Eclipse to compile my stuff, I will now try to figure out how to bring Eclipse compiler/linker preferences in sync with the Makefile and report which option was causing the issue.

PS: there is a typo in the makefile:
# Enable this if you really want to use the STM FWLib.
ifeq ($(USE_FPU),)
USE_FPU = no
endif
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: 2.6.0 & FPU

Post by Giovanni »

I am glad you resolved the problem and thanks for finding the typo.

Giovanni
User avatar
russian
Posts: 368
Joined: Mon Oct 29, 2012 3:17 am
Has thanked: 16 times
Been thanked: 14 times

Re: 2.6.0 & FPU

Post by russian »

In order to fix Eclipse compilation, I had to explicitly define a global symbol "-DCORTEX_USE_FPU=TRUE" - the '#define CORTEX_USE_FPU TRUE' line in chconf.h without the global symbol was causing the issue.
I believe this was not the case with 2.4.3.

Is it expected behavior that this setting is expected to be defined as a global symbol and not just as a line in the chconf.h now?
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: 2.6.0 & FPU

Post by Giovanni »

It should work even in chconf.h if accompanied by the proper compiler options, CORTEX_USE_FPU is not sufficient.

Giovanni
User avatar
russian
Posts: 368
Joined: Mon Oct 29, 2012 3:17 am
Has thanked: 16 times
Been thanked: 14 times

Re: 2.6.0 & FPU

Post by russian »

Giovanni wrote:It should work even in chconf.h if accompanied by the proper compiler options, CORTEX_USE_FPU is not sufficient.

Giovanni

I am not sure what you are saying :( Here are my results (all other options are the same across all configurations)
2.4.3: works with only "#define CORTEX_USE_FPU TRUE" without "-DCORTEX_USE_FPU=TRUE"

2.6.0: unhandedException indefinite loop in case of "#define CORTEX_USE_FPU TRUE" without "-DCORTEX_USE_FPU=TRUE" (change in behavior comparing to 2.4.3)
2.6.0: works with "#define CORTEX_USE_FPU TRUE" AND "-DCORTEX_USE_FPU=TRUE"
Post Reply