Using a LPC2368 & RTX I'm trying to remap exception vectors to RAM in order to run a bootloader and application in separate areas of memory. This is similar to http://www.keil.com/forum/docs/thread10212.asp
Bootloader code is at 0x00000000 - 0x00010000, main code is 0x00010000+, exception vectors are at 0x40000000 I have the RAM exception vectors set to import the handler addresses from a shadow set of vectors in the main startup source - this way the scatterload takes care of updating the copy in RAM when switching from bootloader to main application (or back).
Everything is looking good execpt I can't figure out how to process the VIC interrupt. What I need to do is read the vector address from the VicVectAddr register (0xFFFFFF00 on the LPC2368) and jump to the vector address. The usual technique for this is:
LDR PC, [PC, #-0x0120]
This works assuming the vector is at 0x18 (PC + 0x08 - 0x120 = 0xFFFFFF00), but I can't figure out what code to use when the PC is over the relative limit (+-0x1000). eg this is invalid:
LDR PC, [PC, #-0x10120]
What I want to do is something like:
IRQ_Handler LDR R0, =0xFFFFFF00 LDR PC, [R0]
but without clobbering R0.
Yes, it has been a long time since I've had to do any assembly coding.
There is no need for the complicated approach that you are suggesting.
You can simply use the existing instruction:
This instruction should be placed in RAM at 0x40000018 and REMAP to RAM should be activated which will remap the first 64 bytes from address 0x40000000 to 0 (see NXP manual).
When an interrupt occurs the core jumps to address 0x00000018 where the remapped instruction from 0x40000018 resides and the PC relative jump is calculated from address 0x00000018.
Yes, this works:
I guess during initial testing I had the RAM vectors jump to a handler at 0x10000.
Thank you for your help.