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

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

Re: [avr-libc-dev] vector section disable, vector redirection


From: Bob Paddock
Subject: Re: [avr-libc-dev] vector section disable, vector redirection
Date: Wed, 15 Aug 2007 10:32:09 -0400
User-agent: Opera Mail/9.10 (Win32)

On Tue, 14 Aug 2007 18:16:23 -0400, Jörg Diederich <address@hidden> wrote:

hello,
I've been working on a part of software which bases on another, already installed part of software at the avr. in order to use interrupt vectors in the part mentioned first
...
second, a redirection of all interrupts is performed. on every interrupt a table in SRAM is asked for the function pointer to jump to. a naive approach results in very much program space, as the avr-gcc pushed and pops all registers in an ISR with an call inside

I've had to do similar code on non-AVR processors, this is a different
approach you might consider, not sure how well it would work
out on the AVR, if it would work at all (due to stack issues):

In assembly language you call the same subroutine from
every vector.  All vectors end up taking you to the same
code.  Once you are in that single one spot you examine
the stack to see which vector got you to that spot.
You use that stack information to vector you someplace else
based on a table of function pointers, either dynamically
in RAM or fixed in program space.  You could have
multiple tables in program space and dynamically select
between them.

For anyone that is wondering why you would want to vector
to the someplace, just to figure out where to go,
it had to do with a system that used banked memory.
You never knew what bank you where in when an interrupt
arrived.  So the code that dealt with the banking was
at the start of the vector dispatcher, rather than
having it in dozens of different ISRs.





reply via email to

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