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

Hello,

In my project I must use float numbers, but on compiling I become this error:

undefined reference to `__aeabi_ui2f'

undefined reference to `__aeabi_fdiv'

I start the linker with this command:

arm-none-eabi-ld -v -lgcc -LC:/WinARM/CodeSourcery/lib/gcc/arm-none-eabi/4.2.3/thumb -Tprj/STM32F103CB-ROM.ld -Map=main.map out/lib/src/cortexm3_macro.o out/src/main.o out/src/stm32f10x_it.o out/src/stm32f10x_vector.o out/src/analogout.o --output main.elf

The path from parameter -L exists, the file libgcc.a, too.

Or have I forgot a parameter?

Thank you for help. Regards Markus.

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

Quote:

In my project I must use float numbers,

Must you?

Why?

In very many cases, integers or fixed-point are preferable - especially if you can't get the floating-point to work! 8-)

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

I must. I have from a other project a lot of sources and I have not enought time to change inito integer.

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

Try calling the linker using the gcc driver, it will probably solve your problem, eg.

arm-none-eabi-gcc -Wl,-LC:/WinARM/CodeSourcery/lib/gcc/arm-none-eabi/4.2.3/thumb -Tprj/STM32F103CB-ROM.ld,-Map=main.map out/lib/src/cortexm3_macro.o out/src/main.o out/src/stm32f10x_it.o out/src/stm32f10x_vector.o out/src/analogout.o -o main.elf

Cheers

sjo

[ This message was edited by: sjo on 10-06-2008 15:08 ]

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

In a other forum have one person write me the right solution:

''Häng das -lgcc mal hinter die Liste von *.o Files.''

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

yes but if you use gcc to link then you will not have a issue.

I have never understand why people call ld directly.

Cheers

sjo

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

Hi all,

I've used Both Keil version 3.22 ( Free version 32K) and IAR EWARM v5.11 ( Free version 32K) , not yet GCC from CodeSourcery on a small routine using ''cos(), sin(), one addition , one multiplication and one division with only ''float'' variables using Keil ''MCBSTM32'' board at 8Mhz and I found that the same function is 7 time faster with IAR than using Keil floating librairies.

I' very intersted to see the result with GCC :) and I'm wondering if you have experienced similar results ? which seems very strange and keil is not providing optimized floating libraries.

Best Regards,

Asterix.

Ps: I've used #include ''math.h'' in the header files.

[ This message was edited by: asterix.magigimix on 10-06-2008 17:47 ]

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

Yes, the arm-none-eabi-gcc can linking, too, and it is working.

Thank you for help.

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

Floating point execution times can vary widely between different version of compliers, see ARM GNU below,

I'm in the same boat as you, need floating point, all the integer processors suck at it (figure 100 times slower as a first estimate), below are some times I and a friend compiled, if anyone has any more data, please add on to the list below, thanks!

MPS430, 32 bit floats, imagecraft complier, typical cycles

add 158

sub 184

mul 332

div 620

AVR, IAR Full opt for speed, 32 bit floats, typical cycles

add 173

sub 176

mul 175

div 694

sqrt 2586

log 3255

ARM7, GNU 3.3.1 complier 32 bit floats, typical cycles

add 472

sub 478

mul 439

div 652

sqrt 2387

log 13,523

ARM7, GNU 3.4.3 complier 32 bit floats, typical cycles

add 73

sub 74

mul 428

div 142

8051, keil complier, 32 bit floats, typical cycles

add 199

sub 201

mul 219

div 895

sqrt 1117

log 2006