[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] do-while problem
From: |
Jesper Hansen |
Subject: |
Re: [avr-gcc-list] do-while problem |
Date: |
Wed, 5 Jun 2002 12:25:35 +0200 |
You need to declare ABC as 'volatile' !
/Jesper
----- Original Message -----
From: "Arne Lynge Madsen" <address@hidden>
To: <address@hidden>
Sent: Wednesday, June 05, 2002 11:33 AM
Subject: [avr-gcc-list] do-while problem
> 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
- [avr-gcc-list] do-while problem, Arne Lynge Madsen, 2002/06/14
- Re: [avr-gcc-list] do-while problem, Lee Mitchell, 2002/06/14
- Re: [avr-gcc-list] do-while problem, Alexander Popov, 2002/06/14
- Re: [avr-gcc-list] do-while problem,
Jesper Hansen <=
- Re: [avr-gcc-list] do-while problem, Vaclav Carnogursky, 2002/06/14
- Re: [avr-gcc-list] do-while problem, George Kalovyrnas, 2002/06/14
- [avr-gcc-list] ATmega8??, Chris Baugher, 2002/06/14