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

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

RE: [avr-gcc-list] Legal registers


From: Ben Mann
Subject: RE: [avr-gcc-list] Legal registers
Date: Mon, 6 Jun 2005 16:11:08 +0800

Out of interest, why not just reserve the register, as per:

http://www.nongnu.org/avr-libc/user-manual/FAQ.html#faq_regbind

For example

************
#include <avr/io.h>
#include <avr/signal.h>
#include <avr/interrupt.h>


register unsigned char counter asm("r3");

int main()
{
        EICRA |= (1<<ISC01);
        EIMSK |= (1<<INT0);
        sei();
        for(;;)
                PORTA = counter;

        return 0;
}

SIGNAL(SIG_INTERRUPT0)
{
        counter++;
}
************

this example compiles ok, but I strangely believe that the register modifier
is not really intended to be used globally - for example I've not tested if
it actually stops gcc from using r3 in an externally linked file.

Regards,

Ben
 
-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of Haase
Bjoern (PT-BEU/EMT) *
Sent: Monday, 6 June 2005 3:26 PM
To: address@hidden
Subject: AW: [avr-gcc-list] Legal registers

For implementing, e.g. a context switch between two tasks you will have to
safe *all* registers and the stack pointer. There is a distinction between
different uses of the lower and the higher registers concerning the calling
convention (the called function may safely overwrite a certain subset of
registers without saving them), but that does not prevent gcc to take profit
of all of the registers.

Yours,

Björn 

-----Urspr√ľngliche Nachricht-----
Von: address@hidden
[mailto:address@hidden Im
Auftrag von Ron
Gesendet: Sonntag, 5. Juni 2005 10:03
An: address@hidden
Betreff: [avr-gcc-list] Legal registers

Hi All. Does it somewhere specify that avrgcc and its library routines
should only use a subset of the AVR registers (say 0,1,18-31), or can
the whole 32 be used if required? I ask because it would save a deal of
pushing and popping in a preemptive os if you knew for sure register
subset x would never be used.

Ron Kreymborg



_______________________________________________
AVR-GCC-list mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list





_______________________________________________
AVR-GCC-list mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list







reply via email to

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