NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0); #else //Set the Vector Table base location at 0x08000000 NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0); #endif NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1); //中断优先级组 :1组(整个系统为同一组) // 设置抢占优先级0~1,响应优先级0~7 NVIC_InitS...
void NVIC_Configuration(void) { NVIC_InitTypeDef NVIC_InitStructure; #ifdef VECT_TAB_RAM // Set the Vector Table base location at 0x20000000 NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0); #else /* VECT_TAB_FLASH */ // Set the Vector Table base location at 0x08000000 NVIC_SetVectorTable(NVIC...
/* set vector table*/ NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0xffset); /* open interruption*/ __set_FAULTMASK(0); 程序中重定向完向量表地址后,需要在Keil中设置程序的下载位置
void NVIC_Configuration(void) { #ifdef VECT_TAB_RAM /* Set the Vector Table base location at 0x20000000 */ NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0); #else /* VECT_TAB_FLASH */ /* Set the Vector Table base location at 0x08000000 */ NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0); #...
(4)还要对NVIC寄存器进行配置 void NVIC_Configuration(void) { NVIC_InitTypeDef NVIC_InitStructure; /* Configure the NVIC Preemption Priority Bits */ NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0); #ifdef VECT_TAB_RAM /* Set the Vector Table base location at 0x20000000 */ ...
在执行完以上两行代码后,若发生中断,CPU就会去SRAM(即0x2000 0000处)取中断向量了,所以,以0x2000 0000作为起始地址之后的VECTOR_SIZE个字节就不能被改动了。为了达到这VECTOR_SIZE个字节不被修改的目的,如下两种方法可以实现。 •在工程文件内修改SRAM的起始地址及长度,如下图 ...
NVIC_InitTypeDef nvic; //USART_ClockInitTypeDef USART_InitClockStructure; SystemInit(); #ifdef VECT_TAB_RAM // Set the Vector Table base location at 0x20000000 NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0); #else /* VECT_TAB_FLASH */
void NVIC_Configuration(void) { NVIC_InitTypeDef NVIC_InitStructure; #ifdef VECT_TAB_RAM /* Set the Vector Table base location at 0x20000000 */ NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0); #else /* VECT_TAB_FLASH */ /* Set the Vector Table base location at 0x08000000 */ ...
同时在example目录下有vectortable_relocation这样的一个例子:This example describes how to use the NVIC firmware library to set the CortexM3 vector table in a specific address other than default. 在这个例子里面就是直接调用了上面的那个函数,似乎意思很明显了。但是SCB->ExceptionTableOffset是如何起作用的呢...
WWDG_SetCounter(0x7F); WWDG_ClearFlag(); /* 清中断标志*/ } void main (void){ if (!Target_InitClock()) { while (1); } /* Deinitializes the NVIC */ NVIC_DeInit(); #ifdef VECT_TAB_RAM /* Set the Vector Table base location at 0x20000000 */ ...