cancel
Showing results for 
Search instead for 
Did you mean: 

problem with casting between float and int

fmiklasz
Associate II
Posted on June 04, 2010 at 19:09

problem with casting between float and int

12 REPLIES 12
fmiklasz
Associate II
Posted on May 17, 2011 at 13:53

Ole! it works:) thx all of you!

bboyandru
Associate
Posted on May 17, 2011 at 13:53

Hi,

I have recently reached the floating point problem for cortex m3 stm32f103 mcu. I saw that compiler generates __aeabi_ui2f which is undefined.

This problem occurs only when I am trying to cast to float. If I have an unsigned int variable with a value assigned to it and cast this variable to float this is working fine(only if I enable compiler optimizations), but if I pass a number to a function and try to cast that number to float compiler creates this undefined instruction.

Please let me know if you have managed to get it to work properly.

I have attached my test project.

Thank you,

Andrei

Posted on May 17, 2011 at 13:53

Perhaps you should #include <math.h>, and provide the linker with the correct path (-L) to the libraries you need.

I think you need to be looking for libm.a in the lib/thumb2 directory (ie appropriate for the STM32) for your tools.

http://www.network-theory.co.uk/docs/gccintro/gccintro_17.html

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..