1

I am trying to compile for ARM Cortex M3, and get this error when building a Hello World program.

Have tried to build using --specs=rdimon.specs, which allows the program to compile, but it is then "Killed" by the target platform.

$ gcc-arm-none-eabi-5_2-2015q4/bin/arm-none-eabi-gcc test.c -o 

test/Users/user/Desktop/gcc-arm-none-eabi-5_2-2015q4/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/lib/libc.a(lib_a-exit.o): In function `exit':
exit.c:(.text.exit+0x2c): undefined reference to `_exit'
/Users/user/Desktop/gcc-arm-none-eabi-5_2-2015q4/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/lib/libc.a(lib_a-sbrkr.o): In function `_sbrk_r':
sbrkr.c:(.text._sbrk_r+0x18): undefined reference to `_sbrk'
/Users/user/Desktop/gcc-arm-none-eabi-5_2-2015q4/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/lib/libc.a(lib_a-writer.o): In function `_write_r':
writer.c:(.text._write_r+0x24): undefined reference to `_write'
/Users/user/Desktop/gcc-arm-none-eabi-5_2-2015q4/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/lib/libc.a(lib_a-closer.o): In function `_close_r':
closer.c:(.text._close_r+0x18): undefined reference to `_close'
/Users/user/Desktop/gcc-arm-none-eabi-5_2-2015q4/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/lib/libc.a(lib_a-lseekr.o): In function `_lseek_r':
lseekr.c:(.text._lseek_r+0x24): undefined reference to `_lseek'
/Users/user/Desktop/gcc-arm-none-eabi-5_2-2015q4/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/lib/libc.a(lib_a-readr.o): In function `_read_r':
readr.c:(.text._read_r+0x24): undefined reference to `_read'
/Users/user/Desktop/gcc-arm-none-eabi-5_2-2015q4/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/lib/libc.a(lib_a-fstatr.o): In function `_fstat_r':
fstatr.c:(.text._fstat_r+0x20): undefined reference to `_fstat'
/Users/user/Desktop/gcc-arm-none-eabi-5_2-2015q4/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/lib/libc.a(lib_a-isattyr.o): In function `_isatty_r':
isattyr.c:(.text._isatty_r+0x18): undefined reference to `_isatty'
collect2: error: ld returned 1 exit status
harry95
  • 11
  • 3
  • Possible duplicate of [Compiling basic C file for the ARM processor](http://stackoverflow.com/questions/9632595/compiling-basic-c-file-for-the-arm-processor) – Notlikethat Mar 11 '16 at 11:56
  • On Cortex M3 the "Hello World" is almost always just a blinking LED. The "printf" function requires much more infrastructure. – Turbo J Mar 11 '16 at 21:04

1 Answers1

1

This error means that the standard functions are not defined. You can try to compile with the -ffreestanding option (see What is ffreestanding option in gcc?).

Community
  • 1
  • 1
Antoine M.
  • 3,631
  • 3
  • 15
  • 20