"Usage of <iostream> in "GCC C++ Executable&

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

When the project (in ATMEL Studio 6) is created as "GCC C++ Executable" project, it does not have extensive support for includes. I was able to observe errors mentioning "Undefined reference to _exit()" which is a function part of the library. Similarly other errors were also displayed.

Error was not present when the project was created as "GCC C++ Static Library" project. These errors were also part of the earlier shared project files.

Complete error list in a blank project when is included

"C:\Program Files\Atmel\Atmel Studio 6.0\extensions\Atmel\ARMGCC\3.3.1.128\ARMGCCToolchain\bin\arm-none-eabi-g++.exe" -o GccApplication1.elf cmsis/src/startup_sam4e.o cmsis/src/system_sam4e.o GccApplication1.o -Wl,-Map="GccApplication1.map" -Wl,--start-group -lm -Wl,--end-group -L"../cmsis/linkerScripts" -Wl,--gc-sections -Tsam4e16e_flash.ld -mcpu=cortex-m4
c:/program files/atmel/atmel studio 6.0/extensions/atmel/armgcc/3.3.1.128/armgcctoolchain/bin/../lib/gcc/arm-none-eabi/4.7.0/../../../../arm-none-eabi/lib/thumb\libc.a(lib_a-abort.o): In function `abort':
/usr/local/avr32studio/hudson/workspace/arm-gnu-toolchain/.build/src/newlib-1.19.0/newlib/libc/stdlib/abort.c(63,1): undefined reference to `_exit'
c:/program files/atmel/atmel studio 6.0/extensions/atmel/armgcc/3.3.1.128/armgcctoolchain/bin/../lib/gcc/arm-none-eabi/4.7.0/../../../../arm-none-eabi/lib/thumb\libc.a(lib_a-fstatr.o): In function `_fstat_r':
/usr/local/avr32studio/hudson/workspace/arm-gnu-toolchain/.build/src/newlib-1.19.0/newlib/libc/reent/fstatr.c(62,1): undefined reference to `_fstat'
c:/program files/atmel/atmel studio 6.0/extensions/atmel/armgcc/3.3.1.128/armgcctoolchain/bin/../lib/gcc/arm-none-eabi/4.7.0/../../../../arm-none-eabi/lib/thumb\libc.a(lib_a-openr.o): In function `_open_r':
/usr/local/avr32studio/hudson/workspace/arm-gnu-toolchain/.build/src/newlib-1.19.0/newlib/libc/reent/openr.c(59,1): undefined reference to `_open'
c:/program files/atmel/atmel studio 6.0/extensions/atmel/armgcc/3.3.1.128/armgcctoolchain/bin/../lib/gcc/arm-none-eabi/4.7.0/../../../../arm-none-eabi/lib/thumb\libc.a(lib_a-sbrkr.o): In function `_sbrk_r':
/usr/local/avr32studio/hudson/workspace/arm-gnu-toolchain/.build/src/newlib-1.19.0/newlib/libc/reent/sbrkr.c(60,1): undefined reference to `_sbrk'
c:/program files/atmel/atmel studio 6.0/extensions/atmel/armgcc/3.3.1.128/armgcctoolchain/bin/../lib/gcc/arm-none-eabi/4.7.0/../../../../arm-none-eabi/lib/thumb\libc.a(lib_a-signalr.o): In function `_kill_r':
/usr/local/avr32studio/hudson/workspace/arm-gnu-toolchain/.build/src/newlib-1.19.0/newlib/libc/reent/signalr.c(61,1): undefined reference to `_kill'
c:/program files/atmel/atmel studio 6.0/extensions/atmel/armgcc/3.3.1.128/armgcctoolchain/bin/../lib/gcc/arm-none-eabi/4.7.0/../../../../arm-none-eabi/lib/thumb\libc.a(lib_a-signalr.o): In function `_getpid_r':
/usr/local/avr32studio/hudson/workspace/arm-gnu-toolchain/.build/src/newlib-1.19.0/newlib/libc/reent/signalr.c(96,1): undefined reference to `_getpid'
c:/program files/atmel/atmel studio 6.0/extensions/atmel/armgcc/3.3.1.128/armgcctoolchain/bin/../lib/gcc/arm-none-eabi/4.7.0/../../../../arm-none-eabi/lib/thumb\libc.a(lib_a-writer.o): In function `_write_r':
/usr/local/avr32studio/hudson/workspace/arm-gnu-toolchain/.build/src/newlib-1.19.0/newlib/libc/reent/writer.c(58,1): undefined reference to `_write'
c:/program files/atmel/atmel studio 6.0/extensions/atmel/armgcc/3.3.1.128/armgcctoolchain/bin/../lib/gcc/arm-none-eabi/4.7.0/../../../../arm-none-eabi/lib/thumb\libc.a(lib_a-closer.o): In function `_close_r':
/usr/local/avr32studio/hudson/workspace/arm-gnu-toolchain/.build/src/newlib-1.19.0/newlib/libc/reent/closer.c(53,1): undefined reference to `_close'
c:/program files/atmel/atmel studio 6.0/extensions/atmel/armgcc/3.3.1.128/armgcctoolchain/bin/../lib/gcc/arm-none-eabi/4.7.0/../../../../arm-none-eabi/lib/thumb\libc.a(lib_a-isattyr.o): In function `_isatty_r':
/usr/local/avr32studio/hudson/workspace/arm-gnu-toolchain/.build/src/newlib-1.19.0/newlib/libc/reent/isattyr.c(58,1): undefined reference to `_isatty'
c:/program files/atmel/atmel studio 6.0/extensions/atmel/armgcc/3.3.1.128/armgcctoolchain/bin/../lib/gcc/arm-none-eabi/4.7.0/../../../../arm-none-eabi/lib/thumb\libc.a(lib_a-lseekr.o): In function `_lseek_r':
/usr/local/avr32studio/hudson/workspace/arm-gnu-toolchain/.build/src/newlib-1.19.0/newlib/libc/reent/lseekr.c(58,1): undefined reference to `_lseek'
c:/program files/atmel/atmel studio 6.0/extensions/atmel/armgcc/3.3.1.128/armgcctoolchain/bin/../lib/gcc/arm-none-eabi/4.7.0/../../../../arm-none-eabi/lib/thumb\libc.a(lib_a-readr.o): In function `_read_r':
/usr/local/avr32studio/hudson/workspace/arm-gnu-toolchain/.build/src/newlib-1.19.0/newlib/libc/reent/readr.c(58,1): undefined reference to `_read'

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Looks like by default the system call implementations are not defined by arm-gnu-gcc toolchain's libc library. Users have to manually write them if they need it as it may differ from one SAM device to another device(as far as I know :shock:)

A sample newlib.c from redhat is available at
http://sourceware.org/newlib/lib...

Regards,
Deena