ARM and interrupts

Bill Gatliff bgat@billgatliff.com
Fri Mar 19 17:11:00 GMT 2004


Toralf:


__interrupt__ doesn't always work in gcc, and it appears to not work 
with the version of the toolchain you are using.

I prefer to write code that always works.  :^)  Hence, I don't use 
__interrupt__.

 From a philosophical point of view, you don't want to use something 
like __interrupt__ anyway.  It ties your code to a compiler feature that 
isn't consistently supported within gcc, and is done differently across 
toolchains from other vendors.  Avoid it, you're better off in the long run.

And frankly, I'd prefer that gcc _not_ever_ support __interrupt__, so 
that others would be forced to agree with me.  :^)


b.g.



Toralf Lund wrote:

> Bill Gatliff wrote:
>
>> Toralf:
>>
>>
>> I've written ISRs in C, but you don't want to do that with GNU.  What 
>> you want to do instead is provide a "stub" ISR in assembly language 
>> (only two or three instructions), that calls the C "ISR".  That way, 
>> you aren't dependent on gcc's intermittent support of the 
>> __interrupt__ attribute.
>
>
> Is what you are saying basically that __attribute__((interrupt)) 
> doesn't work? I did find the doc on this after all (in gcc info page), 
> and tried
>
> __attribute__((interrupt("IRQ"))) void IRQ_Handler(void)
>
> but got
>
> mc9328irq.c:88: warning: `interrupt' attribute directive ignored
>
>>
>> See the Evaluator7T tutorial in the wiki or under 'articles' on my 
>> website, I think I provide a few examples.
>>
>> Regards,
>>
>>
>> b.g.
>>
>>
>> Toralf Lund wrote:
>>
>>> [ ... ]
>>>
>>>>
>>>>
>>>> The book is good, but it isn't cheap.  But hey, lack of knowledge 
>>>> on these details is even more expensive!
>>>>
>>>>> We also found some example code for a test board from Motorola 
>>>>> (we're actually using a Motorola CPU with ARM core), and it turns 
>>>>> out that they also have an "Interrupt Controler" application note 
>>>>> that's quite helpful (unlike the CPU reference manual, I might add..) 
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Yes, I was going to mention something related to that.  With the 
>>>> "advanced/vectored interrupt controllers" that are all the rage 
>>>> now, there are some nifty tricks you can use to really boost 
>>>> interrupt handling performance.  I have examples, but if there are 
>>>> some in your manuals then go with them.
>>>
>>>
>>>
>>>
>>> BTW, have you written interrupt handlers in C? I'm unsure how to set 
>>> the functions to make them return the correct way etc., or if that's 
>>> even possible with gcc. The example code uses the __irq keyword (as 
>>> in "void __irq FIQ_Handler(void)") to do it, but this doesn't work 
>>> with gcc, I think.
>>>
>>>>
>>>>
>>>> b.g.
>>>>
>>>
>>> - Toralf
>>>
>>> ------
>>> Want more information?  See the CrossGCC FAQ, 
>>> http://www.objsw.com/CrossGCC/
>>> Want to unsubscribe? Send a note to 
>>> crossgcc-unsubscribe@sources.redhat.com
>>>
>>
>
>

-- 
Bill Gatliff
Embedded GNU development and training services.
bgat@billgatliff.com



------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com



More information about the crossgcc mailing list