lm3s 把中断放在ram中,对NVIC_VTABLE赋值时错误
[复制链接]
- void
IntRegister(unsigned long ulInterrupt, void (*pfnHandler)(void)) { unsigned long ulIdx, ulValue;
// // Check the arguments. // ASSERT(ulInterrupt < NUM_INTERRUPTS); // Make sure that the RAM vector table is correctly aligned. // ASSERT(((unsigned long)g_pfnRAMVectors & 0x000003ff) == 0);
// // See if the RAM vector table has been initialized. // if(HWREG(NVIC_VTABLE) != (unsigned long)g_pfnRAMVectors) { // Copy the vector table from the beginning of FLASH to the RAM vector // table. // ulValue = HWREG(NVIC_VTABLE); for(ulIdx = 0; ulIdx < NUM_INTERRUPTS; ulIdx++) { g_pfnRAMVectors[ulIdx] = (void (*)(void))HWREG((ulIdx * 4) + ulValue); }
// // Point NVIC at the RAM vector table. // HWREG(NVIC_VTABLE) = (unsigned long )(g_pfnRAMVectors+8); } // Save the interrupt handler. g_pfnRAMVectors[ulInterrupt] = pfnHandler; }
复制代码
上面是函数 那个+8是我自己加上的,加和不加都一样,NVIC_VTABLE始终是20000380. 为什么
|