[U-Boot-Users] Relocating in start.S for MPC5xxx

Jonas Mark-r50740 Mark.Jonas at motorola.com
Mon Sep 22 17:44:45 CEST 2003


I'm trying to add to U-Boot for MPC5xxx is the possibility to start from Boot Low and make it look as if the processor booted from Boot High. The reason is that I want the same image of U-Boot to run from Boot Low as well as from Boot High. What I don't want to do is adapt CFG_SDRAM_BASE and TEXT_BASE. I already tried that and made it work on IceCube by fixing a few things in icecube.c but I didn't like the result (I'll send a patch once I found out how to use SourceForge, move my code from 0.4.8 to the latest on CVS and make a patch).

To make a Boot Low look like a Boot High I need to change CSBoot setup and the IP bit in the MSR. First I move CSBoot Stop to 0xFFF80000, then I change the point of execution from the current of execution 0x0000???? to 0xFFF0???? and then I move CSBoot Start to 0xFFF00000. My problem is that I have no good idea how to implement the jump from the current of execution 0x0000???? to 0xFFF0????. What I tried is

	lis	r3, boothigh_jump at h	/* Jump to Boot High location */
	ori	r3, r3, boothigh_jump at l
	mtlr	r3

but that doesn't work as I get the error message "Error: Relocation cannot be done when using -mrelocatable".

Any suggestions how to implement this?

My current idea is the following which compiles without an error but I'm not sure whether it is the most clever way how to do it. I fear I'm just fooling the compiler here:

	bl	boothigh_jump1		/* get current address */
	mflr	r3
	lis	r4, 0xFFF00000 at h		/* add new base address */
	add	r3, r3, r4
	lis	r4, (bh_jump2 - bh_jump1)@h	/* move forward to jump target */
	ori	r4, r4, (bh_jump2 - bh_jump1)@l
	add	r3, r3, r4
	mtlr	r3				/* jump */					

By the way: I guard my code with "#if !defined(CFG_RAMBOOT), put it before the call of init_5xxx_core and also update r5 (contains a copy of MSR). Is that enough to not break something else?


More information about the U-Boot mailing list