Ken MacLauchllan

Floating point problem with CW 7.0 and M52233DEMO board

Discussion created by Ken MacLauchllan on Aug 11, 2008
Latest reply on Aug 29, 2008 by Alexandre Kremer
Floating point problem with CW 7.0 and M52233DEMO board.

I am writing an application that needs floating point support. The project has the following libraries added :

When we write our own floating point functions in the debugger I can watch the correct parameter being passed to my function and the correct answer being returned. When I use sqrt() when I step into the function it appears the the parameter passed is corrupted and I get a garbage return from the function.

I have tried changing to all 3 different parameter passing schemes but without any luck.

I am now trying to remake the C_4i_CF_MSL.a library with the following defines :
#define _MSL_NO_MATH_LIB 0

This does not seem to result in any change though the new library is smaller than the old one. The problem also seems to occur whether I use one based on the Interniche projects or a new one generated by Codewarrior.

I also read the following in another post "Obviously, the result comes directly from compiler(movel #1072693248,%sp@-) not the runtime so it is really nothing with logN function. If you are right, the problem hides in prologue/epilogue function, could you direct me where to make the changes or give a patch(if you have)". This potentially sounds like my problem but the solution was not available from the thread I found this on.

Please help. This is urgent as our company are in a robot competition this week and we need the maths functions to navigate between GPS points properly. We were doing well till we hit this stumbling block.