liner error

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
2,181件の閲覧回数
Seitec
Contributor III

Hello

I have problem with my program. If I would like compile my program, Linker  show error.

Symbol _FSFLOAT

Symbol _FMUL

Symbol _FSTRUC

Symbol _FDIV

.

.

.

 

 

 

/*MEM hlavickovy soubor*/
#ifndef _MEM_
#define _MEM_


  #define F_OSC 16
  #define F_BUS 8
  #define T_BUS .125

int Initi(int);

#endif

 

 

 

 

 

/*mem.c */
#include "eeprommm.h"
#include <mc9s12dp256.h>
#pragma LINK_INFO DERIVATIVE "mc9s12dp256b"


int Initi(int oscclk){
  unsigned char prdclk;
  float eeclk = 0;
  int pom = 0;
 
  ECLKDIV_PRDIV8 = 0;
 
  if(oscclk >=12){                      /*MHz*/
    ECLKDIV_PRDIV8 = 1;
    prdclk = (unsigned char)(oscclk/8);
  }else{
    prdclk = (unsigned char)(oscclk*(5+.125));
  } 
 
  pom = (int)(oscclk*(5+.125));
  ECLKDIV_EDIV = (unsigned char)pom;
  eeclk = 2/(1+pom);
 
  if((((1/eeclk)+T_BUS) >= 5) && (eeclk > .15)){
    return 0;                                             /*ok*/
  } else{
    return 1;                                             /*bad*/
  }
}

ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
1,329件の閲覧回数
CompilerGuru
NXP Employee
NXP Employee

Try searching the forum, for example

http://forums.freescale.com/freescale/board/message?board.id=16BITCOMM&message.id=2244

 

Basically the project links against the integer only ANSI library therefore the floating point runtime support routines are not available.

 

Alternatively you might change the source code not to use floating point calculations. For example instead of

> prdclk = (unsigned char)(oscclk*(5+.125));

You get the same result with

prdclk = (unsigned char)(((oscclk*5125uL)/1000));

or

prdclk = (unsigned char)(((oscclk*41uL)/8)); // * (5+.125)

 

I used long, maybe int arithmetic is enough.

Either way, both long and int  arithmetic are a lot faster and shorter than using floating point.

 

Daniel

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
1,330件の閲覧回数
CompilerGuru
NXP Employee
NXP Employee

Try searching the forum, for example

http://forums.freescale.com/freescale/board/message?board.id=16BITCOMM&message.id=2244

 

Basically the project links against the integer only ANSI library therefore the floating point runtime support routines are not available.

 

Alternatively you might change the source code not to use floating point calculations. For example instead of

> prdclk = (unsigned char)(oscclk*(5+.125));

You get the same result with

prdclk = (unsigned char)(((oscclk*5125uL)/1000));

or

prdclk = (unsigned char)(((oscclk*41uL)/8)); // * (5+.125)

 

I used long, maybe int arithmetic is enough.

Either way, both long and int  arithmetic are a lot faster and shorter than using floating point.

 

Daniel

0 件の賞賛
返信
1,329件の閲覧回数
Seitec
Contributor III

Great. It works thank you very much.

0 件の賞賛
返信