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

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

Re: [avr-gcc-list] Save RAMPZ register in interrupt handler routines


From: Paulo Marques
Subject: Re: [avr-gcc-list] Save RAMPZ register in interrupt handler routines
Date: Sun, 27 Jan 2008 16:27:10 +0000
User-agent: Internet Messaging Program (IMP) H3 (4.1.2)

Quoting Anatoly Sokolov <address@hidden>:

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.





reply via email to

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