Problems with compiling lwIP_Demo_Rowley_ARM7

nobody wrote on Wednesday, July 05, 2006:

Hi,
I’m going to use FreeRTOS on AT91SAM7X256 ARM uC. I’ve downloaded FreeRTOS v4.0.4 and tried to compile Demo code with WinARM-2006.06.06 (on Windows XP machine) by simply entering the directory and typing “make”. But my compilation fails (probably on linker stage?) with following errors:

f:/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’
f:/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’
f:/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’
f:/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’
f:/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’
f:/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’
f:/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

Can anyone tell me what can I do to solve this problem? It looks like it this could be the problem of WinARM libraries, not the FreeRTOS code, but I’m not sure (earlier i’ve only written software in assembler and simple C programs for AVR).

nobody wrote on Thursday, July 06, 2006:

A few people have mentioned problems with WinARM.  I would suggest going to http://www.gnuarm.org and downloading the distribution from there.  You will then find that the FreeRTOS code compiles straight off with no modifications.

dmwilliams66 wrote on Friday, July 14, 2006:

These are references brought in by one of the libraries.

I have them stubbed out in my build with a file containing.  Then all is well.

#include <reent.h>

void *_sbrk_r (struct _reent *r, ptrdiff_t t ) { return 0; }
int _open_r (struct _reent *r, const char *buf, int flags, int mode) { return -1; }
int isatty( int fd ) { return -1; }
_off_t _lseek_r ( struct _reent *ptr, int fd, _off_t offset, int whence ) { return -1; }
_ssize_t _write_r (struct _reent *r, int fd, const void *buf, size_t nbytes) { return -1; }
int _close_r (struct _reent *r, int fd) { return -1; }
_ssize_t _read_r (struct _reent *r, int fd, void *buf, size_t nbytes) { return -1; }
int _fstat_r (struct _reent *r, int fd, struct stat *buf) { return -1; }