[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] [Bug] Initialization for _delay_loop_2 Optimized Out
From: |
Dave Hansen |
Subject: |
Re: [avr-gcc-list] [Bug] Initialization for _delay_loop_2 Optimized Out |
Date: |
Thu, 24 Jul 2003 14:37:36 -0400 |
As "Dave Hansen" <address@hidden> wrote:
[...]
>Which, again, is the whole point of the bug report. I haven't tried it
(I
>don't have the time right now), but I suspect the following:
>
> #include <avr/delay.h>
> int main (void)
> {
> while(1)
> _delay_loop_2(3);
>
> return 0;
> }
>
>Would generate incorrect code.
For me, it works, and generates the following code:
..
.L6:
ldi r24,lo8(3)
ldi r25,hi8(3)
/* #APP */
1: sbiw r24,1
brne 1b
/* #NOAPP */
rjmp .L6
Interesting. Here are the last few lines of the .LSS file that gets
generated when I build the code:
0000008e <main>:
#include <avr/delay.h>
int main (void)
{
8e: cf e5 ldi r28, 0x5F ; 95
90: d8 e0 ldi r29, 0x08 ; 8
92: de bf out 0x3e, r29 ; 62
94: cd bf out 0x3d, r28 ; 61
/* 16-bit count, 4 cycles/loop */
static inline void
_delay_loop_2(unsigned int __count)
{
asm volatile (
96: 01 97 sbiw r24, 0x01 ; 1
98: f1 f7 brne .-4 ; 0x96
9a: fd cf rjmp .-6 ; 0x96
Notice the brne and the rjmp target the same location. So it doesn't work
for me. What version are you using?
Regards,
-=Dave
_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail
- Re: [avr-gcc-list] [Bug] Initialization for _delay_loop_2 Optimized Out,
Dave Hansen <=