2010-08-31 14:59:46     Using libbfdsp with BF527

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

2010-08-31 14:59:46     Using libbfdsp with BF527

Tom Servo (UNITED STATES)

Message: 92975   

 

I'm attempting to use libbfdsp (iir_fr16 in particular) in my BF527 project.  I am including <math_bf.h> and <filter.h> and the code compiles without warning.  However, the link fails with "undefined reference to `__iir_fr16'"

 

LDFLAGS are set to "-lm -lbfdsp"

 

CFLAGS are set to "-pipe -Wall -g -O2 -mcpu=bf527-0.2 -DEMBED -D__uClinux__ -I../../.. -I../../../linux-2.6.x/include"

 

The code looks like this:

 

    fract16         input[30], output[30];

    iir_state_fr16  filter_state;

...

    iir_fr16 ( input, output, 30, &filter_state );

 

Build tools are 2009R1.

 

bfin-linux-uclibc-gcc (GCC) 4.1.2 (ADI svn)

 

 

 

What am I missing?

 

Thanks!

QuoteReplyEditDelete

 

 

2010-08-31 15:06:18     Re: Using libbfdsp with BF527

Mike Frysinger (UNITED STATES)

Message: 92976   

 

post the exact output of your build.  seems to work fine for me.

QuoteReplyEditDelete

 

 

2010-08-31 17:05:09     Re: Using libbfdsp with BF527

Tom Servo (UNITED STATES)

Message: 92977   

 

Thanks!  OK, here's the output:

 

../../../tools/bfin-linux-uclibc-gcc -pipe -Wall -g -O2 -mcpu=bf527-0.2 -DEMBED -D__uClinux__ -I../../.. -I../../../linux-2.6.x/include   -c -o bfdsp.o bfdsp.c

../../../tools/bfin-linux-uclibc-gcc -lm -lbfdsp --verbose --print-map -o bfdsp bfdsp.o

Using built-in specs.

Target: bfin-linux-uclibc

Configured with: /usr/src/packages/BUILD/blackfin-toolchain-09r1.1/../gcc-4.1/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=bfin-linux-uclibc --prefix=/opt/uClinux/bfin-linux-uclibc --enable-threads=posix --enable-shared --with-sysroot=/opt/uClinux/bfin-linux-uclibc/bfin-linux-uclibc/runtime --disable-libstdcxx-pch --disable-symvers --disable-libssp --disable-libffi --enable-clocale=generic --enable-version-specific-runtime-libs --enable-__cxa_atexit --with-bugurl=URL:  blackfin.uclinux.org/gf/project/toolchain/tracker --with-pkgversion=ADI-09r1.1-2

Thread model: posix

gcc version 4.1.2 (ADI svn)

/opt/uClinux/bfin-linux-uclibc/libexec/gcc/bfin-linux-uclibc/4.1.2/collect2 --sysroot=/opt/uClinux/bfin-linux-uclibc/bfin-linux-uclibc/runtime --eh-frame-hdr -m elf32bfinfd -z text -dynamic-linker /lib/ld-uClibc.so.0 -init __init -fini __fini -o bfdsp /opt/uClinux/bfin-linux-uclibc/bfin-linux-uclibc/runtime/usr/lib/crt1.o /opt/uClinux/bfin-linux-uclibc/bfin-linux-uclibc/runtime/usr/lib/crtreloc.o /opt/uClinux/bfin-linux-uclibc/bfin-linux-uclibc/runtime/usr/lib/crti.o /opt/uClinux/bfin-linux-uclibc/lib/gcc/bfin-linux-uclibc/4.1.2/crtbegin.o -L/opt/uClinux/bfin-linux-uclibc/lib/gcc/bfin-linux-uclibc/4.1.2 -L/opt/uClinux/bfin-linux-uclibc/lib/gcc/bfin-linux-uclibc/4.1.2/../../../../bfin-linux-uclibc/lib -L/opt/uClinux/bfin-linux-uclibc/bfin-linux-uclibc/runtime/lib -L/opt/uClinux/bfin-linux-uclibc/bfin-linux-uclibc/runtime/usr/lib -lm -lbfdsp bfdsp.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /opt/uClinux/bfin-linux-uclibc/lib/gcc/bfin-linux-uclibc/4.1.2/crtend.o /opt/uClinux/bfin-linux-uclibc/bfin-linux-uclibc/runtime/usr/lib/crtn.o

bfdsp.o: In function `main':

/home/tservo/code/project/uClinux-dist/user/TS/bfdsp/bfdsp.c:15: undefined reference to `__iir_fr16'

collect2: ld returned 1 exit status

make: *** [bfdsp] Error 1

 

 

 

 

Here's the C file:

 

 

 

/*

** Bogus libbfdsp test

*/

 

#include <filter.h>

#include <math.h>

#include <math_bf.h>

#include <stdio.h>

 

int main ( int argc, char *argv[] )

{

    fract16         input[30], output[30];

    iir_state_fr16  filter_state;

 

    iir_fr16 ( input, output, 30, &filter_state );

 

    printf ( "Bogus!\n" );

      

    return 0;

}

 

 

 

 

And here's the Makefile:

 

PATH := /opt/uClinux/bfin-uclinux/bin:/opt/uClinux/bfin-linux-uclibc/bin:$(PATH)

CC = ../../../tools/bfin-linux-uclibc-gcc

CFLAGS = -pipe -Wall -g -O2 -mcpu=bf527-0.2 -DEMBED -D__uClinux__ -I../../.. -I../../../linux-2.6.x/include

LDFLAGS = -lm -lbfdsp --verbose --print-map

 

# The applications

EXEC_BFDSP = bfdsp

OBJS_BFDSP = bfdsp.o

 

EXECS = $(EXEC_BFDSP)

 

.PHONY: all

all: $(EXECS)

 

$(EXEC_BFDSP): $(OBJS_BFDSP)

    $(CC) $(LDFLAGS) -o $@ $(OBJS_BFDSP)

 

.PHONY: clean

clean:

    -rm -f $(EXECS) *.elf *.o *.tgz *.gdb

 

.PHONY: distclean

distclean:

    -rm -f $(EXECS) *.elf *.o tags *.tgz *.gdb

 

  

QuoteReplyEditDelete

 

 

2010-08-31 17:09:48     Re: Using libbfdsp with BF527

Mike Frysinger (UNITED STATES)

Message: 92978   

 

you should not be using any of those -D/-I flags as they really make no sense

 

ignoring that, the problem is your linking order.  libraries must come last, not first.

QuoteReplyEditDelete

 

 

2010-08-31 17:37:23     Re: Using libbfdsp with BF527

Tom Servo (UNITED STATES)

Message: 92979   

 

That was it. Simple. Thanks very much!

Attachments

    Outcomes