[U-Boot-Users] [PPC] PLEASE READ - was: [PATCH] Fix linker scripts: add NOLOAD atribute to .bss/.sbss sections

Joakim Tjernlund joakim.tjernlund at transmode.se
Wed Feb 6 10:59:15 CET 2008


On Mon, 2008-02-04 at 20:14 +0100, Wolfgang Denk wrote:
> In message <20080204165640.GC19264 at ld0162-tx32.am.freescale.net> you wrote:
> > On Mon, Feb 04, 2008 at 12:32:36AM +0100, Wolfgang Denk wrote:
> > > So far, it is not clear to me what  a  better  choice  for  a  global
> > > register variable could be (i. e. which register we can chose for our
> > > purpose without causing the same or other problems.
> > 
> > r2 is generally used for this purpose.
> 
> Hm... R2 is documented to be the TOC pointer?
> 
> It seems we could use R15, but I hesitate a bit...

I think the register approach is needed if we ever want to
make u-boot fully relocateable.

There are a few global data accesses that needs to be fixed 
before that can happen though. There should not be any global data
accesses before relocate_code has done its thing. One of the
first things that happens in board_init_f is:
for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
	if ((*init_fnc_ptr) () != 0) {
		hang ();
	}
}
init_sequence is a global variable.

Is this table really needed? Why not move it inside board_init_f and
save some bytes?

The next is access is env_get_char, this probably needs to move into GD.

I figured global data accesses wasn't allowed(other than GD) at all
before relocate_code()?

 Jocke




More information about the U-Boot mailing list