avr-libc-dev
[Top][All Lists]
Advanced

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

Re: [avr-libc-dev] LPM instructions in optimized code causes unintended


From: Wouter van Gulik
Subject: Re: [avr-libc-dev] LPM instructions in optimized code causes unintended behavior in execution
Date: Wed, 16 Jun 2010 22:35:53 +0200

----- Oorspronkelijk bericht -----
> As Thomas Carsten Franke wrote:
>
> > I did not restored the NVM CMD because I
> > didn't know that it would has to be.
>
> This is correct.   We recently added a note to the documentation in the
> header file <avr/pgmspace.h> telling that on Xmega devices, all the
> functions will only work as designed if NVM_CMD is set to 0x00 (NOP).
>
> As you had to manually take care to set NVM_CMD to something else
> before, I think it's only fair to leave the job to the programmer to
> restore it afterwards.
>

Although true, I rather think this is a GCC bug. The avr instruction 
documentation says LPM R31, Z+ has undefined results. In the example it was oke 
to use LPM R31, Z.
Since GCC does not know LPM, I think this might be easy to spot in the GCC code 
or relevant patch.

Hth,

Wouter


reply via email to

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