
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@h /* Source Address */ ori r4, r4, CFG_SDRAM_BASE@l #else lis r4, CFG_MONITOR_BASE@h /* Source Address */ ori r4, r4, CFG_MONITOR_BASE@l #endif lis r5, CFG_MONITOR_LEN@h /* Length in Bytes */ ori r5, r5, CFG_MONITOR_LEN@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@h /* Source Address */ ori r4, r4, CFG_MONITOR_BASE@l #else lis r4, CFG_MONITOR_BASE@h /* Source Address */ ori r4, r4, CFG_MONITOR_BASE@l #endif lis r5, CFG_MONITOR_LEN@h /* Length in Bytes */ ori r5, r5, CFG_MONITOR_LEN@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