Content originally posted in LPCWare by sTs on Thu Sep 13 08:20:26 MST 2012
Hi,
I'm having troubles with vector table remapping on LPC1114 (Cortex-M0).
As long as I'm not using the same kind of interrupt in both the 2nd bootloader part and the actual application, all goes well. But I need the I2C_IRQHandler(void) in both (with a different implementation).
Remapping is by default like this (if you don't need i2c in the bootloader), as given by AN10995:
void I2C_IRQHandler(void) __attribute__ (( naked ));
void I2C_IRQHandler(void)
{
asm volatile("ldr r0, =0x107C");
asm volatile("ldr r0, [r0]");
asm volatile("mov pc, r0");
}
And indeed, this starts the main application correctly.
However, as I need also i2c in the bootloader (but a different implementation), a thought the function should be adapted to something like this (but I can't get it to work):
//void I2C_IRQHandler(void) __attribute__ (( naked ));
void I2C_IRQHandler(void); //else I can't do anything else but the asm-lines in the handler
void I2C_IRQHandler(void)
{
if ( valid_application_available == 0 )
{
asm volatile("ldr r0, =0x107C");
asm volatile("ldr r0, [r0]");
asm volatile("mov pc, r0");
}
else
{
i2c_from_bootloader();
}
}
It seems like removing the __attribute__ part from the declaration, is already enough to make things crash... (but keeping it also doesn't work :confused:)
So I'm a bit stuck here... If someone has some tips ?