diff options
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-08-31 18:08:33 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-31 18:08:33 +0000 |
| commit | f46b22f797a728b0de1a6b14141c12ae1f016f8f (patch) | |
| tree | 35edbce452c808cafae49a535b2c15d4115ae5a0 /macros/src | |
| parent | 3ef650832abef24f76c402ede64d1248cf0d0772 (diff) | |
| parent | da1fd6166e893482f99f16714a1c718b445c9579 (diff) | |
Merge #522
522: validate unused dispatchers r=AfoHT a=japaric
closes #521
Co-authored-by: Jorge Aparicio <jorge@japaric.io>
Diffstat (limited to 'macros/src')
| -rw-r--r-- | macros/src/codegen/pre_init.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/macros/src/codegen/pre_init.rs b/macros/src/codegen/pre_init.rs index d3c4f54..69f16fe 100644 --- a/macros/src/codegen/pre_init.rs +++ b/macros/src/codegen/pre_init.rs @@ -31,6 +31,13 @@ pub fn codegen(app: &App, analysis: &Analysis, extra: &Extra) -> Vec<TokenStream let device = &extra.device; let nvic_prio_bits = quote!(#device::NVIC_PRIO_BITS); + // check that all dispatchers exists in the `Interrupt` enumeration regardless of whether + // they are used or not + let interrupt = util::interrupt_ident(); + for name in app.args.extern_interrupts.keys() { + stmts.push(quote!(let _ = #rt_err::#interrupt::#name;)); + } + let interrupt_ids = analysis.interrupts.iter().map(|(p, (id, _))| (p, id)); // Unmask interrupts and set their priorities @@ -45,8 +52,6 @@ pub fn codegen(app: &App, analysis: &Analysis, extra: &Extra) -> Vec<TokenStream // Compile time assert that this priority is supported by the device stmts.push(quote!(let _ = [(); ((1 << #nvic_prio_bits) - #priority as usize)];)); - // NOTE this also checks that the interrupt exists in the `Interrupt` enumeration - let interrupt = util::interrupt_ident(); stmts.push(quote!( core.NVIC.set_priority( #rt_err::#interrupt::#name, @@ -100,8 +105,6 @@ pub fn codegen(app: &App, analysis: &Analysis, extra: &Extra) -> Vec<TokenStream } )); } else { - // NOTE this also checks that the interrupt exists in the `Interrupt` enumeration - let interrupt = util::interrupt_ident(); stmts.push(quote!( core.NVIC.set_priority( #rt_err::#interrupt::#binds, |
