[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [avr-gcc-list] AvrX and pgm_read_byte_near()
From: |
Christian Ludlam |
Subject: |
RE: [avr-gcc-list] AvrX and pgm_read_byte_near() |
Date: |
Tue, 25 Nov 2003 23:33:52 GMT |
User-agent: |
Messenger-Pro/1.00c (MsgServe/1.00a) (RISC-OS/5.03) POPstar/2.05 |
On 25 Nov E. Weddington wrote:
> On 25 Nov 2003 at 8:28, Brian Cuthie wrote:
> > When I try to use this (in fact, when I try to use the existing "far"
> > versions, too) I get the following error:
> > error: can't find a register in class `POINTER_Z_REGS' while reloading
> > `asm'
> > In looking at the gcc docs it appears that it's not possible to specify
> > registers in a clobber list that are bound to some input parameter. Could
> > that be what's going on here?
> Hmm. Yeah, I'm seeing that in the docs too. So perhaps the __LPM macros are
> not in error, but perhaps the __ELPM macros are? (for listing Z reg in
> clobber list) Interestingly, I've never had any problems with compiling
> with the __ELPM macros and I haven't heard of any similar problems...
> Anybody else have thoughts on this?
I'm no expert, but look closely at the macros. The __LPM macros declare Z as
an input, and don't change it (LPM by itself has no effect on the Z
register), so Z is not clobbered.
The __ELPM macros move the input parameter into the Z register without
declaring it as an input - they have to do this since they need to load RAMPZ
and Z isn't big enough to hold the address by itself. Thus Z is clobbered.
I don't personally think there's a problem with either of these macros.
--
Christian Ludlam
address@hidden