[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] ATMega128 RAMPZ behaviour changed ?
From: |
E. Weddington |
Subject: |
Re: [avr-gcc-list] ATMega128 RAMPZ behaviour changed ? |
Date: |
Mon, 15 Dec 2003 17:26:34 -0700 |
On 16 Dec 2003 at 13:06, Simon Eatough wrote:
> Hi
> According to the ATMega128 documentation, bit 0 of RAMPZ selects the high or
> low page access of Z pointer, with the other bits of RAMPZ unused. However
> it appears that setting RAMPZ to 3 causes elpm return garbage. This
> behaviour seems to break pgm_read_byte_far(). Anybody else noticed this ?.
pgm_read_byte_far() accepts a uint32_t, which of course can be a value that
extends beyond the flash address range of a mega128.
The disadvantage to limiting the allowable range of addresses in
pgm_read_byte_far to those of the mega128 is that when the mega256 is
released, then pgm_read_byte_far will no longer work. And, yes, I've heard
that there will be such a beast as the mega256.
So the current response is: don't do that. Test your addresses before you
use them as a parameter to pgm_read_byte_far().