我现在对向量表的重定向不太清楚,请指导的同学说一下。
我的理解是这样的:
1.在startup 文件的common_startup函数中拷贝向量表到RAM
/* Copy the vector table to RAM */
if (__VECTOR_RAM != __VECTOR_TABLE)
{
for (n = 0; n < 0x410; n++)
__VECTOR_RAM[n] = __VECTOR_TABLE[n];
}
/* Point the VTOR to the new copy of the vector table */
2. write_vtor((uint32)__VECTOR_RAM);中,把RAM的向量表的首地址给VTOR
void write_vtor (int vtor)
{
/* Write the VTOR with the new value */
SCB_VTOR = vtor;
}
这样在发生异常时,就可以在RAM中读到ROM中的中断函数地址,这就是重定向中断向量了吗