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

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

[avr-gcc-list] BUG in WINAVR?


From: Trampas
Subject: [avr-gcc-list] BUG in WINAVR?
Date: Fri, 11 Aug 2006 21:02:31 -0400

I think I have found a bug in GCC for the AVR. 

Here is the snip of code

                        
                #define K_IN ((PIND>>2) & 0x01)
                while(K_IN==1)  //spin waiting on sync bit
                {
                        if (TCNT3L>250)
                        {
                                timeMs=timeMs+1;
                                TCNT3L=0;
                        }
                        if (timeMs>time_out_ms )
                        {
                                if (index==0)
                                {
                                        printf("Error: ISO get time
out\n\r");
                                }
                                ENABLE_INTERRUPTS();
                                return index;
                        }

                }

>From stepping though the code it appears that the test for K_IN==1 is done
at the end of the loop, and it appears that compiler thinks the end of the
loop is at the return. Thus the code times out each and every time I run it.


The only way I could debug the code was put a break point on the IN assembly
instruction and it appears to only be called once. 

FYI this is in the April 2006 build of WinAVR.

Trampas 






reply via email to

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