How to add math.h capability to C_V4_4i_CF_SZ_MSL.a on MCF52235

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

How to add math.h capability to C_V4_4i_CF_SZ_MSL.a on MCF52235

Jump to solution
1,869 Views
amazue
Contributor I

Hi,

 

I'm using an MCF52235 and I need some trigs functions.

 

I cannot use the full C_4i_CF_MSL.a library because it is too big, so I'm trying to add math to the SZ version, but I face several problems.

 

First, it seems that the library was generated once at installation and is no more build. Nevertheless there are a lot of defines in code that depends on the µC. Which defines were used when building the library ?

When I compile my own version of the lib, should I change the target value to fit with my µC ?

When using default values, I build a library with a different size from the originary one...

 

I switched _MSL_FLOATING_POINT, _MSL_NO_MATH_LIB and _MSL_FLOATING_POINT_IO to fit with my needs but I still have link error. I suppose I have to add some math c files to the project, but I don't know which ones. If anyone can help...

 

Where can I find a doc that describes what to do ?

 

Thanks for the help.

Labels (1)
0 Kudos
1 Solution
454 Views
vier_kuifjes
Senior Contributor I

I once had the same problem. I fixed this by copying the source code from the (single precision) floating point math functions from the library source code into my own source code, and removing some of the conditional compile stuff that is in it. That way, I now have access to exp, log, sqr and all sorts of trig functions without the need of the full library.

 

I have added the source code in attachment for your convenience.

 

The original single precision math source code can be found in your Freescale installation folder:

C:\Program Files\Freescale\CodeWarrior for ColdFire V7.1\ColdFire_Support\msl\MSL_

C\MSL_Common_Embedded\Math\Single_precision

 

Message Edited by Marc VDH on 2010-01-06 01:13 PM

View solution in original post

0 Kudos
3 Replies
454 Views
amazue
Contributor I

I used the second solution.

 

It works great.

 

Thanks for the help.

0 Kudos
455 Views
vier_kuifjes
Senior Contributor I

I once had the same problem. I fixed this by copying the source code from the (single precision) floating point math functions from the library source code into my own source code, and removing some of the conditional compile stuff that is in it. That way, I now have access to exp, log, sqr and all sorts of trig functions without the need of the full library.

 

I have added the source code in attachment for your convenience.

 

The original single precision math source code can be found in your Freescale installation folder:

C:\Program Files\Freescale\CodeWarrior for ColdFire V7.1\ColdFire_Support\msl\MSL_

C\MSL_Common_Embedded\Math\Single_precision

 

Message Edited by Marc VDH on 2010-01-06 01:13 PM
0 Kudos
454 Views
PaoloRenzo
Contributor V

Attached configuration worked for me. Now I can use floating point, specifically

 

#include <math.h>

 

arg = modf(arg, &fi);

 

Note I'm using Register parameter passing, might be a good idea to start using it if you were using Standard Parameter passing, since it optimizes a little the use of RAM memory.

 

Hope this helps

0 Kudos