diff options
Diffstat (limited to 'include/isr_vector.h')
-rw-r--r-- | include/isr_vector.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/include/isr_vector.h b/include/isr_vector.h index bd5786a..65359a5 100644 --- a/include/isr_vector.h +++ b/include/isr_vector.h @@ -10,6 +10,7 @@ void default_irq_handler(void); /** Weakly defined interrput service routine vectors. These just alias to * default_irq_handler if not overridden. */ +void irq_on_reset(void); void irq_on_nmi(void); void irq_on_exc(void); void irq_on_systick(void); @@ -33,4 +34,20 @@ void irq_on_uart2(void); void irq_on_uart3(void); void irq_on_wdog_bat(void); -#define IRQ(name) void __attribute__((__section__(".isr_vector"))) name(void) +/* + * Macro to define an interrput service routine. + */ +#define IRQ(name) \ + /* Real interrupt service routine. This contains most of the code to handle \ + * the interrupt. */ \ + static void __attribute__((noinline)) _real__irq_on_##name(void); \ + /* The actual routine that's jumped to. It's soley responsible for jumping \ + * to the real handler (which requires multiple instructions because it's a \ + * long jump). This stub is compiled and linked promimal to the ISR vector. \ + */ \ + void __attribute__((interrupt)) \ + __attribute__((__section__(".isr_vector"))) irq_on_##name(void) \ + { \ + _real__irq_on_##name(); \ + } \ + static void __attribute__((noinline)) _real__irq_on_##name(void) |