------- Additional Comments From j dot gnu at uriah dot heep dot sax dot de  
2005-03-03 22:49 -------
(In reply to comment #9)

> There has been the suggestion to 1.) distinguish between pointer variables 
> that 
> are marked "volatile" and pointer variables that are not declared "volatile" 
> and 2.) disable all post increment operations for such variables.  
> In my opinion, this would not really be a clean solution, since IIUC,  
> "volatile uint16_t pointer" is meant to be used for a pointer that, e.g. 
> could 
> be altered by an IRQ function, and the key-word "volatile" not meant to be 
> used 
> for classifying the variable the pointer is refering to. In fact, in the 
> specific case no one would require the pointer no to be hold in a register 
> variable. 

(It should be noted that this suggestion originally came from Marek
Michalkiewicz, one of the original developers who ported GCC to the AVR.)

While you're technically right on this, the point was that for a pointer
variable marked "volatile", sacrificing the post-increment addressing mode
would not hurt at all, as by qualifying it "volatile" one already essentially
gave up any and all expectations about getting the most effective code
generated for it.  OTOH, access to all IO resources is always done through
volatile-qualified pointers, so this solution still appears to be the most
logical one.

Either way, I agree the behaviour should be documented.

This is not to say the suggested macro doesn't have a valid point, too.  But
the wording of Björn's reply sounded a bit too dramatic in my opinion, in
particular to those GCC developers who aren't familiar with the AVR.  To me,
Marek's suggestion (which is even supported by his patch that is known to
work for many people) still sounds like the best compromise.

Btw., it's not only accessing timer registers.  Atmel requires the high-byte
first access for a few other 16-bit IO registers as well (IIRC e.g the ADC
registers).

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20288

Reply via email to