2014-04-17 01:50 PM
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.aThe 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. #stm32f22014-04-17 01:59 PM
Yes, so you haven't provided the required SYSCALL/NEWLIB support
2014-04-17 03:18 PM
Hi Clive,
Thank you for your response, but I'm not sure what you mean? In the static library libmisc.a I compiled newlib_stubs.c, which seems to be very similar to the file that you provided from the thread that you linked to. I have pasted the contents of my file Is this what you are talking about? Beyond the newlib_stubs.c file, I don't see anything that seems to be relevant to newlib/syscall.2014-04-17 04:21 PM
Except my example links.
Your command line seems a bit tortured, two output files? Libraries without -l Why don't you try just specifying the newlib_stubs as an object, on it's own, and not in a library, or let the compiler build it and link it from the source.