Floating point math on Coldfire V1 - Code size problem

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

Floating point math on Coldfire V1 - Code size problem

ソリューションへジャンプ
1,219件の閲覧回数
gustavod
Contributor III

Hello,

 

I'm using some floating point functions on the Coldfire V1 (MCF51JM128 - Codewarrior 6.3).

Basically these functions are Multiply, Divide, Cos, Sin and Acos. The problem is that Codewarrior compiler links the entire floating point library to my project, which increases the code in 22KB. It is too much.

 

I would like to know if its possible to link just the used functions in my project.

 

Thanks in advance,

Best regards,

Gustavo

ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
636件の閲覧回数
CrasyCat
Specialist III

Hello

 

The linker is performing dead striping by default. That means only objects (functions, variables) really used in the application are linked to the final executable file.

 

Are you sure the linker links the whole library to your project?

 

To check the actual code size open the file with extension .xMAP located in the project bin directory.

This is the map file generated by the linker. To check the actual application code size scroll to the bottom of the file and check size of the sections .code and .text.

 

This is the real size of your application. Size displayed in the .mcp window indicates the size of the application in worst case. If all functions were  used. You should not rely on this information.

 

CrasyCat

元の投稿で解決策を見る

0 件の賞賛
返信
4 返答(返信)
637件の閲覧回数
CrasyCat
Specialist III

Hello

 

The linker is performing dead striping by default. That means only objects (functions, variables) really used in the application are linked to the final executable file.

 

Are you sure the linker links the whole library to your project?

 

To check the actual code size open the file with extension .xMAP located in the project bin directory.

This is the map file generated by the linker. To check the actual application code size scroll to the bottom of the file and check size of the sections .code and .text.

 

This is the real size of your application. Size displayed in the .mcp window indicates the size of the application in worst case. If all functions were  used. You should not rely on this information.

 

CrasyCat

0 件の賞賛
返信
636件の閲覧回数
gustavod
Contributor III

Hi CrasyCat,

 

It is true, only really used objects are being linked to the final file. The problem is that floating point mul, div, sin, cos and acos occupy around 20KB of code. (I think that these functions call other functions.)

 

Thanks,

Gustavo

0 件の賞賛
返信
636件の閲覧回数
CrasyCat
Specialist III

Hello

 

Just a side question here.

 

Are you using printf in your application?

Once floating point arithmetic is enabled, size of function printf increases a lot. That might also explain the increase in the application size you are seeing.

 

Try commenting out all call to printf and check size of code after that. Just to make sure this is not the reason for the big increase.

 

CrasyCat

0 件の賞賛
返信
636件の閲覧回数
kef
Specialist I

CrasyCat,

 

#include <math.h>volatile float a,b,c;void main(void) {  EnableInterrupts; /* enable interrupts */  /* include your code here */  a = sin(b)/cos(c)*acos(a);  for(;;) {    __RESET_WATCHDOG(); /* feeds the dog */  } /* loop forever */  /* please make sure that you never leave main */}

 

 Above prontf-less code gives such record in map file:

 

  00000410 00000410 00005988 .text      code

 

That's 22kB.

0 件の賞賛
返信