OpenCores
no use no use 1/1 no use no use
Linker error undefined ref to _sbrk when make FreeRTOS.
by avamsi on Jun 16, 2012
avamsi
Posts: 54
Joined: Apr 16, 2012
Last seen: Jul 30, 2014
Hi,
When I am building(Using newlib toolchain) the FreeRTOS applications which contain some printf calls in the code. It is giving the following linker errors. Stdio.h is also included in the application. Without printfs in the code, there are no errors.

avamsi@avamsi01:~/OpenRISC/FreeRTOS/freertos-openrisc/FreeRTOSV6.1.1/Demo/OpenRISC_SIM_GCC$ make
make[1]: Entering directory `/home/avamsi/OpenRISC/FreeRTOS/freertos-openrisc/FreeRTOSV6.1.1/Demo/OpenRISC_SIM_GCC/arch'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/avamsi/OpenRISC/FreeRTOS/freertos-openrisc/FreeRTOSV6.1.1/Demo/OpenRISC_SIM_GCC/arch'
make[1]: Entering directory `/home/avamsi/OpenRISC/FreeRTOS/freertos-openrisc/FreeRTOSV6.1.1/Demo/OpenRISC_SIM_GCC/drivers'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/avamsi/OpenRISC/FreeRTOS/freertos-openrisc/FreeRTOSV6.1.1/Demo/OpenRISC_SIM_GCC/drivers'
Link....
/home/avamsi/OpenRISC/binaries/openrisc/or32-elf/lib/libc.a(lib_a-sbrkr.o): In function `_sbrk_r':
/home/avamsi/OpenRISC/gnu-src/bd-elf/or32-elf/newlib/libc/reent/../../../../../unisrc/newlib/libc/reent/sbrkr.c:60: undefined reference to `_sbrk'
/home/avamsi/OpenRISC/binaries/openrisc/or32-elf/lib/libc.a(lib_a-writer.o): In function `_write_r':
/home/avamsi/OpenRISC/gnu-src/bd-elf/or32-elf/newlib/libc/reent/../../../../../unisrc/newlib/libc/reent/writer.c:58: undefined reference to `_write'
/home/avamsi/OpenRISC/binaries/openrisc/or32-elf/lib/libc.a(lib_a-closer.o): In function `_close_r':
/home/avamsi/OpenRISC/gnu-src/bd-elf/or32-elf/newlib/libc/reent/../../../../../unisrc/newlib/libc/reent/closer.c:53: undefined reference to `_close'
/home/avamsi/OpenRISC/binaries/openrisc/or32-elf/lib/libc.a(lib_a-fstatr.o): In function `_fstat_r':
/home/avamsi/OpenRISC/gnu-src/bd-elf/or32-elf/newlib/libc/reent/../../../../../unisrc/newlib/libc/reent/fstatr.c:62: undefined reference to `_fstat'
/home/avamsi/OpenRISC/binaries/openrisc/or32-elf/lib/libc.a(lib_a-isattyr.o): In function `_isatty_r':
/home/avamsi/OpenRISC/gnu-src/bd-elf/or32-elf/newlib/libc/reent/../../../../../unisrc/newlib/libc/reent/isattyr.c:58: undefined reference to `_isatty'
/home/avamsi/OpenRISC/binaries/openrisc/or32-elf/lib/libc.a(lib_a-lseekr.o): In function `_lseek_r':
/home/avamsi/OpenRISC/gnu-src/bd-elf/or32-elf/newlib/libc/reent/../../../../../unisrc/newlib/libc/reent/lseekr.c:58: undefined reference to `_lseek'
/home/avamsi/OpenRISC/binaries/openrisc/or32-elf/lib/libc.a(lib_a-readr.o): In function `_read_r':
/home/avamsi/OpenRISC/gnu-src/bd-elf/or32-elf/newlib/libc/reent/../../../../../unisrc/newlib/libc/reent/readr.c:58: undefined reference to `_read'
make: *** [rtosdemo.or32] Error 1
avamsi@avamsi01:~/OpenRISC/FreeRTOS/freertos-openrisc/FreeRTOSV6.1.1/Demo/OpenRISC_SIM_GCC$

Here are the linker options used in the make file

CCPATH = /home/avamsi/OpenRISC/binaries/openrisc
GCCVER = $(shell $(CC) --version | grep gcc | cut -d" " -f9)
LIBS = -L./drivers -ldrivers \
-L$(CCPATH)/lib/gcc/$(TARGET)/$(GCCVER) \
-L$(CCPATH)/$(TARGET)/lib \
-lgcc -lc -lm

Discarding any of these options giving linker dependencies. Do I have to provide any more libraries to make it work..

Thanks,
A.vamsi
no use no use 1/1 no use no use
© copyright 1999-2026 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.