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

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

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

ソリューションへジャンプ
2,685件の閲覧回数
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.

ラベル(1)
0 件の賞賛
返信
1 解決策
1,270件の閲覧回数
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 件の賞賛
返信
3 返答(返信)
1,270件の閲覧回数
amazue
Contributor I

I used the second solution.

 

It works great.

 

Thanks for the help.

0 件の賞賛
返信
1,271件の閲覧回数
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 件の賞賛
返信
1,270件の閲覧回数
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 件の賞賛
返信