IntRegister() - relocating vtable
HI~
I found IntRegister() function in DriverLib registers user interrupt handler in "RAM variable - g_pfnRAMVectors[]". And when the first time this function invoked, this gloval variable will be initiallized with vectors in address 0x0~NUM_INTERRUPTS(just copy). I think this can be a problem if someone is running his/her code in RAM or using boot loader. Just explane boot loader case. The boot loader code included in DriverLib uses vector table in address 0x800 and registers this address in NVIC_VTABLE register. So, interrupt vectors in address 0x0~NUM_INTERRUPTS are not for running application but for boot loader. For now, if someone works with DriverLib and uses IntRegister() or anything dynamic handler registering functions with boot loader, it doesn't work. I think g_pfnRAMVectors[] variable must be initialized with vectors in address HWREG(NVIC_VTABLE)~HWREG(NVIC_VTABLE)+NUM_INTERRUPTS.
@ interrupt.c file #if defined(ORIGINAL_DRIVERLIB) g_pfnRAMVectors[ulIdx] = (void (*)(void))HWREG(ulIdx * 4); #else g_pfnRAMVectors[ulIdx] = (void (*)(void))HWREG(HWREG(NVIC_VTABLE) + ulIdx * 4); #endif
Just one line modification, that's my suggestion.
login or register to reply
|