[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] How to tell avr-gcc not to use some registers in the
From: |
Parthasaradhi Nayani |
Subject: |
Re: [avr-gcc-list] How to tell avr-gcc not to use some registers in the whole program? |
Date: |
Sat, 21 Feb 2009 20:01:11 -0800 (PST) |
--- On Sun, 2/22/09, Georg-Johann Lay <address@hidden> wrote:
> You can do this by introducing two global register
> variables like
>
> register foo_t * pfoo asm ("r2");
>
>
> Also note the command line option -ffixed-2 -ffixed-3 that
> turn R2/R3 into fixed registers (in contrast to R2/R3 beeing
> call-saved-regs, which is the default for them).
>
> Also note that you most probably won't experience the
> desired reduction of program memory and/or execution time.
> This is because the compiler must move R2 to X, Y, or Z to
> access a location.
>
> Making Y or Z global regs will crash the compiler sooner or
> later. I would not recommend to make X global, either.
In your sample code above only R2 (8 bit) is bound to the variable. I had a
similar requirement for using 16 bit (say X register) as pointer, can you post
a sample line of code on how to do this? Thank you.
Nayani