是0x00000004吗?
为什么库文件中这么定义呢:
#define NVIC_VTABLE 0xE000ED08 // Vector Table Offset 在hw_nvic.h文件中
#define NVIC_BASE 0xE000E000 // Nested Vectored Interrupt Ctrl 在hw_memmap.h文件中
如果要重新定义 中断向量表起始地址 又要怎么弄呢?主要是做IAP升级用的。
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
是0x00000004吗?
为什么库文件中这么定义呢:
#define NVIC_VTABLE 0xE000ED08 // Vector Table Offset 在hw_nvic.h文件中
#define NVIC_BASE 0xE000E000 // Nested Vectored Interrupt Ctrl 在hw_memmap.h文件中
如果要重新定义 中断向量表起始地址 又要怎么弄呢?主要是做IAP升级用的。
您好,
那请问要如何设置中断向量表的偏移量呢?
我是用TM4C129做IAP升级,分为bootloader程序和app程序,flash空间前64KB(0x00000000~0x00010000)分配给bootloader程序,其余给APP程序(0x00010000~0x00100000)。
现在的情况是程序可以从bootloader程序跳转到app程序了,但是 跳转后执行一会儿就死机了(串口内容只打印了一半),目测是 APP程序的中断向量表没有设置好;因为当APP程序中有中断产生时,TM4C129的 PC 指针仍强制跳转到地址0X00000004 中断向量表处,而不是新程序的中断向量表(0x00010004),所以在APP程序开始处需要设置中断向量表的偏移量,在stm32中用 SCB->VTOR = FLASH_BASE | 0x10000; 来设置,不知道在TM4C129中要如何设置这个偏移量?
我用 HWREG(NVIC_VTABLE) = 0x10000; 这一句不行。谢谢。
这个没有用过。但是tiva ware中是有bootloader的代码的,可以参考看看。
已经弄好了,APP的中断向量表可以不用设置,因为TI库函数里已经把 中断向量表复制到ram区了,那偏移地址在库函数里设置了。源码如下:
void
IntRegister(uint32_t ui32Interrupt, void (*pfnHandler)(void))
{
uint32_t ui32Idx, ui32Value;
//
// Check the arguments.
//
ASSERT(ui32Interrupt < NUM_INTERRUPTS);
//
// Make sure that the RAM vector table is correctly aligned.
//
ASSERT(((uint32_t)g_pfnRAMVectors & 0x000003ff) == 0);
//
// See if the RAM vector table has been initialized.
//
if(HWREG(NVIC_VTABLE) != (uint32_t)g_pfnRAMVectors)
{
//
// Copy the vector table from the beginning of FLASH to the RAM vector
// table.
//
ui32Value = HWREG(NVIC_VTABLE);
for(ui32Idx = 0; ui32Idx < NUM_INTERRUPTS; ui32Idx++)
{
g_pfnRAMVectors[ui32Idx] = (void (*)(void))HWREG((ui32Idx * 4) +
ui32Value);//复制中断向量表
}
//
// Point the NVIC at the RAM vector table.
//
HWREG(NVIC_VTABLE) = (uint32_t)g_pfnRAMVectors; //重新定义偏移地址
}
//
// Save the interrupt handler.
//
g_pfnRAMVectors[ui32Interrupt] = pfnHandler;
}
不过不懂为什么要把中断向量表复制到ram区,有什么好处吗?而且如果用flash区的中断向量表程序运行起来有点小问题(体现在复位后串口打印有时候会乱码,十次会出现5次这种情况)。