GCC toolchain compling errors
Company  
ST Home | Microcontrollers

Index  »  ARM Cortex-M3 STM32  »  GCC toolchain compling errors
     
   GCC toolchain compling errors
 Moderated by :   »  STOne-32

Author
beginning argument    ( Replies received: 2 )
xzhang   Posted 31-10-2008 at 23:37   



Registered on :
10-31-2010

Messages : 2

 OFF-Line

Hi

I am using CodeSoucery G++ tool chain for my STM32 project. I setup my GCC environment by following this website:
http://sites.google.com/a/stf12.net/developer-sw-fw/eclipse-demo

When I tried to build my project, I got below error messages:

c:/program files/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-eabi/4.3.2/../../../../arm-none-eabi/lib/thumb2\libc.a(lib_a-sbrkr.o): In function `_sbrk_r':
sbrkr.c:(.text+0x12): undefined reference to `_sbrk'
c:/program files/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-eabi/4.3.2/../../../../arm-none-eabi/lib/thumb2\libc.a(lib_a-writer.o): In function `_write_r':
writer.c:(.text+0x16): undefined reference to `_write'
c:/program files/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-eabi/4.3.2/../../../../arm-none-eabi/lib/thumb2\libc.a(lib_a-closer.o): In function `_close_r':
closer.c:(.text+0x12): undefined reference to `_close'
c:/program files/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-eabi/4.3.2/../../../../arm-none-eabi/lib/thumb2\libc.a(lib_a-fstatr.o): In function `_fstat_r':
fstatr.c:(.text+0x14): undefined reference to `_fstat'
c:/program files/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-eabi/4.3.2/../../../../arm-none-eabi/lib/thumb2\libc.a(lib_a-isattyr.o): In function `_isatty_r':
isattyr.c:(.text+0x12): undefined reference to `_isatty'
c:/program files/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-eabi/4.3.2/../../../../arm-none-eabi/lib/thumb2\libc.a(lib_a-lseekr.o): In function `_lseek_r':
lseekr.c:(.text+0x16): undefined reference to `_lseek'
c:/program files/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-eabi/4.3.2/../../../../arm-none-eabi/lib/thumb2\libc.a(lib_a-readr.o): In function `_read_r':
readr.c:(.text+0x16): undefined reference to `_read'
collect2: ld returned 1 exit status
cs-make: *** [IOM_ACQ.elf] Error 1

I spend some effort to figure out those errors caused by sprintf() in my code. But I don't know why I can't call c library?

I searched some arm forum about this topic, some people mentioned about syscalls.c. Does anybody know this issue? If it does need a syscalls.c, does anybody can give a sample code?




 Profile   Quote  
disirio   Posted 02-11-2008 at 08:10   



Registered on :
06-11-2010

Messages : 36

 OFF-Line

Hello,

you are working with a barebone machine so the newlib needs some minimal support in order to allocate memory and perform I/O tasks.

You should provide replacement for some syscalls normally provided by the OS, read this article:

sourceware.org/newlib/libc.html#SEC196

Most functions are just stubs, the sbrk() should be implemented in order to make the allocator work (probably the sprintf() allocates memory internally).

regards,
Giovanni
---
ChibiOS/RT chibios.sourceforge.net



 Profile   Quote  
xzhang   Posted 04-11-2008 at 04:58   



Registered on :
10-31-2010

Messages : 2

 OFF-Line

Hi Giovanni

Thanks for help. the link you provided clarifies systemcall functionality. Since I am more familiar with hardware stuff other than software, this document is good for me.

I have solved the problem to use GCC library in my project. I found this link provided good details about how to write syscalls.c and how to define 'end' in link script:
http://forum.sparkfun.com/viewtopic.php?t=5390&start=15

Now my code has been complied without errors!


Regards,
JZ



 Profile   Quote  
On Top

Search in the forums
 
Jump To