liner error

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

liner error

Jump to solution
1,360 Views
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*/
  }
}

Labels (1)
Tags (1)
0 Kudos
1 Solution
508 Views
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

View solution in original post

0 Kudos
2 Replies
509 Views
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 Kudos
508 Views
Seitec
Contributor III

Great. It works thank you very much.

0 Kudos