aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--macros/src/check.rs28
-rw-r--r--macros/src/lib.rs6
-rw-r--r--ui/extern-interrupt-not-enough.stderr2
3 files changed, 13 insertions, 23 deletions
diff --git a/macros/src/check.rs b/macros/src/check.rs
index b0ad6f87..312b84d5 100644
--- a/macros/src/check.rs
+++ b/macros/src/check.rs
@@ -1,18 +1,12 @@
use std::collections::HashSet;
-use proc_macro2::Span;
-use rtic_syntax::{analyze::Analysis, ast::App};
-use syn::{parse, Path};
+use crate::syntax::ast::App;
+use syn::parse;
-pub struct Extra {
- pub device: Path,
- pub peripherals: bool,
-}
-
-pub fn app(app: &App, _analysis: &Analysis) -> parse::Result<Extra> {
+pub fn app(app: &App) -> parse::Result<()> {
// Check that external (device-specific) interrupts are not named after known (Cortex-M)
// exceptions
- for name in app.args.extern_interrupts.keys() {
+ for name in app.args.dispatchers.keys() {
let name_s = name.to_string();
match &*name_s {
@@ -41,7 +35,7 @@ pub fn app(app: &App, _analysis: &Analysis) -> parse::Result<Extra> {
.collect::<HashSet<_>>();
let need = priorities.len();
- let given = app.args.extern_interrupts.len();
+ let given = app.args.dispatchers.len();
if need > given {
let s = {
format!(
@@ -72,15 +66,5 @@ pub fn app(app: &App, _analysis: &Analysis) -> parse::Result<Extra> {
}
}
- if let Some(device) = app.args.device.clone() {
- Ok(Extra {
- device,
- peripherals: app.args.peripherals,
- })
- } else {
- Err(parse::Error::new(
- Span::call_site(),
- "a `device` argument must be specified in `#[rtic::app]`",
- ))
- }
+ Ok(())
}
diff --git a/macros/src/lib.rs b/macros/src/lib.rs
index 7729dcbe..1bda8d2f 100644
--- a/macros/src/lib.rs
+++ b/macros/src/lib.rs
@@ -10,6 +10,7 @@ use std::{env, fs, path::Path};
mod analyze;
mod bindings;
+mod check;
mod codegen;
mod syntax;
@@ -61,6 +62,11 @@ pub fn app(args: TokenStream, input: TokenStream) -> TokenStream {
Ok(x) => x,
};
+ match check::app(&app) {
+ Err(e) => return e.to_compile_error().into(),
+ _ => {}
+ }
+
let analysis = analyze::app(analysis, &app);
let ts = codegen::app(&app, &analysis);
diff --git a/ui/extern-interrupt-not-enough.stderr b/ui/extern-interrupt-not-enough.stderr
index d8c01b9a..6f28b7ad 100644
--- a/ui/extern-interrupt-not-enough.stderr
+++ b/ui/extern-interrupt-not-enough.stderr
@@ -1,4 +1,4 @@
-error: not enough interrupts to dispatch all software and async tasks (need: 1; given: 0) - one interrupt is needed per priority and sync/async task
+error: not enough interrupts to dispatch all software tasks (need: 1; given: 0)
--> ui/extern-interrupt-not-enough.rs:17:8
|
17 | fn a(_: a::Context) {}