Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

link problem.

link problem.

2006-02-17 by Steve Franks

Anyone know what lib's contain the following?  I can't seem to locate
it.  Or, it could be a link ordering problem, I suppose.  I get the
same errors when adding either a call to sprintf or std::stringstream

Thanks,
Steve

C:\WinARM\arm-elf\lib\libc.a(mallocr.o): In function
`_malloc_r':mallocr.c:(.text+0x430): undefined reference to `_sbrk_r'
:mallocr.c:(.text+0x5ec): undefined reference to `_sbrk_r'
C:\WinARM\arm-elf\lib\libc.a(syswrite.o): In function
`write':syswrite.c:(.text+0x24): undefined reference to `_write_r'
C:\WinARM\arm-elf\lib\libc.a(freer.o): In function
`_malloc_trim_r':mallocr.c:(.text+0x48): undefined reference to
`_sbrk_r'
:mallocr.c:(.text+0x70): undefined reference to `_sbrk_r'
:mallocr.c:(.text+0xb4): undefined reference to `_sbrk_r'
C:\WinARM\arm-elf\lib\libc.a(makebuf.o): In function
`__smakebuf':makebuf.c:(.text+0x44): undefined reference to `_fstat_r'
:makebuf.c:(.text+0xe4): undefined reference to `isatty'
C:\WinARM\arm-elf\lib\libc.a(stdio.o): In function
`__sread':stdio.c:(.text+0x1c): undefined reference to `_read_r'
C:\WinARM\arm-elf\lib\libc.a(stdio.o): In function
`__swrite':stdio.c:(.text+0x78): undefined reference to `_lseek_r'
:stdio.c:(.text+0x9c): undefined reference to `_write_r'
C:\WinARM\arm-elf\lib\libc.a(stdio.o): In function
`__sseek':stdio.c:(.text+0xc0): undefined reference to `_lseek_r'
C:\WinARM\arm-elf\lib\libc.a(stdio.o): In function
`__sclose':stdio.c:(.text+0xf8): undefined reference to `_close_r'
make: *** [main.elf] Error 1

Re: [lpc2000] link problem.

2006-02-17 by Bertrik Sikken

Steve Franks wrote:
> Anyone know what lib's contain the following?  I can't seem to locate
> it.  Or, it could be a link ordering problem, I suppose.  I get the
> same errors when adding either a call to sprintf or std::stringstream
> 
> Thanks,
> Steve
> 
> C:\WinARM\arm-elf\lib\libc.a(mallocr.o): In function
> `_malloc_r':mallocr.c:(.text+0x430): undefined reference to `_sbrk_r'
> :mallocr.c:(.text+0x5ec): undefined reference to `_sbrk_r'
> C:\WinARM\arm-elf\lib\libc.a(syswrite.o): In function
> `write':syswrite.c:(.text+0x24): undefined reference to `_write_r'
> C:\WinARM\arm-elf\lib\libc.a(freer.o): In function
> `_malloc_trim_r':mallocr.c:(.text+0x48): undefined reference to
> `_sbrk_r'
> :mallocr.c:(.text+0x70): undefined reference to `_sbrk_r'
> :mallocr.c:(.text+0xb4): undefined reference to `_sbrk_r'
> C:\WinARM\arm-elf\lib\libc.a(makebuf.o): In function
> `__smakebuf':makebuf.c:(.text+0x44): undefined reference to `_fstat_r'
> :makebuf.c:(.text+0xe4): undefined reference to `isatty'
> C:\WinARM\arm-elf\lib\libc.a(stdio.o): In function
> `__sread':stdio.c:(.text+0x1c): undefined reference to `_read_r'
> C:\WinARM\arm-elf\lib\libc.a(stdio.o): In function
> `__swrite':stdio.c:(.text+0x78): undefined reference to `_lseek_r'
> :stdio.c:(.text+0x9c): undefined reference to `_write_r'
> C:\WinARM\arm-elf\lib\libc.a(stdio.o): In function
> `__sseek':stdio.c:(.text+0xc0): undefined reference to `_lseek_r'
> C:\WinARM\arm-elf\lib\libc.a(stdio.o): In function
> `__sclose':stdio.c:(.text+0xf8): undefined reference to `_close_r'
> make: *** [main.elf] Error 1

I think these are references to newlib stubs. They are linked in
because sprintf somehow (directly or indirectly) depends on them.

BTW, if you're looking for a light-weight (s)printf, take a look at this
http://menie.org/georges/embedded/index.html

Bertrik

Re: [lpc2000] link problem.

2006-02-17 by Tom Walsh

Steve Franks wrote:

>Anyone know what lib's contain the following?  I can't seem to locate
>it.  Or, it could be a link ordering problem, I suppose.  I get the
>same errors when adding either a call to sprintf or std::stringstream
>
>Thanks,
>Steve
>
>C:\WinARM\arm-elf\lib\libc.a(mallocr.o): In function
>`_malloc_r':mallocr.c:(.text+0x430): undefined reference to `_sbrk_r'
>:mallocr.c:(.text+0x5ec): undefined reference to `_sbrk_r'
>C:\WinARM\arm-elf\lib\libc.a(syswrite.o): In function
>`write':syswrite.c:(.text+0x24): undefined reference to `_write_r'
>C:\WinARM\arm-elf\lib\libc.a(freer.o): In function
>`_malloc_trim_r':mallocr.c:(.text+0x48): undefined reference to
>`_sbrk_r'
>:mallocr.c:(.text+0x70): undefined reference to `_sbrk_r'
>:mallocr.c:(.text+0xb4): undefined reference to `_sbrk_r'
>C:\WinARM\arm-elf\lib\libc.a(makebuf.o): In function
>`__smakebuf':makebuf.c:(.text+0x44): undefined reference to `_fstat_r'
>:makebuf.c:(.text+0xe4): undefined reference to `isatty'
>C:\WinARM\arm-elf\lib\libc.a(stdio.o): In function
>`__sread':stdio.c:(.text+0x1c): undefined reference to `_read_r'
>C:\WinARM\arm-elf\lib\libc.a(stdio.o): In function
>`__swrite':stdio.c:(.text+0x78): undefined reference to `_lseek_r'
>:stdio.c:(.text+0x9c): undefined reference to `_write_r'
>C:\WinARM\arm-elf\lib\libc.a(stdio.o): In function
>`__sseek':stdio.c:(.text+0xc0): undefined reference to `_lseek_r'
>C:\WinARM\arm-elf\lib\libc.a(stdio.o): In function
>`__sclose':stdio.c:(.text+0xf8): undefined reference to `_close_r'
>make: *** [main.elf] Error 1
>
>  
>

Those are definately newlib stub functions being called.  A stub is a 
hook in newlib that normally doesn't require any external function to be 
linked to it, unless that stub function gets linked into your program.  
Look around for newlib stub examples.  I have a number of those stub 
functions on the rdcf2 DOS filesystem:

http://www.openhardware.net/?title=RDCF2%20DOS%20FAT%20Filesystem%20for%20LPC2138&dir=rdcf2&file=rdcf2lpc2138.html

TomW

-- 
Tom Walsh - WN3L - Embedded Systems Consultant
http://openhardware.net, http://cyberiansoftware.com
"Windows? No thanks, I have work to do..."
----------------------------------------------------

Re: [lpc2000] link problem.

2006-02-17 by Robert Adsett

At 01:46 PM 2/17/06 -0700, Steve Franks wrote:
>Anyone know what lib's contain the following?  I can't seem to locate
>it.  Or, it could be a link ordering problem, I suppose.  I get the
>same errors when adding either a call to sprintf or std::stringstream
>
>Thanks,
>Steve
>
>C:\WinARM\arm-elf\lib\libc.a(mallocr.o): In function
>`_malloc_r':mallocr.c:(.text+0x430): undefined reference to `_sbrk_r'
>:mallocr.c:(.text+0x5ec): undefined reference to `_sbrk_r'

Those are newlib entry points.  They provide the points to customize the 
I/O for particular processors and/or boards.  WinARM is supposed to include 
a copy of newlib-lpc which provides these stubs.  Maybe you just need to 
add it to the link?

If it's not there you can get it from http://www.aeolusdevelopment.com

Robert

" 'Freedom' has no meaning of itself.  There are always restrictions,   be 
they legal, genetic, or physical.  If you don't believe me, try to chew a 
radio signal. "  -- Kelvin Throop, III
http://www.aeolusdevelopment.com/

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.