2008-06-17 03:07:52     compilation of a C source file with coreB of Bf561 in uClinux

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

2008-06-17 03:07:52     compilation of a C source file with coreB of Bf561 in uClinux

pavithra D (INDIA)

Message: 57360   

 

Hello All,

 

        I am trying to compile a c source file which contains printf with coreb using bfin-elf tool chain,but i am facing following problem.

 

blackfin/bfin_src/opt/uClinux/bfin-elf/bin/bfin-elf-ld.real: cannot open linker script file -L.: No such file or directory

make: *** [hello] Error 1

 

undefined reference to printf

 

 

 

 

Without printf or any system call i am able to compile.load and run a c source file on coreb.But with system calls it is giving above errors.

 

Could any one please tell me the reason why the application is not able to open the linker script file.I gave libc.a path and include path also.

 

 

 

Thanks and Regards,

 

Pavithra

QuoteReplyEditDelete

 

 

2008-06-17 04:08:57     Re: compilation of a C source file with coreB of Bf561 in uClinux

Mike Frysinger (UNITED STATES)

Message: 57367   

 

post the actual commands you are running as well as the entire output from them

QuoteReplyEditDelete

 

 

2008-06-18 03:14:05     Re: compilation of a C source file with coreB of Bf561 in uClinux

pavithra D (INDIA)

Message: 57458   

 

Hi Mike,

 

           Thanks for the reply.

 

           In  my hello.c file just i am trying to print hello using printf(),when i try to compile this file using the below command

 

bfin-elf-gcc  -mcpu=bf561 hello.c  -o hello.o

 

I am getting following errors.

 

/blackfin/bfin_src/opt/uClinux/bfin-elf/bin/../lib/gcc/bfin-elf/4.1.1/../../../../bfin-elf/lib/libc.a(closer.o): In function `_close_r':

/usr/src/packages/BUILD/blackfin-toolchain-07r1.1/../gcc-4.1/newlib/libc/reent/closer.c:53: warning: _close is not implemented and will always fail

/blackfin/bfin_src/opt/uClinux/bfin-elf/bin/../lib/gcc/bfin-elf/4.1.1/../../../../bfin-elf/lib/libc.a(fstatr.o): In function `_fstat_r':

/usr/src/packages/BUILD/blackfin-toolchain-07r1.1/../gcc-4.1/newlib/libc/reent/fstatr.c:62: warning: _fstat is not implemented and will always fail

/blackfin/bfin_src/opt/uClinux/bfin-elf/bin/../lib/gcc/bfin-elf/4.1.1/../../../../bfin-elf/lib/libc.a(makebuf.o): In function `__smakebuf':

/usr/src/packages/BUILD/blackfin-toolchain-07r1.1/../gcc-4.1/newlib/libc/stdio/makebuf.c:96: warning: isatty is not implemented and will always fail

/blackfin/bfin_src/opt/uClinux/bfin-elf/bin/../lib/gcc/bfin-elf/4.1.1/../../../../bfin-elf/lib/libc.a(lseekr.o): In function `_lseek_r':

/usr/src/packages/BUILD/blackfin-toolchain-07r1.1/../gcc-4.1/newlib/libc/reent/lseekr.c:58: warning: _lseek is not implemented and will always fail

/blackfin/bfin_src/opt/uClinux/bfin-elf/bin/../lib/gcc/bfin-elf/4.1.1/../../../../bfin-elf/lib/libc.a(readr.o): In function `_read_r':

/usr/src/packages/BUILD/blackfin-toolchain-07r1.1/../gcc-4.1/newlib/libc/reent/readr.c:58: warning: _read is not implemented and will always fail

/blackfin/bfin_src/opt/uClinux/bfin-elf/bin/../lib/gcc/bfin-elf/4.1.1/../../../../bfin-elf/lib/libc.a(writer.o): In function `_write_r':

/usr/src/packages/BUILD/blackfin-toolchain-07r1.1/../gcc-4.1/newlib/libc/reent/writer.c:58: warning: _write is not implemented and will always fail

 

 

 

 

It builds the executable,if i try to run this executable on target it gives,this code is not linked with coreb.

 

 

 

 

 

I have tried other method.

 

Here i am using makefile.I am calling C function in hello.c from coreb.S

 

The makefile attachment is as below.

 

When i compile i am getting following errors.

 

If i don't link the file with any library i am getting the erros as in error.log file attached below.

 

If i link with the path using -L i am getting the errors as in err1.log file attached below.

 

 

 

But i am able to load and run the application on coreb without any system calls and able to get results in coreb.

 

 

 

Please suggest me where i am going wrong.

 

It will be a great help.

 

 

 

 

 

Thanks and Regards,

 

Pavithra

 

 

 

 

 

 

 

 

 

 

 

error.log

Makefile

err1.log

QuoteReplyEditDelete

 

 

2008-06-18 05:00:28     Re: compilation of a C source file with coreB of Bf561 in uClinux

Mike Frysinger (UNITED STATES)

