[En-Nut-Discussion] Will the FPU from the STM32F4xx supported (context.c)?
bon at elektron.ikp.physik.tu-darmstadt.de
bon at elektron.ikp.physik.tu-darmstadt.de
Tue Sep 3 11:13:44 CEST 2013
>>>>> "Henrik" == Henrik Maier <hmnews at proconx.com> writes:
Henrik> Not all Cortex M4 will have a FPU (its an optional peripheral)
Henrik> and its usage depends what options you pass to the compiler (eg
Henrik> -mfloat-abi=hard, -mfpu=fpv4-sp-d16 and so forth). I am not
Henrik> aware if these FPU settings are reflected in a compiler macro so
Henrik> we can test during compile time.
Henrik> So we have two conditions to check against. a) Is the Cortex-M4
Henrik> equipped with an FPU or not and b) is the code compiled with
Henrik> hard floating point or not. Only if both conditions are true it
Henrik> makes sense to save the additional registers.
At the moment, int nut/conf/arch/arch.nut
"FPUFLAGS=-mfloat-abi=hard -mfpu=fpv4-sp-d16"
is added for STM32F30x and STM32F4XX.
Henrik> One suggestion would be to add a HAS_FPU flag to the
Henrik> configurator which is set automatically when a specific CPU is
Henrik> selected, for example in case of the STM32F4xx series. That
Henrik> would satisfy the first condition a). What to do best if the
Henrik> code is not compiled with FPU instructions I am not certain. I
Henrik> can see issues when Nut/OS is compiled without FPU support (and
Henrik> hence no FPU context is saved) but then the user code with FPU
Henrik> support. I think it would be safer to save the FPU context in
Henrik> any case. I can't imagine having a FPU and not wanting to use
Henrik> it...
The HAS_FPU seems more appropriate, however the name should be more
specific, like HAS_CORTEX_M4_FPU.
Henrik> On 2/09/2013 7:12 PM, Ole Reinhardt wrote:
>> If the FPU is available, how can you be sure _not_ to use the FPU?
>> Won't it be used implicitly by the compiler if a flotingpoint
>> calculation is executed? This may even be used by a library which you
>> are not aware of.
>>
>> So i would suggest to add the FPU registers to the context switch by
>> default and add a configuration option to _not_ save them if really
>> wanted!
>>
Anybody going ahead?
Bye
--
Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
More information about the En-Nut-Discussion
mailing list