gcc — __attribute__((interrupt( irq )))

元气小坏坏 提交于 2020-02-29 00:04:44

问题


i started with device driver for arm ... there i saw for each handler mention --- __attribute__((interrupt( irq ))) -.I am confused how this attribute will place a call to our driver routine ..??

IRQ of arm have following Vector address--- 0x00000018 (or 0xFFFF0018) As there can be many interrupt handler on same line. Suppose if we have 4 device driver each with its own IRQ to be reistered.

Means some startup code will be provided by the GCC compiler for the IRQ handler & compiler will place call to our routine in that startup code for interrupt handler ..... Am i right ...?


回答1:


From GCC docs for interrupt attribute:

The compiler generates function entry and exit sequences suitable for use in an interrupt handler when this attribute is present.

You can use objdump easily to see how this attribute changes your binary which should clarify the situation for you much better.




回答2:


The attribute should ONLY be used by interrupt handler of the OS and NOT by interrupt handler of a specific driver. The OS will read the IRQ vector/number and call the appropriate driver function to service the IRQ. You only need to register your driver/ISR with the OS.



来源:https://stackoverflow.com/questions/13786605/gcc-attribute-interrupt-irq

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!