Message: 57504   

 

those arent errors, those are warnings (it even says "warning" in the output)

 

the log files you posted also apparently dont contain any errors

QuoteReplyEditDelete

 

 

2008-06-18 05:47:41     Re: compilation of a C source file with coreB of Bf561 in uClinux

pavithra D (INDIA)

Message: 57507   

 

Hi Mike,

 

     Sorry that log file was not complete.Please find the log files here.

 

I have one query,right now i am passing data from coreA to coreB application and the result gets displayed in coreA with the help of dualcore_test.c driver.Is it possible to display the data in coreB.

 

Whether coreB supports printf system call and other system calls.What about the warnigs i am getting,will it be some linking problem. I am using uclinux-dist2007R1-RC3 withe bfin-elf-gcc-4.1.1 tool chain.

 

 

 

Please guide me in this.

 

 

 

Regards,

 

Pavithra

 

 

 

error.log

err1.log

QuoteReplyEditDelete

 

 

2008-06-18 06:02:21     Re: compilation of a C source file with coreB of Bf561 in uClinux

Mike Frysinger (UNITED STATES)

Message: 57509   

 

this command is obviously wrong ... -L does not take paths to files:

bfin-elf-ld -N -M -T -L/blackfin/bfin_src/opt/uClinux/bfin-elf/bfin-elf/lib/libc.a coreb.lds coreb.o hello.o -o hello

 

read the linker documentation:

http://sourceware.org/binutils/docs-2.18/ld/Options.html#Options

QuoteReplyEditDelete

 

 

2008-06-18 08:48:12     Re: compilation of a C source file with coreB of Bf561 in uClinux

pavithra D (INDIA)

Message: 57523   

 

Hi Mike,

 

    I have tried with below command

 

bfin-elf-ld -N -M -T  /blackfin/bfin_src/opt/uClinux/bfin-elf/bfin-elf/lib/crt0.o coreb.lds coreb.o $< -o $@ -lc

 

i am getting following errors

 

 

 

 

cc1: warning: bf561 support is incomplete yet.

bfin-elf-ld -N -M -T /blackfin/bfin_src/opt/uClinux/bfin-elf/bfin-elf/lib/crt0.o coreb.lds coreb.o hello.o -o hello -lc

/blackfin/bfin_src/opt/uClinux/bfin-elf/bin/bfin-elf-ld.real:/blackfin/bfin_src/opt/uClinux/bfin-elf/bfin-elf/lib/crt0.o:1: ignoring invalid character `\177' in expression

/blackfin/bfin_src/opt/uClinux/bfin-elf/bin/bfin-elf-ld.real:/blackfin/bfin_src/opt/uClinux/bfin-elf/bfin-elf/lib/crt0.o:1: ignoring invalid character `\001' in expression

/blackfin/bfin_src/opt/uClinux/bfin-elf/bin/bfin-elf-ld.real:/blackfin/bfin_src/opt/uClinux/bfin-elf/bfin-elf/lib/crt0.o:1: ignoring invalid character `\001' in expression

/blackfin/bfin_src/opt/uClinux/bfin-elf/bin/bfin-elf-ld.real:/blackfin/bfin_src/opt/uClinux/bfin-elf/bfin-elf/lib/crt0.o:1: ignoring invalid character `\001' in expression

/blackfin/bfin_src/opt/uClinux/bfin-elf/bin/bfin-elf-ld.real:/blackfin/bfin_src/opt/uClinux/bfin-elf/bfin-elf/lib/crt0.o:1: ignoring invalid character `\000' in expression

/blackfin/bfin_src/opt/uClinux/bfin-elf/bin/bfin-elf-ld.real:/blackfin/bfin_src/opt/uClinux/bfin-elf/bfin-elf/lib/crt0.o:1: ignoring invalid character `\000' in expression

/blackfin/bfin_src/opt/uClinux/bfin-elf/bin/bfin-elf-ld.real:/blackfin/bfin_src/opt/uClinux/bfin-elf/bfin-elf/lib/crt0.o:1: ignoring invalid character `\000' in expression

/blackfin/bfin_src/opt/uClinux/bfin-elf/bin/bfin-elf-ld.real:/blackfin/bfin_src/opt/uClinux/bfin-elf/bfin-elf/lib/crt0.o:1: ignoring invalid character `\000' in expression

/blackfin/bfin_src/opt/uClinux/bfin-elf/bin/bfin-elf-ld.real:/blackfin/bfin_src/opt/uClinux/bfin-elf/bfin-elf/lib/crt0.o:1: ignoring invalid character `\000' in expression

/blackfin/bfin_src/opt/uClinux/bfin-elf/bin/bfin-elf-ld.real:/blackfin/bfin_src/opt/uClinux/bfin-elf/bfin-elf/lib/crt0.o:1: ignoring invalid character `\000' in expression

