avr-libc-dev
[Top][All Lists]
Advanced

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

Re: [avr-libc-dev] Can main be interrupt or signal?


From: Christian Ludlam
Subject: Re: [avr-libc-dev] Can main be interrupt or signal?
Date: Sun, 13 Feb 2005 23:48:29 GMT
User-agent: Messenger-Pro/1.00c (MsgServe/1.00a) (RISC-OS/5.08) POPstar/2.05

On 13 Feb Paul Schlie wrote:

> > interrupt. The way interrupts work presently is to declare functions that
> > carry the name __vector01 or similar. If functions with this name are
> > declared, they override the weak symbols of the .crt object files that
> > point to a default IRQ function. Since main is supposed to be named
> > "main" one would need to violate gcc in order to make shure that main
> > could be called by calling vectorXX().
> > 
> > IIUC you could safely assume that main does not carry the interrupt or
> > signal attributes.
> 
> So how ideally could one define an arbitrary interrupt vector to invoke
> main(), as doing a soft restart upon some particular event doesn't seem
> like an unreasonable thing to want to do?

Don't define the handler :)

By default interrupts that don't have handlers cause a reset. This isn't the
same as calling main, though, since it also performs the libc initialisation
and sets up the stack.

In general main isn't expected to return so its use as an interrupt handler
is somewhat limited, I'd have thought.

-- 
Christian Ludlam
address@hidden




reply via email to

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