Hi.

I am developing product, which should be small and fast as possible at the same time. Usually, I use parts which are in 48 pin QFPN or LQFP packages. Till now, I used F1 parts, but recently I went to F3. On F1 I did all calculations with integers only, because F1 doesn't have FPU and calculations with floats were too slow. Now, F3 parts also have FPU and I would like to ask a few questions.

First, how comparable is float calculation (with FPU enabled) with integer calculation in terms of speed?

Do you always use FPU and floats, even if speed is important for your application?

How could I enable FPU in Keil?

Is it possible to write FPU instructions in C or is it necessary to use assembly?

Thanks

I am developing product, which should be small and fast as possible at the same time. Usually, I use parts which are in 48 pin QFPN or LQFP packages. Till now, I used F1 parts, but recently I went to F3. On F1 I did all calculations with integers only, because F1 doesn't have FPU and calculations with floats were too slow. Now, F3 parts also have FPU and I would like to ask a few questions.

First, how comparable is float calculation (with FPU enabled) with integer calculation in terms of speed?

Do you always use FPU and floats, even if speed is important for your application?

How could I enable FPU in Keil?

Is it possible to write FPU instructions in C or is it necessary to use assembly?

Thanks

32-bit floats have awful precision, and it's not as if the FPU carries the values with higher precision for intermediate results. I generally avoid them unless the math and the number-space is very well understood.

If you have an efficient integer implementation, I'd stick with it. Benchmark your code/algorithm implemented both ways. I have some code where the original author moved directly into 64-bit doubles from 64-bit integers and did the math, by keeping the math integer until I'd dropped the significant bit count below 50-bits we gained significant precision in the fractional portion of the results (all values below 0.1).

The F1 was somewhat crippled by the slow FLASH, this was significantly remedied in the F2/F4 implementation.