EmbDev.net

Forum: ARM programming with GCC/GNU tools having strange problems linking demo app for FreeRTOS.


Author: Andrey Ivolgin (andy-spb)
Posted on:

Rate this post
0 useful
not useful
Hello, ALL!

I'm trying to build Rowley lwIP example which comes with FreeRTOS 4.0.4
using WinARM-20060606 (arm-elf-gcc 4.1.1) for AT91SAM7X-EK. It was told
that this demo can be (and I read this as should be) built by command
line gcc, so I just type 'make' and at last receive the following
output:


arm-elf-gcc -I. -I./EMAC -I../Common/include -I./USB
-I./lwip-1.1.0/src/include
-I./lwip-1.1.0/contrib/port/FreeRTOS/AT91SAM7X -I../../Source/include
-I../../So
urce/portable/GCC/ARM7_AT91SAM7S -I./lwip-1.1.0/src/include/ipv4 -Wall
-Wextra -
Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
-Wno-strict-alias
ing -D SAM7_GCC -D THUMB_INTERWORK -mthumb-interwork -mcpu=arm7tdmi
-Tatmel-rom.
ld -g -O0 ../../Source/portable/GCC/ARM7_AT91SAM7S/portISR.o
EMAC/SAM7_EMAC_ISR.
o USB/USBIsr.o Cstartup_SAM7.o   ../../Source/portable/MemMang/heap_2.o
ParTest/
ParTest.o main.o ../Common/Minimal/flash.o ../Common/Minimal/BlockQ.o
../Common/
Minimal/integer.o ../Common/Minimal/PollQ.o ../Common/Minimal/semtest.o
BasicWEB
.o USB/USB-CDC.o  lwip-1.1.0/src/core/tcp_out.o
lwip-1.1.0/src/core/inet.o lwip-
1.1.0/src/core/mem.o lwip-1.1.0/src/core/memp.o
lwip-1.1.0/src/core/netif.o lwip
-1.1.0/src/core/pbuf.o lwip-1.1.0/src/core/raw.o
lwip-1.1.0/src/core/stats.o lwi
p-1.1.0/src/core/sys.o lwip-1.1.0/src/core/tcp.o
lwip-1.1.0/src/core/tcp_in.o lw
ip-1.1.0/src/core/ipv4/ip.o lwip-1.1.0/src/core/ipv4/ip_addr.o
lwip-1.1.0/src/co
re/ipv4/icmp.o lwip-1.1.0/src/api/tcpip.o lwip-1.1.0/src/api/api_msg.o
lwip-1.1.
0/src/api/err.o lwip-1.1.0/src/api/api_lib.o
lwip-1.1.0/src/netif/etharp.o lwip-
1.1.0/contrib/port/FreeRTOS/AT91SAM7X/sys_arch.o
lwip-1.1.0/src/netif/ethernetif
.o EMAC/SAM7_EMAC.o lwip-1.1.0/src/core/udp.o
lwip-1.1.0/src/core/ipv4/ip_frag.o
 ../../Source/tasks.o ../../Source/queue.o ../../Source/list.o
