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

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

[avr-gcc-list] Help: Weirdness with interrupts, ending up in unreachabl


From: Dan Lyke
Subject: [avr-gcc-list] Help: Weirdness with interrupts, ending up in unreachable code
Date: Tue, 25 Nov 2003 16:43:31 -0800

I'm just about to get to disassembling code to see if I can figure out
what's going on, but I was hoping not to have to dive into the
assembly. So pardon if this plea is a little premature.

I have the latest of various tools from the Debian "unstable" release:

ii  uisp           20030618-2     Micro In-System Programmer for Atmel's AVR M
ii  avr-libc       20030512cvs-1  Standard C library for Atmel AVR development
ii  binutils-avr   2.13.90.1.0305 Binary utilities that support Atmel's AVR ta
ii  gcc-avr        3.2.90.2003051 The GNU C compiler (cross compiler for avr).

I'm using an ATMega8515 at 8MHz, with polled access to the USART.

In my main(), I enable timer 0 with:


        TCCR0 = (1<<CS02)|(1<<CS00);
        TCNT0 = 1;
        OCR0 = 1;
        TIFR = (1<<TOIE0);
        TIMSK = (1<<TOIE0);

Because I can't find "timer_enable_int" in any of my libraries, and I
have:

__vector_7() // SIGNAL(_SIG_OVERFLOW0)
{
        if (slowdown)
        {
                slowdown--;
        }
        TCNT0 = 128; // will be variable once I get this working
        sei();
}

To process it. I do get:

   rigcontrol.c:107: warning: return type defaults to `int'
   rigcontrol.c: In function `__vector_7':
   rigcontrol.c:114: warning: control reaches end of non-void function

When I compile with "-Wall", and the "sei()" also appears
necessary. In my main() I have a check for input on the USART, a
moderately large "switch" statement state machine, and a check of the
"slowdown" variable, if it's zero then I handle some motor stuff and
reset it.

If I enable that interrupt, I get random resets, and execution often
ends up in the "default" case of that state machine, where it sends
out the current state of the system, all of which is valid (ie: the
value that was switch()ed on has a case).

Compilation is with:

avr-gcc -Wall -g -mmcu=atmega8515 -I/usr/avr/include/ -c -o obj/rigcontrol.o 
rigcontrol.c

Any suggestions? I'm going nuts here. At this point I've rearranged my
code enough to track this down that I'd be happy just being able to
check a real-time clock in that big loop in main. In fact maybe I can
just disable the interrupt and check the timer value...

Dan



reply via email to

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