Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: stack, srt0.S and *.ld files in WinARM

2006-03-02 by rtstofer

--- In lpc2000@yahoogroups.com, Grzegorz Reszka <grzegorz.reszka@...>
wrote:
>
> Hello,
>   I`m newbie in ARM uC and I wanted to write in WinARM a simple 
(transition of LED) programme on LPC2138. But during linking (when I 
use RUN_MODE=ROM_RUN, that means LPC2138-ROM.ld file) it returns 
following error:
>   
>   Linking: LED.elf
>   arm-elf-gcc -mthumb -mcpu=arm7tdmi-s -mthumb-interwork -I.
-gdwarf-2  -DROM_RUN  -Os -Wall -Wcast-align -Wcast-qual -Wimplicit  
-Wpointer-arith -Wswitch -Wredundant-decls -Wreturn-type -Wshadow 
-Wunused -Wa,-adhlns=crt0.lst   -MD -MP -MF .dep/LED.elf.d  crt0.o   
LED.o      --output  LED.elf -nostartfiles -Wl,-Map=LED.map,--cref -lc
 -lm -lc  -lgcc  -lstdc++ -TLPC2138-ROM.ld
>  
c:\winarm\bin\..\lib\gcc\arm-elf\4.0.2\..\..\..\..\arm-elf\bin\ld.exe:
 address 0x600 of LED.elf section .stack is not within region RAM
>   make.exe: *** [LED.elf] Error 1
>   
>   > Process Exit Code: 2
>   > Time Taken: 00:02
>   
>   
>   I don`t understand why it wants to use the 0x600 size stack whilst
the  size of this stack is declared in LPC2138-ROM.ld file as 0x400:
>   STACK_SIZE = 0x400;
>   
>   And when I change in Makefile RUN_MODE to RAM_RUN (LPC2138-RAM.ld
file) I receive following message:
>   
>   Linking: LED.elf
>   arm-elf-gcc -mthumb -mcpu=arm7tdmi-s -mthumb-interwork -I.
-gdwarf-2  -DRAM_RUN  -Os -Wall -Wcast-align -Wcast-qual -Wimplicit  
-Wpointer-arith -Wswitch -Wredundant-decls -Wreturn-type -Wshadow 
-Wunused -Wa,-adhlns=crt0.lst   -MD -MP -MF .dep/LED.elf.d  crt0.o   
LED.o      --output  LED.elf -nostartfiles -Wl,-Map=LED.map,--cref -lc
 -lm -lc  -lgcc  -lstdc++ -TLPC2138-RAM.ld
>   crt0.o: In function `abort':D:\ARMprogramy\LED/crt0.S:215:
undefined reference to `__bss_start'
>   :D:\ARMprogramy\LED/crt0.S:215: undefined reference to `__bss_end__'
>   :D:\ARMprogramy\LED/crt0.S:215: undefined reference to
`__ctors_start__'
>   :D:\ARMprogramy\LED/crt0.S:215: undefined reference to `__ctors_end__'
>   make: *** [LED.elf] Error 1
>   
>   And also I don`t understand it - in line 215 of crt0.S is only this:
>       b      .                          // loop until reset
>   and it returns error about undefined refrence to: `__bss_start` ,
`__bss_end__' , etc.
>   
>   What should I do in this case? What should I change in my files
which I attached to this message?
>   
>   More over: Could somebody explain me for what str0.S, RAM.ld and
ROM.ld  files are needed exactly in ARM projects? Which parts of these
files  are important?  When should I use RAM.ld and when ROM.ld files?
By  the way could somebody give me those files which will be suitable
for  LPC2138 uC?
>   
>   Thanks for every advice and response.
>   
>   Regards
>   GR
>   
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 
> [Non-text portions of this message have been removed]
>

Well, I can make a start on the problem.  Others will have more insight.

First of all, you use the ROM version of the linker script (that's
what the .ld file is) when you want to run out of flash memory.  You
use the RAM version when you want to run out of RAM.  You might want
to run out of RAM during debugging.  Or not...

Second, both of your .ld files are hosed, or so it seems.  Where did
you get them?

Third, this tutorial is the absolute best reference available for
starting with the ARM.  Later in the document there is some info for
the 2138, I believe.  Anyway, here it is:
http://www.olimex.com/dev/pdf/ARM%20Cross%20Development%20with%20Eclipse%20version%203.pdf

Here it is tiny: http://tinyurl.com/camje

You could pick a configuration and post your .ld file.  Someone may be
able to spot the problem quickly.

You can also wander over to www.olimex.com and paw through the LPC
2000 ARM boards.  There are blinking LED samples for each.

Richard

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.