../../Source/port
able/GCC/ARM7_AT91SAM7S/port.o -nostartfiles boot.s -Xlinker
-ortosdemo.elf -Xli
nker -M -Xlinker -Map=rtosdemo.map
c:/winarm/bin/../lib/gcc/arm-elf/4.1.1/../../../../arm-elf/lib/interwork 
\libg.a(
freer.o): In function `_malloc_trim_r':
mallocr.c:(.text+0x48): undefined reference to `_sbrk_r'
mallocr.c:(.text+0x64): undefined reference to `_sbrk_r'
mallocr.c:(.text+0x84): undefined reference to `_sbrk_r'
c:/winarm/bin/../lib/gcc/arm-elf/4.1.1/../../../../arm-elf/lib/interwork 
\libg.a(
makebuf.o): In function `__smakebuf':
makebuf.c:(.text+0x3c): undefined reference to `_fstat_r'
makebuf.c:(.text+0x110): undefined reference to `isatty'
c:/winarm/bin/../lib/gcc/arm-elf/4.1.1/../../../../arm-elf/lib/interwork 
\libg.a(
mallocr.o): In function `_malloc_r':
mallocr.c:(.text+0x40c): undefined reference to `_sbrk_r'
mallocr.c:(.text+0x4b4): undefined reference to `_sbrk_r'
c:/winarm/bin/../lib/gcc/arm-elf/4.1.1/../../../../arm-elf/lib/interwork 
\libg.a(
stdio.o): In function `__sclose':
stdio.c:(.text+0x10): undefined reference to `_close_r'
c:/winarm/bin/../lib/gcc/arm-elf/4.1.1/../../../../arm-elf/lib/interwork 
\libg.a(
stdio.o): In function `__sseek':
stdio.c:(.text+0x3c): undefined reference to `_lseek_r'
c:/winarm/bin/../lib/gcc/arm-elf/4.1.1/../../../../arm-elf/lib/interwork 
\libg.a(
stdio.o): In function `__swrite':
stdio.c:(.text+0x94): undefined reference to `_lseek_r'
stdio.c:(.text+0xb8): undefined reference to `_write_r'
c:/winarm/bin/../lib/gcc/arm-elf/4.1.1/../../../../arm-elf/lib/interwork 
\libg.a(
stdio.o): In function `__sread':
stdio.c:(.text+0xe4): undefined reference to `_read_r'
collect2: ld returned 1 exit status
make: *** [rtosdemo.elf] Error 1



It seems that newlib in this package of WinARM does not include
reentrance versions for thumb mode of sbrk(), close(), lseek() and so
on. I tried to find them out but without success.

Any suggestions?
Huge thanks in advance!

Author: Martin Thomas (Guest)
Posted on:

Rate this post
0 useful
not useful
Andrey Ivolgin wrote:

> It seems that newlib in this package of WinARM does not include
> reentrance versions for thumb mode of sbrk(), close(), lseek() and so
> on. I tried to find them out but without success.

Yes, the newlib in WinARM 6/06 has been configured with
"--disable-newlib-supplied-syscalls" and compiled with a defined
"REENTRANT_SYSCALLS_PROVIDED".
Since the "missing sbrk" is the most FAQ asked by e-mail and in this
forum I will try to enabled some "default" syscalls (non-reentrant and
reentrant) in a future version of the binary-collection (if it does not
break compatibilty to existing code).

But providing your own syscalls implementation is not difficult: For now
you may just add the syscalls.c from another AT91-project. For example
from Darrik Spaude's SAM7S256 FreeRTOS example. Available from
http://www.siwawi.arubi.uni-kl.de/avr_projects/arm...

Further information can be found by searching this forum and reading the
newlib's source-code (some files included in WinARM's
utils/useful_from_newlib_src-Directory) and the source-files of
newlib-lpc (see utils/newlib_lpc_rel5a_src/-Directory)

Hope this helps
Martin Thomas

Author: Andrey Ivolgin (andy-spb)
Posted on:

Rate this post
0 useful
not useful
Martin Thomas wrote:
> Andrey Ivolgin wrote:
>
>> It seems that newlib in this package of WinARM does not include
>> reentrance versions for thumb mode of sbrk(), close(), lseek() and so
>> on. I tried to find them out but without success.
>
> Yes, the newlib in WinARM 6/06 has been configured with
> "--disable-newlib-supplied-syscalls" and compiled with a defined
> "REENTRANT_SYSCALLS_PROVIDED".
> Since the "missing sbrk" is the most FAQ asked by e-mail and in this
> forum I will try to enabled some "default" syscalls (non-reentrant and
> reentrant) in a future version of the binary-collection (if it does not
> break compatibilty to existing code).
>
> But providing your own syscalls implementation is not difficult: For now
> you may just add the syscalls.c from another AT91-project. For example
> from Darrik Spaude's SAM7S256 FreeRTOS example. Available from
> 
http://www.siwawi.arubi.uni-kl.de/avr_projects/arm...
>
> Further information can be found by searching this forum and reading the
> newlib's source-code (some files included in WinARM's
> utils/useful_from_newlib_src-Directory) and the source-files of
> newlib-lpc (see utils/newlib_lpc_rel5a_src/-Directory)
>



Martin,

Thanks for your reply. I've already taken a quick look at those examples
and havent found them quite helpful. Will have a deeper look and try
your recommendations. Unfortunately I will be out for a couple of days,
so if it wont be a question for you I will be back for discussion in the
near future.

Andrey.


PS. I have choosen FreeRTOS and WinARM for my project as I was quite
satisfied by WinAVR before and actually dont like commercial tools. Hope
that the issue will not affect my choice :)

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.