void CopyInterruptToSRAM(void) { unsigned int * flashPtr, * ramPtr; unsigned int * uLimit = (unsigned int *) 0x200; ramPtr = (unsigned int *)0x10000000;//load RAM starting at 0x10000000, flashPtr = (unsigned int *)0x00;//start of interrupt vector table while(flashPtr < uLimit) { *ramPtr = *flashPtr; ramPtr++; flashPtr++; } } |
CopyInterruptToSRAM();//remap interrupt vector to SRAM SCB->VTOR =0x10000000; LPC_SYSCON->SYSMEMREMAP = 0x01;//change memory map |
__ramfunc void SysTick_Handler(void) { LPC_GPIO_PORT->NOT0 = (1<<7); } |
void NMI_Handler(void) { /* Re-direct interrupt, get handler address from application vector table */ asm volatile("ldr r0, =0x3008"); <--- new address to jump to when interrupt is received asm volatile("ldr r0, [r0]"); asm volatile("mov pc, r0"); } |
int32_t vector_in_ram[128] __attribute__ ((section ("vtable"))); // variable to hold the interrupt vectors __disable_irq(); // remap the interrupt vectors to the start of the code loaded in memory int32_t *p = (int32_t *) 0x3000; <---- address of the start of your main application int i; // copy the interrupt vector table on base RAM for (i=0;i<128;i++) { vector_in_ram = *p; p++; } LPC_SYSCON->SYSMEMREMAP = 0x1; // remap the interrupt vectors to ram __enable_irq(); // enable interrupts |