Quoting Anatoly Sokolov <[EMAIL PROTECTED]>:
Hello.
Hi,
For FLASH memory access for 128KB avr-libc have pgm_read_*_far macros.
These macros modify RAMPZ register and is non-reenterable. Using these
macros in main loop/interrupts code can cause collisions of access to FLASH
memory.
For solving of this problem I offer save RAMPZ register in interrupt
handler routines for 128KB devices ('avr31' and 'avr51' architectures). The
'-mno-save-rampz' switch restore old behaviour.
Wouldn't it be better to just disable interrupts / restore interrutps
in the macros themselves? Or maybe just create _atomic variants that do
this, or even just document that if you use pgm_read_*_far macros
inside interrupts you have to make sure that in the main code you do
that from atomic sections or at least with interrupts disabled...
Otherwise you will be paying a latency penalty on every interrupt call
even when you don't need to (and that is probably most of the time).
--
Paulo Marques
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
_______________________________________________
AVR-GCC-list mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list