- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
在嵌入式项目中,我需要使用同一个 IRQ 处理程序处理两个不同的外部中断。我不想直接更改启动程序集中的中断 vector 表条目,因此我必须坚持使用 IRQ 处理程序例程(EXTI9_5_IRQHandler 和 EXTI15_10_IRQHandler)的预定义函数名称。
对于这两个中断,我需要完全相同的代码来处理中断。
当然,我可以这样编程:
void realIRQHandler (void)
{
//do some magic interrupt handling here
return;
}
void EXTI9_5_IRQHandler(void)
{
realIRQHandler(); //calls the real IRQ handler function
}
void EXTI15_10_IRQHandler(void)
{
realIRQHandler(); //calls the real IRQ handler function
}
这最终会做我想做的,但它会有一个普通的函数调用,在每次中断调用中都会有将寄存器推送和恢复到堆栈的开销。
有没有办法以某种方式替换 EXTI9_5_IRQHandler
和 EXTI15_10_IRQHandler
中的那些函数调用,并将其替换为一些无条件分支或跳转?
返回/退出时,realIRQHandler
的末尾需要什么?
谢谢!问候,菲利克斯
最佳答案
I don't want to change the interrupt vector table entries in the startup assembly directly
这就是问题所在。该表的唯一正确解决方案是修改 vector 表。因此, vector 表不应定义在某个启动文件中,而应定义在它自己的文件中。链接描述文件或 .c 文件(函数指针数组)。
如果不能修改 vector 表,就不能在工具链上进行微 Controller 编程。因此,如果您的编译器/链接器无法提供一种简单的方法来执行此操作,您将不得不自定义启动代码。
关于c - Keil Arm 编译器 : Is there a way to hook in the same function for two interrupts without modifying the Interrupt Vector Table?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57570040/
我是一名优秀的程序员,十分优秀!