avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Avoid register saving


From: Christian Vogel
Subject: Re: [avr-gcc-list] Avoid register saving
Date: Thu, 1 Apr 2004 12:13:59 +0200
User-agent: Mutt/1.2.5.1i

Hi,

On Thu, Apr 01, 2004 at 09:42:35AM +0100, Filipe Campos wrote:
> But You give a good idea, How the ISR can be writen in ASM and than compiled
> by the AVR-GCC ?

You can use __attribute__((naked)), then the compiler will not add any
additional code to a function, you have to do all the housekeeping
yourself.

I would propose that you write the routine in C first, then look
at the generated assembly code and work from there...

I did this once; if I remember correctly, the gcc I used for this
code made something ugly out of the simple isr...

        register unsigned char tick asm("r3");

        #if NAKED_IRQ
        __attribute__ ((naked))
        SIGNAL(SIG_OUTPUT_COMPARE1A){
            asm("push r0");
            asm("in r0,0x3f"); /* saves status register... */
            tick++;            /* inc r3, may modify status reg. */
            asm("out 0x3f,r0");
            asm("pop r0");
            asm("reti");
        }
        #else
        SIGNAL(SIG_OUTPUT_COMPARE1A){
            tick++;
        }
        #endif

  Chris

-- 
This site has been moved.
We'd tell you where, but then we'd
have to delete you.
-- Charles Matthews

_______________________________________________
avr-gcc-list mailing list
address@hidden
http://www.avr1.org/mailman/listinfo/avr-gcc-list


reply via email to

[Prev in Thread] Current Thread [Next in Thread]