having strange problems linking demo app for FreeRTOS.

OP #1171798
Rate this post
• ▲ 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!
Guest #1171799
Rate this post
• ▲ 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_projects/index_at91.html#at91_FreeRTOS1

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
OP #1171800
Rate this post
• ▲ 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_projects/index_at91.html#at91_FreeRTOS1
>
> 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

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.