STM32F7 Floating Point

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

Moderator: RoccoMarco

Post Reply
law
Posts: 20
Joined: Tue Jan 12, 2016 5:20 am
Has thanked: 3 times
Been thanked: 2 times

STM32F7 Floating Point

Post by law »

Hi Giovanni,
I'm working with ChibiOS 3.1.0 on STM32F745, using gcc-arm-none-eabi-4_9-2015q3.
I just had some issues with calls to sinf(), cosf() and sincosf() where I would get an unhandled exception when they were called.
I narrowed it down to the compiler setting in rules.mk, where according to the gcc-arm readme we should be using fpv5 rather than fpv4.

I changed rules.mk to:
OPT += -mfloat-abi=$(USE_FPU) -mfpu=fpv5-sp-d16 -fsingle-precision-constant

(from OPT += -mfloat-abi=$(USE_FPU) -mfpu=fpv4-sp-d16 -fsingle-precision-constant)

and things seem to be OK now, with calls to sinf etc working fine!
Does this need a change on your end? Or is this something I should be putting in the Makefile?

Thanks!
Laurence M
User avatar
Korken
Posts: 270
Joined: Wed Apr 02, 2014 4:09 pm
Has thanked: 5 times
Been thanked: 6 times

Re: STM32F7 Floating Point

Post by Korken »

It should be v5 for the Cortex-M7 series.
For details see the reference manual: http://infocenter.arm.com/help/topic/co ... efdgf.html
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: STM32F7 Floating Point

Post by Giovanni »

This requires changes in rules.mk and Makefiles... I'll try to include this in next release.

Giovanni
User avatar
piers
Posts: 42
Joined: Fri Apr 06, 2012 1:02 am
Been thanked: 15 times

Re: STM32F7 Floating Point

Post by piers »

Additionally the fpv4-sp-d16 is also listed in the asm files crt0_v7m.s, nilcoreasm_v7m.s and chcoreasm_v7m.s. I assume it must be changed to fpv5-sp-d16 there too?

And when looking to these files it feels strange that in crt0_v7m.s there is .cpu cortex-m3, and in the other two .cpu cortex-m4, independent on the cpu used. Can you elaborate on what is the reasoning behind this?

I'm getting here because my FPU on a STM32F745 is behaving strange, after half a second of running a some synthesizer code NaN's start appearing in the output, while exactly the same code works fine on a STM32F4 or on the pc. I don't know if I'm searching in the right direction though, anybody any idea what could influence the FPU? Might there be cache invalidation issues like with many other F7 peripherals?

Thanks, Piers
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: STM32F7 Floating Point

Post by Giovanni »

Hi,

All of those are not really important because the code is written in asm, the kind of FPU does not matter, those m3-m4 should be normalized however.

Giovanni
Post Reply