MPC5xx exception table relocation
- From: Randy Meyers <rmeyers1001@xxxxxxxxx>
- Date: Thu, 12 Jul 2012 20:15:26 -0500
I am having trouble getting code to run when relocated in flash.
Setup; MPC565, bootloader (mine) located @ 0x0000, compiled with CW 8.1
MSR[IP] = 0x0. Everything is good and bootloader runs on PORESET.
User program loaded @ 0x10000. Compiled with MSR[IP] = 1, BBCMCR[ETRE] = 1, and BBCMCR[OERC] = 0b01. As per AN2472. Linker file adjusted to load @ 0x10000. Linker MAP shows everything where it is supposed to go. ..reset @ 0x10008.
Bootloader issues 'ba 0x10008'. User program starts running and everything is fine until the OS (ucosII) issues the first 'sc' command. Program halts, I believe because it can't find the 'system_call_exception' .I should say that the user program works perfectly when compiled for and loaded at 0x0000.
I have set (or reset) MSR[IP], and the BBCMCR register values after the jump and it does not help.
My question specifically; what controls where the system looks for the exception table at? What causes the processor to say 'Oh, an 'sc' call I'll go to _____ memory location to look for the 'system_call_exception'.
Or, on the other hand, maybe I'm just going about trying to get my code started the wrong way.
Any help would be greatly appreciated.