liner error

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

liner error

跳至解决方案
2,186 次查看
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,334 次查看
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,335 次查看
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,334 次查看
Seitec
Contributor III

Great. It works thank you very much.

0 项奖励
回复