Skip to content
This repository has been archived by the owner on Jan 24, 2022. It is now read-only.

Commit

Permalink
Change exception enum discovery in macros
Browse files Browse the repository at this point in the history
Similar to the way the cortex-m-rt macros
discover enum variants for interrupts, we update
the #[exception] macro to search for exception
enum variants that may not directly come from
the cortex-m-rt crate. The change allows
developers who are interested in making their
own runtime crates re-use the macros in this
crate, and provide their own implementation of
the exception variants.
  • Loading branch information
mciantyre committed Nov 17, 2019
1 parent 7050c73 commit 519d46a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 1 addition & 2 deletions macros/src/lib.rs
Expand Up @@ -462,10 +462,9 @@ pub fn exception(args: TokenStream, input: TokenStream) -> TokenStream {
#[export_name = #ident_s]
#(#attrs)*
pub #unsafety extern "C" fn #hash() {
extern crate cortex_m_rt;

// check that this exception actually exists
cortex_m_rt::Exception::#ident;
exception::#ident;

#(#vars)*

Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Expand Up @@ -592,6 +592,8 @@ pub enum Exception {
SysTick,
}

pub use self::Exception as exception;

extern "C" {
fn NonMaskableInt();

Expand Down

0 comments on commit 519d46a

Please sign in to comment.