cancel
Showing results for 
Search instead for 
Did you mean: 

Compilling with float?

markusmueller19
Associate II
Posted on May 28, 2009 at 13:24

Compilling with float?

27 REPLIES 27
markusmueller19
Associate II
Posted on May 17, 2011 at 12:36

With arm-none-eabi-gcc in thumb2 mode (GNU ld (Sourcery G++ Lite 2008q1-126) 2.18.50.20080215), 32 bit floats, exact CPU cycles

cos 4316

sin 4319

sqrt ???

atan 4440

add 92

mul 48

div 73

16-32micros
Associate III
Posted on May 17, 2011 at 12:36

Hi Markus,

Thank you for your contribution and the results for GNU CodeSourcery

so we can say that both :

1) Keil 3.22 , Option -03 Time + Not using ''MicroLib'' Option

2) IAR 5.11 , Option Full Speed

Have quite the most optimized floating libraries running with STM32 in average :)

Let's see the next builds of both Compilers coming in the next couple of weeks/months ;)

Cheers, STOne-32.

slawcus
Associate II
Posted on May 17, 2011 at 12:36

I have results for Rowley Crossworks 1.7 with no optimization, flash debug option and HW cycle counter at address 0xE0001004

cos: 2733

sin: 2637

sqrt: 2310

atan: 3590

add: 46

mul: 50

div: 138

for optimization level 2:

cos: 2690

sin: 2594

sqrt: 2267

atan: 3547

add, mul and div were optimized away ;)

And this were lib function for double!!!

using float versions (32 bit) gives this results for no optimization

cosf: 1288

sinf: 1190

sqrtf: 819

atanf: 1720

So ... the winner is?

Anyway, we should also look at documentation for float libs. I think that super fast math doesn't even bother to check for valid data, supported types (single, double), etc. Rowley does all that.

[ This message was edited by: slawcus on 20-06-2008 13:55 ]

suyongyao
Associate II
Posted on May 17, 2011 at 12:36

This is what i get:

Cortex-M3, IAR 4.42a compiler 32 bit floats,exact CPU cycles

cos 2947

sin 3053

sqrt 3566

atan 4778

add 71

mul 68

div 184

alexcarrillo
Associate II
Posted on May 17, 2011 at 12:36

I'm having problems when using float (in operations such as adding 2 float variables).

I'm using the gcc compiler.

What is the problem with float?

markusmueller19
Associate II
Posted on May 17, 2011 at 12:36

if you use the ld for linkting, then you must have the right ranking order from your parameters. The -l parameters must be at end.

bvisser
Associate
Posted on May 17, 2011 at 12:36

Quote:

On 19-06-2008 at 19:26, Anonymous wrote:

With arm-none-eabi-gcc in thumb2 mode (GNU ld (Sourcery G++ Lite 2008q1-126) 2.18.50.20080215), 32 bit floats, exact CPU cycles

cos 4316

sin 4319

sqrt ???

atan 4440

add 92

mul 48

div 73

This information is very helpful! Thank you! Could you maybe run the same benchmark, but only with 64-bit floating point numbers (double)? I'm busy with a project that requires 64-bit precision and need to know it the Cortex M3 with GNU GCC will work.

joseph239955
Associate II
Posted on May 17, 2011 at 12:36

The recent release v3.50 of KEIL tools has a newer version of library which should give a better floating processing speed when Microlib is used.

Could you try that with and see if the result is better? Thanks