mpc824x/start.S
I have a question for everyone on the list. I am booting u-boot on a custom mpc824x board (utx8245) and I have run into a minor annoyance. In start.S you have the following code in relocate_code:
relocate_code:
mr r1, r3 /* Set new stack pointer
*/
mr r9, r4 /* Save copy of Global Data
pointer */
mr r10, r5 /* Save copy of Destination
Address */
mr r3, r5 /*
Destination Address */
#ifdef DEBUG
lis r4, CFG_SDRAM_BASE at h /* Source
Address */
ori r4, r4, CFG_SDRAM_BASE at l
#else
lis r4, CFG_MONITOR_BASE at h /* Source
Address */
ori r4, r4, CFG_MONITOR_BASE at l
#endif
lis r5, CFG_MONITOR_LEN at h /*
Length in Bytes */
ori r5, r5, CFG_MONITOR_LEN at l
li r6, CFG_CACHELINE_SIZE /*
Cache Line Size */
/*
* Fix GOT pointer:
*
* New GOT-PTR = (old GOT-PTR - CFG_MONITOR_BASE) +
Destination Address
*
* Offset:
Now I am curious why when you are running in debug mode you choose to copy everything from CFG_SDRAM_BASE, while working normally you copy it from CFG_MONITOR_BASE. For us there is nothing to be copied at CFG_SDRAM_BASE and u-boot crashes right after it relocates the code and jumps to the copied point. We get around this obviously by doing the following:
relocate_code:
mr r1, r3 /* Set new stack pointer
*/
mr r9, r4 /* Save copy of Global Data
pointer */
mr r10, r5 /* Save copy of Destination
Address */
mr r3, r5 /*
Destination Address */
#ifdef DEBUG
lis r4, CFG_MONITOR_BASE at h /* Source
Address */
ori r4, r4, CFG_MONITOR_BASE at l
#else
lis r4, CFG_MONITOR_BASE at h /* Source
Address */
ori r4, r4, CFG_MONITOR_BASE at l
#endif
lis r5, CFG_MONITOR_LEN at h /*
Length in Bytes */
ori r5, r5, CFG_MONITOR_LEN at l
li r6, CFG_CACHELINE_SIZE /*
Cache Line Size */
/*
* Fix GOT pointer:
*
* New GOT-PTR = (old GOT-PTR - CFG_MONITOR_BASE) +
Destination Address
*
* Offset:
This is a hack, and it cannot be merged back into u-boot so I was wondering if there was a more eloquent way to do this, something else I am missing that will make my program work while in debug mode with an unmodified start.S.
Thanks for your time,
Matthew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.denx.de/pipermail/u-boot/attachments/20030528/2e21662f/attachment.htm
Matthew,
First, you will get much more response on this list if you *do not* post HTML or other formats to this list. Please use plain text only. It takes more time that I have to reformat a proper reply :)
There are a number of issues with the code snippet you pointed out.
Quoted 4 lines
#ifdef DEBUG
lis r4,CFG_SDRAM_BASEat h /* Source Address */
ori r4, r4,CFG_SDRAM_BASEat l
#else
<snip>
First, if one really wants to do this, the label DEBUG is mis-named. It should be
#ifdef BOOT_IMAGE_FROM_RAM or something like that. This is simply the address where the ppcboot image is located before it is copied to RAM.
Second, this is *very* old code and broken. As others have pointed out repeatedly on this list, if you have a flash burning tool such as the BDI-2000 and it is properly configured to use a workspace to speed up the flash burning process, it is just as fast to burn a new image into flash and test it, rather than to do all the detail work to get a U-Boot image to boot from RAM. I've used both methods, but I am now convinced that booting from RAM isn't worth the trouble.
My suggestion: submit a patch with these four lines deleted from the file. It's broken code anyway.
-Chris Hallinan
DS4.COM, Inc.
<snip>
.
.
.