FreeRTOS error on uIP_Process() function

murnesty wrote on Wednesday, March 27, 2013:

I’m using:
- FreeRTOS v7.4.0
- NXP LPC2368 MCU
- Red Suite 4
- Demo files : ARM7_LPC2368_Eclipse

I failed to open and build the demo project directly so I built a new project and copy all the files needed. The project I created is able to run 3-4 tasks(LED blink & uart) and I’m trying to do uIP now. So I copy all the files needed according to the makefile in demo project. I’m able to build the project after copy all the needed file over.

Here is the problem. When I try to add a new task for uIP. It states show error:
“make: ***  Error1”
From the console:

Building target: RTOS Sample3.axf
Invoking: MCU Linker
arm-none-eabi-gcc -nostdlib -Xlinker -Map=“RTOS Sample3.map” -Xlinker -gc-sections -mcpu=arm7tdmi -T “RTOS_Sample3_Debug.ld” -o"RTOS Sample3.axf"  ./src/webserver/EMAC_ISR.o ./src/webserver/emac.o ./src/webserver/http-strings.o ./src/webserver/httpd-cgi.o ./src/webserver/httpd-fs.o ./src/webserver/httpd.o ./src/webserver/uIP_Task.o  ./src/cr_startup_lpc23.o ./src/croutine.o ./src/heap_2.o ./src/list.o ./src/main.o ./src/queue.o ./src/tasks.o ./src/timers.o  ./src/portable/port.o ./src/portable/portISR.o  ./src/peripherals/buzzer.o ./src/peripherals/ledBlink.o ./src/peripherals/pll.o ./src/peripherals/taskList.o ./src/peripherals/uart.o  ./src/Common/psock.o ./src/Common/timer.o ./src/Common/uip.o ./src/Common/uip_arp.o  
c:/code_red/redsuitenxp_4.0.6_249/redsuite/tools/bin/…/lib/gcc/arm-none-eabi/4.5.1/…/…/…/…/arm-none-eabi/lib\libcr_c.a(_deferredlazyseek.o): In function `__flsbuf’:
_deferredlazyseek.c:(.text.(float, long, short, bool, float __restrict)+0xcc): undefined reference to `__sys_istty’
c:/code_red/redsuitenxp_4.0.6_249/redsuite/tools/bin/…/lib/gcc/arm-none-eabi/4.5.1/…/…/…/…/arm-none-eabi/lib\libcr_c.a(_writebuf.o): In function `_Cwritebuf’:
_writebuf.c:(.text._Cwritebuf+0x24): undefined reference to `__sys_flen’
_writebuf.c:(.text._Cwritebuf+0x48): undefined reference to `__sys_seek’
_writebuf.c:(.text._Cwritebuf+0x6c): undefined reference to `__sys_write’
c:/code_red/redsuitenxp_4.0.6_249/redsuite/tools/bin/…/lib/gcc/arm-none-eabi/4.5.1/…/…/…/…/arm-none-eabi/lib\libcr_c.a(alloc.o): In function `malloc’:
alloc.c:(.text.malloc+0xbc): undefined reference to `_sbrk’
alloc.c:(.text.malloc+0xec): undefined reference to `_sbrk’
c:/code_red/redsuitenxp_4.0.6_249/redsuite/tools/bin/…/lib/gcc/arm-none-eabi/4.5.1/…/…/…/…/arm-none-eabi/lib\libcr_c.a(alloc.o): In function `_Csys_alloc’:
alloc.c:(.text._Csys_alloc+0x18): undefined reference to `__sys_write’
alloc.c:(.text._Csys_alloc+0x1c): undefined reference to `__sys_appexit’
c:/code_red/redsuitenxp_4.0.6_249/redsuite/tools/bin/…/lib/gcc/arm-none-eabi/4.5.1/…/…/…/…/arm-none-eabi/lib\libcr_c.a(fseek.o): In function `fseek’:
fseek.c:(.text.fseek+0x2c): undefined reference to `__sys_istty’
fseek.c:(.text.fseek+0x68): undefined reference to `__sys_flen’
collect2: ld returned 1 exit status
make: ***  Error 1

I know the error lie on uip_process(u8_t flag) because it is able to compile if I comment out the whole content in this function. But this function has around 1200 lines. I don’t know how to verify what problem it is.

davedoors wrote on Wednesday, March 27, 2013:

This looks like something in the uIP code is calling a C library function, and the C library function has dependencies that are not provided by your C libraries.

If you are using Newlib then there are several functions that need porting to your environment, but they can be just stubbed out if they are not actually used.

Have you tried building without the -nostdlib option you currently have on the command line?

murnesty wrote on Thursday, March 28, 2013:

I’m using Redlib and I tried Newlib but have the same error. I tried also without -nostdlib for both Redlib and Newlib but still error.

rtel wrote on Thursday, March 28, 2013:

From the errors it looks like you have also included file that are not provided in the FreeRTOS download, probably file system related judging by their names (fseek, etc.), and that the files have system dependencies that your build is not providing so it will not link.

I don’t think this is FreeRTOS related, just build related.

Regards.

murnesty wrote on Friday, March 29, 2013:

Found the problem, http://support.code-red-tech.com/CodeRedWiki/UndefinedReference. It is linker C library selection problem. The default is Redlib (none) but have to select Redlib (nohost) or Redlib (semihost). It compiles and link successfully with Redlib (nohost).