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

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

Re: [avr-gcc-list] do-while problem


From: Vaclav Carnogursky
Subject: Re: [avr-gcc-list] do-while problem
Date: Wed, 05 Jun 2002 13:21:22 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0rc2) Gecko/20020510

Hello,

There is no problem with assembler,  you just forgot 'volatile' directive
in declaration of ABC variable.
Should be:

volatile uint8_t ABC ;

Vasso

Arne Lynge Madsen wrote:

Hi,

I just realized that there migth be a bug in the generated assempler...


do
{
 } while (ABC == 0x01 );

166: 80 91 60 00    lds r24, 0x0060
16a: 81 30                cpi r24, 0x01 ; 1
16c: f1 f3                    breq .-4       ; 0x16a

ABC is updated by an interrupt routine. breq.-4 only jumps back to the
cpi statement, so the updated ABC is not taken into account. Loops
forever!


do
{
 } while (somefunction() != 0);

132: 86 d1        rcall .+780     ; 0x440
134: 88 23        and r24, r24
136: e9 f7        brne .-6       ; 0x132

somefunction() returns ABC. Here brne.-6 jumps back to rcall. It works!

I currently use these packages:
binutils-2.11.2
gcc-3.0
avr-libc-20011208

Questions:
Where is this error located? binutils, gcc or avr-libc?
Could it be corrected in later versions, if so which one?
Where to report the error?

Best regards
Arne




avr-gcc-list at http://avr1.org

.




avr-gcc-list at http://avr1.org



reply via email to

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