Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training


lwIP Demo port to GCC: undefined references

Posted by Nobody/Anonymous on October 13, 2005
I tried to 'port' the FreeRTOS AT91SAM7X lwIP_Demo_Rowley_ARM7 Demo to
plain GCC/Make compileable with the gnuarm toolchain.
everything seems to compile fine, but the final linking shows errors (undefined references):
* in function `bss_error_loop' (in crt0.s):
`__stack_und_end__' , `__stack_abt_end__' , `__stack_irq_end__' , `__stack_fiq_end__' ,
`__stack_svc_end__' , `__stack_end__' , `__data_load_start__' , `__data_start__' ,
`__data_end__' , `__text_load_start__' , `__text_start__' , `__text_end__' , `__fast_load_start__' ,
`__fast_start__' , `__fast_end__' , `__heap_start__' , `__heap_end__' , `__ctors_start__' ,
`__ctors_end__' , `__dtors_start__' , `__dtors_end__'
* in function `slipif_output':
* in function `slipif_input':
* in function `slipif_init':

what do i need to do so as to resolve those references?

for more detail information, the compiler logs and the Makefile needed to reproduce the error, go to:

thanks and regards,

RE: lwIP Demo port to GCC: undefined references

Posted by Richard on October 14, 2005
As before - thanks for the info.

RE: lwIP Demo port to GCC: undefined references

Posted by Nobody/Anonymous on October 14, 2005
The undefined references look like a missmatch between the linker script and the startup code. Try using the linker script and startup code from the download.

RE: lwIP Demo port to GCC: undefined referenc

Posted by Nobody/Anonymous on October 14, 2005
thanks for the pointer to the ld script. (it's the first time i use gcc for an embedded project, so i never used these ld scripts)

i didn't find any ld script for the AT91SAM7 (or even SAM7X) in the download though. where can i find it?
(i did find ld scripts for other devices though, such as Demo/ARM7_AT91FR40008_GCC/atmel-ram.ld and Demo/ARM7_LPC2106_GCC/lpc2106-rom.ld, but i guess they don't work with the AT91SAM7X, do they?)

RE: lwIP Demo port to GCC: undefined referenc

Posted by Nobody/Anonymous on October 14, 2005
If you use the load scripts you mention in your post, then just modify the RAM/ROM start addresses and sizes within the scripts I think you should find it works.

Make sure you are using the startup code from the FreeRTOS download, it is important to ensure you call main() from Supervisor mode.

Here is a post from Scott Miller that might help:

"Here's my own SAM7S GCC project. It's FreeRTOS with its demo application,
set up as a Kdevelop project. This includes the gnuarm toolchain and
FreeRTOS, so it's a big download. It's missing serial and USB support
because I haven't rewritten the ISRs yet.


Startup code: error when assembling

Posted by Nobody/Anonymous on October 14, 2005
thank you for reminding me about the startup code, i had indeed forgotten to add a target for AT91SAM7_Startup.s.

I tried to assemble (compile) that one now and had the following error:
Error: constant expression expected -- `ldr r0,=(50<<MC_FMR_FMCN_BIT_OFFSET)|MC_FMR_FWS_1FWS'
and the same kind of error for the lines 112, 121 and 130, i.e. in every line of the type
ldr r0,=(some_expression_calculating_together_constants)
whereas all lines of this type make no problem:
ldr r0,=constant
obviously my gnu-arm-as (or gnu-arm-cc) don't want to accept expressions calculated from constants as constants.
the command was:
arm-elf-as AT91SAM7_Startup.s -o AT91SAM7_Startup.o

what do i have to do to make as eat that one without errors?

thanks and best regards,

RE: lwIP Demo port to GCC: undefined referenc

Posted by Nobody/Anonymous on October 14, 2005
about the linker ld scripts, i now tried to do as you suggest. indeed, it does take away some undefined references (exactly those that are defined in the ld script: __bss_start__ and __bss_end__ ) but not the others.
i also tried with the ld script from Scott Miller's example project and with ld scipts i adapted from atmel ld scripts for the SAM7S64 i found in another example on the net.
the result is the same (cause they define pretty much the same minimum set of references)
there's a couple references required by crt0.s, for example initial stack pointers for every mode.
a grep (string search) reveals that they are obviously obtained from the file flash_placement.xml by the rowley system (one foo_start and foo_end reference for each "ProgramSection" in that file. that xml file looks quite readable, still i'm not sure how that would translate into ld script language.
any idea on that one?
are all those different stack pointers even necessary?

thanks and regards,

RE: lwIP Demo port to GCC: undefined references

Posted by Richard on October 16, 2005
I have just tired putting together a linker script, startup file and very simple makefile. They can be found here:


Placing these files in the demo/lwIP_Demo_Rowley_ARM7, then simply 'making' I am able to get a successful build.


1) I am a long way away from my hardware at present so cannot test these files. All I know is that they build.

2) Check the linker script for you particular configuration.

3) These files do not perform any peripheral configuration such as PLL setup, turn of watchdog, etc. See the AT91SAM7_Startup.s for an example of what is needed (this is the file used by the Rowley demo, so is in the same directory already). Alternatively see the file startup code provided by Atmel.

4) For a clean build, just 'touch' the makefile.

These files are adapted from the Demo/ARM7_AT91FR40008_GCC demo project.


RE: lwIP Demo port to GCC: undefined referenc

Posted by Nobody/Anonymous on October 16, 2005
thanks a lot,

this does build here (under linux) as well.

(there's just a minor letter case thing in the Makefile:
i had to change lines 46, 50,51 so as to have "../Common" instead of "../common" and "../Source" instead of "../source", so as to match the actual directory names)

the linker script looks fine. actually it's not really so different from what i used here. what DOES make THE difference is the boot.s you added that (unlike the crt0.s from the rowley-based lwIP-demo) doesn't need all those references that aren't in the linker script file.

unfortunately, i can't test it on actual hardware either right now since i still haven't received my SAM7X256-EK Dev Kit. I hope to get it next week (but they don't know for sure). As soon as i have it, i'll continue in that direction and give you a feed-back. on the test. Unfortunately, network stuff is (i guess) nothing i could soft-simulate until then. For now i feel quite relieved (i was so afraid that there could be some major problem speaking against the MCU/RTOS/Tools choice and am happy to see that it builds).

about the startup code: i was not able to compile that (i posted the errors in an earlier message in this thread) but that's just constant fumbling stuff, at worst i'll redefine a couple constants so as to avoid any constant calculation in the second arg to ldr and it should go through.

thanks again


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]

Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists