avr-chat
[Top][All Lists]
Advanced

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

FW: [avr-chat] C++ Interrupts


From: Ron Kreymborg
Subject: FW: [avr-chat] C++ Interrupts
Date: Thu, 17 Jan 2008 15:51:47 +1100

>> However, IMHO a more elegant C++ solution would be to define 
>> the interrupt
>> handler as a private function within the class. 
 
> Avr-gcc is expecting a fixed name for the vector. See avr-libc for how
> the ISR macro is defined.
>
> Note that there is no C++ maintainer for AVR GCC.
> 
> Eric Weddington

Sorry - I forgot to say the problem lies with C++ mangling function names,
so if the private class method is, say:

    void TIMER0_OVF_vect(void) __attribute__ ((signal, __INTR_ATTRS))
    {
        Flags |= TIMER0_OVERFLOW;   // indicate the event type
        TCNT0 = TIMER0_TIMEOUT;     // restart the timeout
    }

avr-gcc helpfully replies with:

Main.c(28): warning: '_ZN7cTimer011__vector_16Ev' appears to be a misspelled
signal handler

and of course does not bother to link the handler. Manually adding the line:


ISR_ALIAS(TIMER0_OVF_vect, _ZN7cTimer011__vector_16Ev);

after the class definition makes everything work, but my question is: is it
possible to do this without the cutting and pasting? 

Ron Kreymborg






reply via email to

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