avr-libc-dev
[Top][All Lists]
Advanced

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

Re: [avr-libc-dev] volatile in pgmspace.h ?


From: E. Weddington
Subject: Re: [avr-libc-dev] volatile in pgmspace.h ?
Date: Mon, 16 Jun 2003 22:16:17 GMT

> On Mon, Jun 16, 2003 at 08:53:50PM +0000, E. Weddington 
wrote:
> > > __LPM_enhanced__ should use "lpm %0,Z" (not Z+).
> > 
> > This was added because of a request to add other macros 
to 
> > allow further contiguous reads of flash without having 
to 
> > provide the address. I knew that this was only going to 
be 
> > available for the enhanced cores. I wrote an RFC to 
this 
> > list, with little response: 
> > <http://mail.nongnu.org/archive/html/avr-libc-dev/2003-
> > 06/msg00002.html>
> 
> IMHO, the "without having to provide the address" part is
> problematic - you really have to pass the pointer 
variable to
> the "asm" code and back (as an input and output operand), 
as
> shown in my previous mail.  There is no guarantee that any
> registers are preserved between one "asm" and the next 
one.

Very good point.
 
> I think pgm_read_{byte,word}_next(address) shold be 
implemented
> so that the post-incremented address is passed back to 
the caller
> (for use in subsequent reads).  Then you can use the same 
macro
> for all reads, including the first one.

As the macros "return" the byte being read from flash, the 
only way I see to do this would be another parameter which 
would hold a pointer to their address. I don't think this 
would buy the user any advantage then.

Based on this, I would rather not implement those _next 
macros, and I can definitely take out the extraneous Z+.

Thanks for your input, Marek.

Eric Weddington 







reply via email to

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