Hi,
I am new to both gnuarm and newlib. I download the toolchain provided by
Darrik Spaude from gnuarm.org, and I am trying to build my
hello_world.c, but I got the following error:
/usr/local/arm/bin/../lib/gcc/arm-elf/4.2.0/../../../../arm-elf/lib/libc
.a(lib_a-freer.o):
In function `_malloc_trim_r':
../../../.././newlib/libc/stdlib/mallocr.c:3326: undefined reference to
`_sbrk_r'
../../../.././newlib/libc/stdlib/mallocr.c:3335: undefined reference to
`_sbrk_r'
../../../.././newlib/libc/stdlib/mallocr.c:3340: undefined reference to
`_sbrk_r'
/usr/local/arm/bin/../lib/gcc/arm-elf/4.2.0/../../../../arm-elf/lib/libc
.a(lib_a-makebuf.o):
In function `__smakebuf':
../../../.././newlib/libc/stdio/makebuf.c:54: undefined reference to
`_fstat_r'
/usr/local/arm/bin/../lib/gcc/arm-elf/4.2.0/../../../../arm-elf/lib/libc
.a(lib_a-mallocr.o):
In function `malloc_extend_top':
../../../.././newlib/libc/stdlib/mallocr.c:2160: undefined reference to
`_sbrk_r'
../../../.././newlib/libc/stdlib/mallocr.c:2197: undefined reference to
`_sbrk_r'
/usr/local/arm/bin/../lib/gcc/arm-elf/4.2.0/../../../../arm-elf/lib/libc
.a(lib_a-stdio.o):
In function `__sclose':
../../../.././newlib/libc/stdio/stdio.c:120: undefined reference to
`_close_r'
/usr/local/arm/bin/../lib/gcc/arm-elf/4.2.0/../../../../arm-elf/lib/libc
.a(lib_a-stdio.o):
In function `__sseek':
../../../.././newlib/libc/stdio/stdio.c:103: undefined reference to
`_lseek_r'
/usr/local/arm/bin/../lib/gcc/arm-elf/4.2.0/../../../../arm-elf/lib/libc
.a(lib_a-stdio.o):
In function `__swrite':
../../../.././newlib/libc/stdio/stdio.c:76: undefined reference to
`_lseek_r'
../../../.././newlib/libc/stdio/stdio.c:84: undefined reference to
`_write_r'
/usr/local/arm/bin/../lib/gcc/arm-elf/4.2.0/../../../../arm-elf/lib/libc
.a(lib_a-stdio.o):
In function `__sread':
../../../.././newlib/libc/stdio/stdio.c:47: undefined reference to
`_read_r'
I searched the web, and I think this is caused by missing stub
implementations. My host machine is Intel MAC and the target is
At91sam9260 based board running linux 2.6.22.1. I found that in the
toolchain it already contians a libgloss-linux.a, then I tried to
compile with -lgloss-linux,but I got the same error.
Is there an available newlib stub implementation for arm-linux? Or maybe
I misused the libgloss-linux.a?
I checked with: arm-elf-nm libgloss-linux.a|grep sbrk
000000ac T _sbrk
000000ac T sbrk
it seems the _sbrk_r is missing.