[En-Nut-Discussion] (no subject)

Bob Wirka bobwirka at yahoo.com
Tue Oct 25 17:41:25 CEST 2011


I'm working with ethernut-4.8.9, 
the Codesourcery tools ("gcc version 4.5.1 (Sourcery G++ Lite 
2010.09-51)"), in an Eclipse managed project for an AT91SAM7X512 board. 
Using the Segger JLink (from Atmel) with the insight debugger.

Have been working successfully with this for awhile. Have been able to compile, burn, and debug without issue.

Recently added some code that causes the linker to choke with the error 
"undefined reference to `_sbrk'"; unresolved from libc.a. Have juggled 
the order of the libraries, and have added libc with  libnutcrt at the 
end, but it seems that the libc.a from the Codesourcery tools can't be 
satisfied. A 'nm' of libnutcrt.a shows that _sbrk is indeed there.

If sbrk.c is copied from the ethernut source tree into my project, the requirement is statisfied, and the project will build.

Any ideas on how to add or order libraries for linking so I don't have to include sbrk.c in my project? 


Bob Wirka

Actual message from linker:
/projects/compilers/arm/cs-eabi-lite/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/lib/libc.a(lib_a-sbrkr.o): In function `_sbrk_r':
sbrkr.c:(.text+0x18): undefined reference to `_sbrk'
collect2: ld returned 1 exit status
make: *** [bas-control.elf] Error 1

More information about the En-Nut-Discussion mailing list