/blackfin/bfin_src/opt/uClinux/bfin-elf/bin/bfin-elf-ld.real:/blackfin/bfin_src/opt/uClinux/bfin-elf/bfin-elf/lib/crt0.o:1: ignoring invalid character `\000' in expression

/blackfin/bfin_src/opt/uClinux/bfin-elf/bin/bfin-elf-ld.real:/blackfin/bfin_src/opt/uClinux/bfin-elf/bfin-elf/lib/crt0.o:1: ignoring invalid character `\000' in expression

/blackfin/bfin_src/opt/uClinux/bfin-elf/bin/bfin-elf-ld.real:/blackfin/bfin_src/opt/uClinux/bfin-elf/bfin-elf/lib/crt0.o:1: ignoring invalid character `\000' in expression

/blackfin/bfin_src/opt/uClinux/bfin-elf/bin/bfin-elf-ld.real:/blackfin/bfin_src/opt/uClinux/bfin-elf/bfin-elf/lib/crt0.o:1: ignoring invalid character `\001' in expression

/blackfin/bfin_src/opt/uClinux/bfin-elf/bin/bfin-elf-ld.real:/blackfin/bfin_src/opt/uClinux/bfin-elf/bfin-elf/lib/crt0.o:1: ignoring invalid character `\000' in expression

/blackfin/bfin_src/opt/uClinux/bfin-elf/bin/bfin-elf-ld.real:/blackfin/bfin_src/opt/uClinux/bfin-elf/bfin-elf/lib/crt0.o:1: syntax error

make[3]: *** [hello] Error 1

make[3]: Leaving directory `/spa_drms/Pavithra/new/uClinux-dist/user/blkfin-apps/corebld'

make[2]: *** [all] Error 2

make[2]: Leaving directory `/spa_drms/Pavithra/new/uClinux-dist/user/blkfin-apps'

make[1]: *** [all] Error 2

make[1]: Leaving directory `/spa_drms/Pavithra/new/uClinux-dist/user'

make: *** [subdirs] Error 1

bash-2.05b# vi user/blkfin-apps/corebld/Makefile

 

 

Thanks and Regards,

 

Pavithra

QuoteReplyEditDelete

 

 

2008-06-18 09:02:06     Re: compilation of a C source file with coreB of Bf561 in uClinux

Mike Frysinger (UNITED STATES)

Message: 57525   

 

you're still making the same mistake as the previous command you were running.  please read the linker docs i gave you.

QuoteReplyEditDelete

 

 

2008-06-20 06:35:19     Re: compilation of a C source file with coreB of Bf561 in uClinux

pavithra D (INDIA)

Message: 57624   

 

Hi Mike,

 

      I have tried to build,as per the procedures gives in the document which you have sent.But it is giving "undefined reference to printf or puts",and asking for newlib library.

 

Could you please tell me in which toolchain i can find newlib library for bfin-elf.

 

 

 

Thanks and Regards,

 

Pavithra

 

 

QuoteReplyEditDelete

 

 

2008-06-20 06:52:32     Re: compilation of a C source file with coreB of Bf561 in uClinux

Mike Frysinger (UNITED STATES)

Message: 57626   

 

newlib is part of every bfin-elf install as explained here:

http://docs.blackfin.uclinux.org/doku.php?id=toolchain:targets

 

the Core B document does not show executing bfin-elf-ld directly.  you shouldnt be doing it either.  if you do, you need to provide all the same flags that executing the compiler driver bfin-elf-gcc does (such as linking against the C library with -lc).

QuoteReplyEditDelete

 

 

2008-06-23 02:43:49     Re: compilation of a C source file with coreB of Bf561 in uClinux

pavithra D (INDIA)

Message: 57699   

 

Hi Mike,

 

      I am using  blackfin-toolchain-elf-gcc-4.1-08r1-8.i386.tar.gz ,but i didn't find newlib anywhere in this only newlib.h is there.I am trying to build newlib-1.14.0 for blackfin target but not able to build when i give it is showing the error "Newlib does not support CPU".

 

      Could you please tell me in which binary of toolchain i can find newlib and how to build newlib for bf561.

 

 

 

Thanks and Regards,

 

Pavithra

 

QuoteReplyEditDelete

 

 

2008-06-23 02:59:56     Re: compilation of a C source file with coreB of Bf561 in uClinux

Mike Frysinger (UNITED STATES)

Message: 57700   

 

as i said, newlib is already part of the bfin-elf toolchain.  if you installed the bfin-elf toolchain, you already have it.  there is no special header for you to include.  it's just a normal C library.

QuoteReplyEditDelete

 

 

2008-08-11 02:26:36     Re: compilation of a C source file with coreB of Bf561 in uClinux

Pranay Upadhyay (INDIA)

Message: 60221   

 

Hello Pavithra,

 

   I am trying the simple led blinking code on BF -561 Ez-kit through the core B.Myled blink  elf file is generated, but i am not getting how can we load the elf from corebld program for running the application from core B.Please guide me.

 

 

 

-Thanks & Regards

 

Pranay

Attachments

Outcomes