aboutsummaryrefslogtreecommitdiff
path: root/macros/src/codegen.rs
diff options
context:
space:
mode:
Diffstat (limited to 'macros/src/codegen.rs')
-rw-r--r--macros/src/codegen.rs24
1 files changed, 16 insertions, 8 deletions
diff --git a/macros/src/codegen.rs b/macros/src/codegen.rs
index 83e50266..117bce8c 100644
--- a/macros/src/codegen.rs
+++ b/macros/src/codegen.rs
@@ -469,6 +469,11 @@ fn post_init(ctxt: &Context, app: &App, analysis: &Analysis) -> proc_macro2::Tok
let device = &app.args.device;
let nvic_prio_bits = quote!(#device::NVIC_PRIO_BITS);
for (name, exception) in &app.exceptions {
+ let name = if let Some(ref binds) = exception.args.binds {
+ binds
+ } else {
+ name
+ };
let priority = exception.args.priority;
exprs.push(quote!(assert!(#priority <= (1 << #nvic_prio_bits))));
exprs.push(quote!(p.SCB.set_priority(
@@ -1082,9 +1087,10 @@ fn exceptions(ctxt: &mut Context, app: &App, analysis: &Analysis) -> Vec<proc_ma
let attrs = &exception.attrs;
let stmts = &exception.stmts;
+ let kind = Kind::Exception(ident.clone());
let prelude = prelude(
ctxt,
- Kind::Exception(ident.clone()),
+ kind.clone(),
&exception.args.resources,
&exception.args.spawn,
&exception.args.schedule,
@@ -1095,7 +1101,7 @@ fn exceptions(ctxt: &mut Context, app: &App, analysis: &Analysis) -> Vec<proc_ma
let module = module(
ctxt,
- Kind::Exception(ident.clone()),
+ kind,
!exception.args.schedule.is_empty(),
!exception.args.spawn.is_empty(),
app,
@@ -1162,14 +1168,14 @@ fn interrupts(
let mut root = vec![];
let mut scoped = vec![];
- let device = &app.args.device;
for (ident, interrupt) in &app.interrupts {
let attrs = &interrupt.attrs;
let stmts = &interrupt.stmts;
+ let kind = Kind::Interrupt(ident.clone());
let prelude = prelude(
ctxt,
- Kind::Interrupt(ident.clone()),
+ kind.clone(),
&interrupt.args.resources,
&interrupt.args.spawn,
&interrupt.args.schedule,
@@ -1180,7 +1186,7 @@ fn interrupts(
root.push(module(
ctxt,
- Kind::Interrupt(ident.clone()),
+ kind,
!interrupt.args.schedule.is_empty(),
!interrupt.args.spawn.is_empty(),
app,
@@ -1217,9 +1223,6 @@ fn interrupts(
unsafe fn #alias() {
#[inline(always)]
#unsafety fn interrupt() {
- // check that this interrupt exists
- let _ = #device::interrupt::#ident;
-
#(#locals)*
#baseline_let
@@ -1995,6 +1998,11 @@ fn pre_init(ctxt: &Context, app: &App, analysis: &Analysis) -> proc_macro2::Toke
let device = &app.args.device;
let nvic_prio_bits = quote!(#device::NVIC_PRIO_BITS);
for (name, interrupt) in &app.interrupts {
+ let name = if let Some(ref binds) = interrupt.args.binds {
+ binds
+ } else {
+ name
+ };
let priority = interrupt.args.priority;
exprs.push(quote!(p.NVIC.enable(#device::Interrupt::#name);));
exprs.push(quote!(assert!(#priority <= (1 << #nvic_prio_bits));));