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.
Solved! Go to Solution.
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_
I used the second solution.
It works great.
Thanks for the help.
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_
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