Floating point problem with CW 7.0 and M52233DEMO board

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Floating point problem with CW 7.0 and M52233DEMO board

2,608 Views
maclauk
Contributor I
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 :
C_4i_CF_Runtime.a
fp_coldfire.a
C_4i_CF_MSL.a

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_FLOATING_POINT 1
#define _MSL_NO_MATH_LIB 0
#define _MSL_FLOATING_POINT_IO 1

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.
Labels (1)
0 Kudos
4 Replies

392 Views
vier_kuifjes
Senior Contributor I
I've been having problems using FP on the 52233DEMO board too. I needed to use the EXP function in one of my programs. All compiled fine, but the linker didn't recognise the EXP function call.

I resolved this by simply copying the EXP function source code from the library source code into my program. If you only need to use one math function, the added advantage is that your program doesn't have to carry a complete math library, and you can actually see what comes in and out of the function.
0 Kudos

392 Views
CrasyCat
Specialist III
Hello
 
Do you have a prototype for the function sqrt before you call it?
In other words, did you include the appropriate header file (math.h) in your source file?
 
If you need an answer urgently I would recommend you to submit a service request .

Click here to submit a service request.

Make sure to attach a reproducible project and installed product information to the service request.
To generate the required information:
- Start CodeWarrior
- Open the project
- Select "Help" -> "Pack and Go" and follow instructions on the screen.

Attach the generated .zip file to the SR.
 
 
CrasyCat
0 Kudos

392 Views
maclauk
Contributor I
Yes I had math.h included. I'm fairly sure it won't compile correctly without it.

I have generated a request with a PackAndGo file and a list of plugin versions generated by Help->About.

Stepping though the code I can see all my floating point functions operating correctly, but the sqrt() function does not. Stepping into the library code using the debugger I can see the value I pass to the function being lost or corrupted.

We desperately needed an ATAN function for our project so I had to write my own to get us through the weekend. It is attached as part of the PackAndGo project as it was my proving ground for the problem.

I'd like to move back to using the standard libraries for our ongoing development so want help solving this problem.

I did try to regenerate the standard maths library using the project supplied with CW but was unsuccessful, even following advice given on these forums.

Finally it should be noted that the ColdFire_Build_Tools_Reference.pdf installed by the CodeWarrior install CD supplied with the M52233DEMO boards is corrupted and is unreadable with Acrobat 7.0. I did manage to find an older version of the document online.
0 Kudos

392 Views
Kremer
Contributor I
Currently I get it working in following way:
- I have created a project from a MCF52233 stationary
- I have removed the file C_TRK_4i_CF_SZ_MSL.
- I have replaced the file C_4i_CF_SZ_MSL.a by C_4i_CF_MSL.a
- I have adjusted the file ansi_prefix.CF.size.h as follows:
Code:
#define _MSL_FLOATING_POINT 1
//#define _MSL_NO_MATH_LIB 0
#undef _MSL_NO_MATH_LIB
#endif

#define _MSL_FLOATING_POINT_IO 1
- I add this macro to prefix text on the Target setting -> C/C++Preprocessor
#define __CF_USE_FULL_LIBS__ 1

Message Edited by Kremer on 2008-08-29 02:35 PM
0 Kudos