diff options
Diffstat (limited to 'cortex-m-rt')
-rw-r--r-- | cortex-m-rt/src/lib.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/cortex-m-rt/src/lib.rs b/cortex-m-rt/src/lib.rs index d4486e1..e0ddb76 100644 --- a/cortex-m-rt/src/lib.rs +++ b/cortex-m-rt/src/lib.rs @@ -215,3 +215,22 @@ macro_rules! exception { } }; } + +/// Macro to bind all the 240 interrupt handlers to the `DefaultHandler` exception handler. +/// +/// The use case for this macro is writing device agnostic programs +#[macro_export] +macro_rules! interrupts { + (DefaultHandler) => { + #[doc(hidden)] + #[link_section = ".vector_table.interrupts"] + #[no_mangle] + pub static __INTERRUPTS: [Option<unsafe extern "C" fn()>; 240] = [{ + extern "C" { + fn DefaultHandler(); + } + + Some(DefaultHandler) + }; 240]; + }; +} |