I would like to use ChibiOS with Eigen on a Raspberry Pi, but when I include the Eigen library I got an error:
Linking build/ch.elf
/opt/arm_gcc/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/lib/libc.a(lib_a-sbrkr.o): In function `_sbrk_r':
sbrkr.c:(.text+0x18): undefined reference to `_sbrk'
collect2: error: ld returned 1 exit status
make: *** [build/ch.elf] Error 1
I'm using Sourcery CodeBench Lite 4.7.2 cross compiler this is the make command:
arm-none-eabi-gcc -c -mcpu=arm7tdmi -O2 -ggdb -fomit-frame-pointer -falign-functions=16 -ffunction-sections -fdata-sections -Wall -Wextra -Wstrict-prototypes -Wa,-alms=build/lst/ -mno-thumb-interwork -MD -MP -MF .dep/build.d -I. -I../../os/ports/GCC/ARM -I../../os/ports/GCC/ARM/BCM2835 -I../../os/kernel/include -I../../os/hal/include -I../../os/hal/platforms/BCM2835 -I../../boards/RASPBERRYPI_MODB -I../../os/various -I../../os/contrib -I../../Eigen main.c -o main.o
How can I fix this error?
The function
_sbrk
sounds pretty much like a system call used with memory allocation. Are you sure that the system you are targeting supports thesbrk(2)
system call? In any case, you probably get better results asking about_sbrk
and Raspberry Pi. You might want to check this question which seems to be a similar problem.