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

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

RE: [avr-gcc-list] Function Pointers on AT90USB1287 and ATmega2561


From: Stu Bell
Subject: RE: [avr-gcc-list] Function Pointers on AT90USB1287 and ATmega2561
Date: Fri, 22 Feb 2008 10:34:25 -0700

Pete Wrote:
> Stu Bell wrote:
> > One final comment about your last paragraph.  AVR instructions are 
> > addressed by the 16-bit word, not by the 8-bit byte.  So, a 16-bit
PC 
> > can address 64 K *words*, or 128 K *bytes*.  It's only in the 
> > m2560/2561 with 256 K bytes of Flash do you run into trouble.
> 
> Right.  Though I did say words not bytes.  The AVR LIBC documentation
> says "with > 64 KB of flash ROM".  Sounds like that needs to be
updated, 
> especially if function pointers cannot address code beyond 64K words.
> Though that may not be what they meant.

It depends on where you're reading, but yes, that could be a bug in the
documentation.  

On the other hand, the original "program space data" commands (from
pgmspace.h) do have a limitation on 64K bytes, _but_ with the newer
processors they support the ELPM commands that can address all of flash.
Of course, you then have the problem of generating a pointer to it.  For
that, I use the GET_FAR_ADDRESS(var) function from the morepgmspace.h
file by Carlos Lamas -- It may be in avr-libc (he was supposed to
contribute it), but if not, email me directly and I'll send you a copy.
It's got the same license as avr-libc.

> But I do find it strange that the AT90USB1287 uses a 3 byte PC for 
> call/ret and reti, thought it only has 128K of flash.

There may be an explanation in the datasheet somewhere.  Sorry, I don't
mess with that processor.

Stu

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