[Top][All Lists]

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

Re: [avr-libc-dev] Re: [avr-gcc-list] Two interrupts one function?

From: Joerg Wunsch
Subject: Re: [avr-libc-dev] Re: [avr-gcc-list] Two interrupts one function?
Date: Mon, 15 May 2006 22:25:28 +0200
User-agent: Mutt/1.5.11

As Eric Weddington wrote:

> >you could insert in your irq routine the line

> > asm (".global __vector_3\n\t .equ __vector_3, __vector_13");

> >Where __vector_13 is the main name of your irq function and
> >__vector_3 is the alias that you are newly defining. This way, you
> >will be avoiding the unnecessary jump.

Another option is to pass this to the linker as a --defsym option.

> Would it be worth it to work this up in a C macro and add it to
> avr-libc?

I'd be more happy if AVR-GCC implemented the
__attribute__((alias(...))).  It would allow something like

#define __ALIAS(tgt) __attribute__((alias(#tgt)))
#define ISR_ALIAS(vec, tgt) \
void vec(void) __ALIAS(tgt)

        PORTB = 42;

ISR_ALIAS(INT1_vect, INT0_vect);

For the curious, the above will expand to:

void __vector_1 (void) __attribute__ ((signal)); void __vector_1 (void)
 (*(volatile uint8_t *)((0x18) + 0x20)) = 42;

void __vector_2(void) __attribute__((alias("__vector_1")));

Alas, when trying to compile it:

% avr-gcc -mmcu=atmega128 -c foo.c
foo.c:13: error: alias definitions not supported in this configuration

cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)

reply via email to

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