[U-Boot-Users] [PATCH] Make MPC83xx one step closer to full relocation.

Joakim Tjernlund joakim.tjernlund at transmode.se
Tue Apr 8 16:04:58 CEST 2008


On Tue, 2008-04-08 at 15:25 +0200, Stefan Roese wrote:
> On Tuesday 08 April 2008, Joakim Tjernlund wrote:
> > > > I first did a new symbol for this but changed it to use _start as  I
> > > > didn't want to introduce yet another symbol. I would hope it is
> > > > possible to rework 4xx to move the _start symbol to were it belongs?
> > > > Not having the _start symbol where it should be could bite you some
> > > > other day too.
> > >
> > > I think you got this wrong. _start *is* where it should be, where the
> > > execution of the code begins. Where you set the breakpoint in gdb.
> >
> > Ah, right. I *assumed* that _start was always the first symbol in the
> > text segment too. On 4xx it isn't for some reason, but it should be
> > possible to move it first.
> >
> > Sidnote: Does execution really begin at _start for 4xx? I still looks
> > like it begin at _start_440 and eventually end up at _start
> 
> On 4xx execution always starts at 0xfffffffc (last lword in 32bit address 
> space). This location holds a jump to _start for 405 PPC's and to _start_440 
> for 440 PPC's. 440 PPC's need some extended initialization (TLB setup etc) 
> and later jump to the 4xx common _start.

OK, then it is like I suspected. What if you rename _start to
_common_start. Make _start equal _common_start for 405 and rename
_start_440 to _start, i.e make sure that _start is defined where you
start executing after the jump.

> 
> > > The "new symbol" you mention corresponds to CFG_MONITOR_BASE, but note
> > > that it has no fixed address as it depends where you place your image
> > > in flash.
> >
> > Yes, but the address is not important here, it is the difference
> > _end - _start. I guess we could define a linker symbol too
> > that calculates _end - _start for us and then just do
> >   len = _uboot_reloc_size + EXC_OFF_SYS_RESET;
> >
> > or define a new symbol that is initialised to CFG_MONITOR_BASE or let
> > the linker place it at the beginning of .text, hopefully there is
> > already a name reserved for the symbol although I don't know of such a
> > name. I either case I think one needs to add that symbol to the GOT list
> > in start.S
> 
> I'm an linker script dyslexic. So no idea if we can handle this solely in the 
> linker script or if we need a new common symbol in the PPC start.S's.

Both ways should be doable I think. A linker script would probably look
something like(pseudo diff below):
 .text      :
  {
+    _monitor_base = . ;
+    PROVIDE (_monitor_base = .);
    cpu/mpc83xx/start.o	(.text)

And then add a
	GOT_ENTRY(_monitor_base)
in start.S




More information about the U-Boot mailing list