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: Thomas Carsten Franke
Subject: Re: [avr-libc-dev] LPM instructions in optimized code causes unintended behavior in execution
Date: Thu, 17 Jun 2010 10:15:00 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1.9) Gecko/20100317 Lightning/1.0b1 Thunderbird/3.0.4

Am 17.06.2010 09:38, schrieb Wouter van Gulik:
> Wouter van Gulik schreef:
>> Joerg Wunsch schreef:
>>> As Wouter van Gulik wrote:
>>>
>>>>> IMHO, the respective code is hand-crafted asm code in avr-libc.
>>>> Are you sure? The code is about a jump table, is that in avr-libc?
>>>
>>> Errm, you are right...
>>
>> We should probably file a bug report at binutils as well. gas is
>> excepting an 'illegal' instruction. This could mean gcc/gas also
>> happily generates the undefined LD files?
>>

Just right now I added a problem report to gcc 4.3.3 version describing
the problem. There are more points I suggest that could fail, although
I'm now sure about it. The GCC-generated usage of LPM without setting
the NVM-CMD accordingly (restore old and restore) is strange but o.k. if
the precondition is known you can work around. Means that NVM_CMD->xxx,
LPM, NMV_CMD->NOOP has to be protected manually for any interrupts
because if such code is generated for switch statements within interrupt
routines - this fails.
Another point is (but I'm not so familar with NMV controller) that there
seems to be no check for busy NVM controller. What happens if the
controller is currently busy for writing? Normally everywhere is written
you have to check for the busy flag before the NVM controller might be used.

Unfortunately I'm currently not able to write any further tests for it
due to work load :-( - maybe I will do so later on - maybe s.o. of gcc
will clarify the issue in very near future.

> 
> I meant instruction instead of files. No coffee yet...
> 
> Wouter
> 
> _______________________________________________
> AVR-libc-dev mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/avr-libc-dev
> 




reply via email to

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