aboutsummaryrefslogtreecommitdiff
path: root/cortex-m-rt
diff options
context:
space:
mode:
authorGravatar Jorge Aparicio <jorge@japaric.io> 2018-04-24 20:51:10 +0200
committerGravatar Jorge Aparicio <jorge@japaric.io> 2018-04-24 20:51:10 +0200
commitd54f8bb52f9d4f38544d448713f047a63ce5fb9c (patch)
tree150ad894e774016f0f98165b8850498baab7c2f3 /cortex-m-rt
parent857eb6579852b1578bcf9e8743ff9ba4a9276e5b (diff)
downloadcortex-m-d54f8bb52f9d4f38544d448713f047a63ce5fb9c.tar.gz
cortex-m-d54f8bb52f9d4f38544d448713f047a63ce5fb9c.tar.zst
cortex-m-d54f8bb52f9d4f38544d448713f047a63ce5fb9c.zip
add macro to bind all interrupts to DefaultHandler
Diffstat (limited to 'cortex-m-rt')
-rw-r--r--cortex-m-rt/src/lib.rs19
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];
+ };
+}