[Top][All Lists]

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

[avr-gcc-list] Legal registers

From: Haase Bjoern (PT-BEU/EMT) *
Subject: [avr-gcc-list] Legal registers
Date: Mon, 6 Jun 2005 13:07:45 +0200

IMO this should work given that 
1.) you mark r3 to be a "fixed" register by gcc's compile switches 
2.) for all of the externally linked files you have been using these compile 
3.) all other assembler source files follow this convention

IMO, it will only be possible to do this with registers r2...r7 . All of the 
other registers are possibly used for specialized purposes like parameter 
passing and may not be marked as "fixed" without causing problems, IIRC.



-----Ursprüngliche Nachricht-----
Von: Ben Mann [mailto:address@hidden 
Gesendet: Montag, 6. Juni 2005 10:11
An: Haase Bjoern (PT-BEU/EMT) *; address@hidden; 'Ron'
Betreff: RE: [avr-gcc-list] Legal registers

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


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);
                PORTA = counter;

        return 0;


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.


-----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.



-----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

AVR-GCC-list mailing list

reply via email to

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