AnsweredAssumed Answered

Linking errors when redirecting stdout to uart on stm32f2

Question asked by mex1 on Apr 17, 2014
Latest reply on Apr 18, 2014 by Clive One
Greetings,

I'm working with an stm32f215rg mcu and I'm attempting to redirect stdout/in to uart4. I seem to be getting linking errors when attempting to link all the objects/libs together. The line I use is below:

arm-none-eabi-gcc    -mthumb -mcpu=cortex-m3  -g -gdwarf-2 -T/home/leela/lib/scripts/stm32_flash.ld -Xlinker --gc-sections -Wl,-Map=uart.map -lm -lc -o uart.elf CMakeFiles/uart.elf.dir/src/main.c.o  -o ../../bin/uart.elf  ../lib/misc/libmisc.a ../lib/std/libleela_std.a

The error message that I receive is:

/usr/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb2/libc.a(lib_a-sbrkr.o): In function `_sbrk_r':
sbrkr.c:(.text+0x12): undefined reference to `_sbrk'
/usr/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb2/libc.a(lib_a-writer.o): In function `_write_r':
writer.c:(.text+0x16): undefined reference to `_write'
/usr/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb2/libc.a(lib_a-closer.o): In function `_close_r':
closer.c:(.text+0x12): undefined reference to `_close'
/usr/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb2/libc.a(lib_a-lseekr.o): In function `_lseek_r':
lseekr.c:(.text+0x16): undefined reference to `_lseek'
/usr/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb2/libc.a(lib_a-readr.o): In function `_read_r':
readr.c:(.text+0x16): undefined reference to `_read'
/usr/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb2/libc.a(lib_a-fstatr.o): In function `_fstat_r':
fstatr.c:(.text+0x14): undefined reference to `_fstat'
/usr/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb2/libc.a(lib_a-isattyr.o): In function `_isatty_r':
isattyr.c:(.text+0x12): undefined reference to `_isatty'

However, I have all of them symbols defined in libmisc.a, and I've confirmed that by checking the output of arm-none-eabi-nm and objdump. I have no idea what is causing this issue and I'm not sure how to approach this, any help or suggestions on what to do would be appreciated. Thanks. 

Outcomes