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.
请问编译器在解释
void interrupt GPIO_ISR_test(void)
和
void GPIO_ISR_test(void)
时会有什么区别呢?
最近我在调试同事遗留下来的6657工程,工程中使用了第三方的库文件“C6657_Driver_Lib.lib”,该库文件中,注册中断函数的函数声明如下:
Bool C6657_CoreInt_Set (Uint16 EventId,Uint8 VectId,void interruptISR(),void* Param);
由于只是提供了库文件,所以我不知道这个注册中断函数的定义
调试过程中发现,如果中断函数定义为void interrupt GPIO_ISR_test(void),那么程序执行后会很快跑飞;
如果中断函数定义为void GPIO_ISR_test(void),则执行是正常的。
当中断函数定义为void interrupt GPIO_ISR_test(void)时,
C6657_CoreInt_Set (89,15,GPIO_ISR_test,NULL);通过中断注册函数中的GPIO_ISR_test无法定位到中断函数的定义,但是编译并没有报错。
所以我想,编译器对void interrupt GPIO_ISR_test(void)的编译结果是不是和void GPIO_ISR_test(void)不一样,想请教一下
如果是裸机程序,中断子函数需要用interrupt伪指令定义。如果是sys/bios程序,则不需要interrupt关键字来定义。请看下面的文档。
Functions that use the interrupt keyword or INTERRUPT pragma may not use the Hwi dispatcher or interrupt stubs and may not call SYS/BIOS APIs.
https://www.ti.com/lit/ug/spruex3v/spruex3v.pdf