On 30 May 2014, at 2:01 pm, Chuck McManis <[email protected]> wrote:

> What I really wanted was something like nvic_attach_interrupt(USART6, 
> uart_interrupts); I could give it a signature like nvic_attach_interrupt(enum 
> NVIC_SOURCE src, (void)(*vector)(void)) and do some type checking of the 
> validity of the interrupt configuration at compile time. And I wouldn't have 
> to remember the exact names for the isr's as defined in the vector.o binary. 

Instead you have to remember the exact names for the interrupt manifest 
constants. It’s no better.

> I was looking at plumbing it directly, by pre-filling all IRQ vectors with 
> the same handler function, but the Cortex M doesn't seem to put the IRQ 
> source on the stack so what you probably end up doing is something like this 
> at say IRQ0 -> irq0_isr and in the startup file it has
> 
> void
> irq0_isr() {
>     *(ram_vectors[0])();
> }
> 
> Which will add another call frame to the stack. Or one could just branch to 
> the address held in the table using assembly but being careful not to screw 
> up the LR value on the stack (thus leaving exception mode early). 

You can get the current vector number from the IPSR.

This approach costs you some interrupt latency, and it costs you precious RAM.

> The challenge is of course that that with the exception vectors in flash you 
> can't just poke them to change them, you need something in RAM to do that, 
> and moving the exception table to RAM using the SCB makes other issues (like 
> what if a wild pointer overwrites the reset handler? Etc) 

The reset vector / initial stack are the one thing you *don’t* care about, 
since they can’t be relocated.

> On even days I think this will be really helpful and on odd days I think its 
> overkill even for the psuedo OS I'm building because the system configuration 
> will be largely static. 

For almost every application locm3 is useful for, it’s a bad idea. Learn to 
type. 8)

 = Mike


------------------------------------------------------------------------------
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
_______________________________________________
libopencm3-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libopencm3-devel

Reply via email to