[U-Boot-Users] Running test code from RAM while having GOT pointing to flash

I am a newbie at PowerPC assembly. In my last patch, I submitted a series of test as part of my work in bringing up the memory controller.
My code seems to be crashing in the relocate_code routine while switching from flash to RAM. There was an address_probe fixup which was not enabled And I enabled it. So, the relocation table (GOT) gets copied successfully
From flash to RAM but the code dies seomewhere between coping the fixups
And the in_ram label. Somehow, on my BDI, it sees an exception and goes to the reset vector i.e 0x100.
My approach is to avoid the GOT stuff and write a test routine which is Position dependant and copy the function to address 0x0 in RAM. After Executing the code in RAM, jump back to flash. People over here think That since the I-cache is enabled, the processor may burst but we are Fixing some bugs with that. The CS has BI flag set.
Does someone have some sample code for putting embedded C/assembly code ? My approach was to copy the memset routine from flash to RAM at address 0x0. Then do a memset from address 0x0 + sizeof(memset) to user given input of End of RAM. This way, I run memset from RAM and verify that it actually works with my peek/poke routine from flash.
My first cut at it is here but it is complaining about GOT. Not enough experience with ld... Help/tips ??
__asm__ __volatile__( \ " lis r10, 0x0@h\n" \ " eieio\n" \ " lis r3, address@l\n" \ " ori r3, r3, address@h\n" \ " lis r4, fillpattern@l\n" \ " ori r4, r4, fillpattern@h\n" \ " lis r5, bytecount@l\n" \ " ori r5, r5, bytecount@h\n" \ " b 0x0\n" \ );
Thanks,
Atul

In message 4A062D477D842B4C8FC48EA5AF2D41F20152806A@us-bv-m23.global.tektronix.net you wrote:
My code seems to be crashing in the relocate_code routine while switching from flash to RAM. There was an address_probe fixup which was not enabled And I enabled it. So, the relocation table (GOT) gets copied successfully From flash to RAM but the code dies seomewhere between coping the fixups
I think you misunderstand the function of the GOT.
And the in_ram label. Somehow, on my BDI, it sees an exception and goes to the reset vector i.e 0x100.
See the FAQ at http://www.denx.de/wiki/view/DULG/UBootCrashAfterRelocation
My approach is to avoid the GOT stuff and write a test routine which is
The "GOT stuff" is known to work just fine. I suggest you focus on the remaining stuff, i. e. your SDRAM init sequence. Again, see the FAQ.
Best regards,
Wolfgang Denk

atul.sabharwal@exgate.tek.com wrote:
I am a newbie at PowerPC assembly. In my last patch, I submitted a series of test as part of my work in bringing up the memory controller.
[snip]
My first cut at it is here but it is complaining about GOT. Not enough experience with ld... Help/tips ??
__asm__ __volatile__( \ " lis r10, 0x0@h\n" \ " eieio\n" \ " lis r3, address@l\n" \ " ori r3, r3, address@h\n" \ " lis r4, fillpattern@l\n" \ " ori r4, r4, fillpattern@h\n" \ " lis r5, bytecount@l\n" \ " ori r5, r5, bytecount@h\n" \ " b 0x0\n" \ );
Thanks,
Atul
This has nothing to do with your current problems, but if you try to run the above code, it won't work. You are doing a "load shifted" of the _lower_ half of the word and then oring in the _upper_ half of the word. You need to switch your "@l" (low half) and "@h" (high half). What you have will give you a halfword-swapped value:
Want: 01234567 Oops: 45670123
gvb
participants (3)
-
atul.sabharwal@exgate.tek.com
-
Jerry Van Baren
-
Wolfgang Denk