2011-04-20 07:02:41     coeff_iirdf1_fr16

Document created by Aaronwu Employee on Aug 26, 2013
Version 1Show Document
  • View in full screen mode

2011-04-20 07:02:41     coeff_iirdf1_fr16

Marcin Salata (POLAND)

Message: 100040   

 

Hello

 

I want to use coeff_iirdf1_fr16 but when I try compile my program I've got this error:

 

/opt/uClinux/bfin-uclinux/bfin-uclinux/runtime/usr/lib/libbfdsp.a(coeff_iirdf1_fr16.o): In function `__coeff_iirdf1_fr16':

coeff_iirdf1_fr16.c:(.text+0x32): undefined reference to `_fmaxf'

coeff_iirdf1_fr16.c:(.text+0x3a): undefined reference to `_fmaxf'

collect2: ld returned 1 exit status

 

 

 

Could anyone help me?

 

thanks

QuoteReplyEditDelete

 

 

2011-04-20 15:22:58     Re: coeff_iirdf1_fr16

Mike Frysinger (UNITED STATES)

Message: 100048   

 

you probably forgot to use -lm when linking

QuoteReplyEditDelete

 

 

2011-04-21 02:54:54     Re: coeff_iirdf1_fr16

Marcin Salata (POLAND)

Message: 100057   

 

No, I don't. I use -lm and -lbfdsp

QuoteReplyEditDelete

 

 

2011-04-21 03:41:41     Re: coeff_iirdf1_fr16

Simon Brewer (AUSTRALIA)

Message: 100066   

 

Hi,

 

I had a quick look and can't see why fmaxf is not included in the math library.  It is probably a bug however.

 

As a quick workaround, you can include the source for fmaxf in your program.  It is pretty trivial.

 

 

 

float                      /*{ ret - max of (x, y) }*/

fmaxf(

    float x,               /*{ - input parameter 1 }*/

    float y                /*{ - input parameter 2 }*/

)

{

    /*{ result = y }*/

    float result = y;

 

    /*{ if x > y, result = x }*/

    if (x > y)

    {

        result = x;

    }

 

    /*{ return result }*/

    return result;

}

 

 

Simon

QuoteReplyEditDelete

 

 

2011-04-21 03:50:29     Re: coeff_iirdf1_fr16

Marcin Salata (POLAND)

Message: 100067   

 

Hi Simon, thanks. Your solution rescue my life

QuoteReplyEditDelete

 

 

2011-04-21 04:29:31     Re: coeff_iirdf1_fr16

Mike Frysinger (UNITED STATES)

Message: 100069   

 

why do you think that ?  fmaxf() is in the math library and has been for quite a while now.  there is no need for a local fmaxf() definition if you simply link against -lm as i suggested.

QuoteReplyEditDelete

 

 

2011-04-21 05:04:15     Re: coeff_iirdf1_fr16

Simon Brewer (AUSTRALIA)

Message: 100077   

 

There is something screwy going on then...

 

sbrewer@joey:~$ cat test.c

#include <stdio.h>

//#include <math.h>

 

volatile float a = 3.0, b = 3.0;

 

int main()

{

    float c = fmaxf(a,b);

    return (int) c;

}

 

sbrewer@joey:~$ bfin-linux-uclibc-gcc test.c -lm -O

test.c: In function ‘main’:

test.c:8: warning: incompatible implicit declaration of built-in function ‘fmaxf’

/tmp/ccYcpzeP.o: In function `_main':

test.c:(.text+0x16): undefined reference to `_fmaxf'

collect2: ld returned 1 exit status

QuoteReplyEditDelete

 

 

2011-04-21 19:39:58     Re: coeff_iirdf1_fr16

Mike Frysinger (UNITED STATES)

Message: 100100   

 

sorry, my mistake.  i misread the libm output and gcc optimizes away constants.

 

this func is disabled in uClibc and has been for a while.  pretty much all float variants are either disabled or simply stubs to the double version.  so we support fmax(), but not fmaxf().

Attachments

    Outcomes