[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Save RAMPZ register in interrupt handler routines
From: |
Dmitry K. |
Subject: |
Re: [avr-gcc-list] Save RAMPZ register in interrupt handler routines |
Date: |
Tue, 29 Jan 2008 07:51:19 +1000 |
User-agent: |
KMail/1.5 |
Hi.
Alas, there is a circumstance which does preservation of register RAMPZ
obligatory. At least, obligatory by default. The 128KB-flash crystal has
semidocumented feature (IMHO, bug): at performance of reading from memory
the command 'LD R,Z+' modifies the RAMPZ register in case of wrapping. The
same is for other 3 combinations (ST, -Z). I have checked up it on the
AT90CAN128. Thus, absolutely harmless pure C code, like
while (*dst++ = *src++);
where both of a file are located in the SRAM, can destroy the RAMPZ if
one of arrays is located with edge.
Strictly speaking, absence of preservation of the RAMPZ (by default)
is a mistake which should be corrected in all Avr-gcc versions.
Let's notice, that in all known crystals the RAMPZ does not influence
in any way operations from the RAM.
Dmitry.