Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] {To TomW} GCC-Bug in IRQs

2006-03-25 by Robert Adsett

At 08:17 PM 3/25/2006 +0100, Sten wrote:
>Robert Adsett wrote:
> > Rather than go through all this hand-wringing why not just write an
> > assembly stub?  You'd know it was correct and you'd be done already.  At
> > most it would cost you an extra call from the stub to your C
> > function.  Heck if it was small enough it might make sense to do the whole
> > thing in asm.  For that matter you could steal one of my stubs.
>At the moment I declare my IRQ functions as "naked" and write my own 
>prologue/epilogue with inline
>assembler. But it is less efficient because I don't know which registers 
>are really used, so I have
>to save all non-banked registers (r0..12 for IRQ and r0..r7 for FIQ) which 
>is a wast of performance.


If you write a stub that problem disappears. The procedure call standard 
ensures that the proper registers are saved when you call out of the stub. 
You only have to save something like 6 registers for IRQ, the called 
routine preserves any of the others it uses..

Also are you sure you actually really care about the extra saves?  Beware 
of premature optimization.  Didn't Knuth call it the root of all evil? 
:)  If your response time is sufficient and your are not overloading the 
CPU forget about the wasted cycles, you are spending time doing something 
that simply does not matter.

I do a stub not for efficiency but because experience has taught me to 
never trust any compiler to produce correct interrupt code.  Correct does 
sometimes mean efficient but it can also mean the more obvious things.

Robert

" 'Freedom' has no meaning of itself.  There are always restrictions,   be 
they legal, genetic, or physical.  If you don't believe me, try to chew a 
radio signal. "  -- Kelvin Throop, III
http://www.aeolusdevelopment.com/

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.