[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] Volatile bad compiled while
From: |
max2009tiny |
Subject: |
[avr-gcc-list] Volatile bad compiled while |
Date: |
Wed, 25 Nov 2009 22:57:10 -0800 (PST) |
Hi everybody. I make project on Tiny2313 and use
volatile register unsigned char lastrec asm("r8")
and lastrec is modified on rs232 rx isr.
When compile little function
__attribute__ ((noinline)) void waitACK(u08 cmack)
{
while(cmack!=lastrec) ; //wait for reply request
}
compiler make bad asm
a0: 98 2d mov r25, r8
a2: 98 17 cp r25, r24
a4: e9 f7 brne .-4 ; 0xa2 <waitACK>
To avoid i change while to asm as follow, but i need know why this gcc make.
Thanks.
000000a0 <waitACK>:
__attribute__ ((noinline)) void waitACK(u08 cmack)
{
// cmd to wait is in txcmd
// use std ack packet 0x4 0x0 0x2 0xresult 0xtxcmd 0xcksum
asm(" mov r25, r8 ;\n cp r25, r24 ;\n brne .-6 ;");
a0: 98 2d mov r25, r8
a2: 98 17 cp r25, r24
a4: e9 f7 brne .-6 ; 0xa0 <waitACK>
//while(cmack!=lastrec) ; //wait for reply request
}
a6: 08 95 ret
--
View this message in context:
http://old.nabble.com/Volatile-bad-compiled-while-tp26513165p26513165.html
Sent from the AVR - gcc mailing list archive at Nabble.com.