mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-23 20:22:51 +01:00
Add check again
This commit is contained in:
parent
ac4a3edf90
commit
c85a4e34e6
3 changed files with 13 additions and 23 deletions
|
@ -1,18 +1,12 @@
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|
||||||
use proc_macro2::Span;
|
use crate::syntax::ast::App;
|
||||||
use rtic_syntax::{analyze::Analysis, ast::App};
|
use syn::parse;
|
||||||
use syn::{parse, Path};
|
|
||||||
|
|
||||||
pub struct Extra {
|
pub fn app(app: &App) -> parse::Result<()> {
|
||||||
pub device: Path,
|
|
||||||
pub peripherals: bool,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn app(app: &App, _analysis: &Analysis) -> parse::Result<Extra> {
|
|
||||||
// Check that external (device-specific) interrupts are not named after known (Cortex-M)
|
// Check that external (device-specific) interrupts are not named after known (Cortex-M)
|
||||||
// exceptions
|
// exceptions
|
||||||
for name in app.args.extern_interrupts.keys() {
|
for name in app.args.dispatchers.keys() {
|
||||||
let name_s = name.to_string();
|
let name_s = name.to_string();
|
||||||
|
|
||||||
match &*name_s {
|
match &*name_s {
|
||||||
|
@ -41,7 +35,7 @@ pub fn app(app: &App, _analysis: &Analysis) -> parse::Result<Extra> {
|
||||||
.collect::<HashSet<_>>();
|
.collect::<HashSet<_>>();
|
||||||
|
|
||||||
let need = priorities.len();
|
let need = priorities.len();
|
||||||
let given = app.args.extern_interrupts.len();
|
let given = app.args.dispatchers.len();
|
||||||
if need > given {
|
if need > given {
|
||||||
let s = {
|
let s = {
|
||||||
format!(
|
format!(
|
||||||
|
@ -72,15 +66,5 @@ pub fn app(app: &App, _analysis: &Analysis) -> parse::Result<Extra> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(device) = app.args.device.clone() {
|
Ok(())
|
||||||
Ok(Extra {
|
|
||||||
device,
|
|
||||||
peripherals: app.args.peripherals,
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
Err(parse::Error::new(
|
|
||||||
Span::call_site(),
|
|
||||||
"a `device` argument must be specified in `#[rtic::app]`",
|
|
||||||
))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ use std::{env, fs, path::Path};
|
||||||
|
|
||||||
mod analyze;
|
mod analyze;
|
||||||
mod bindings;
|
mod bindings;
|
||||||
|
mod check;
|
||||||
mod codegen;
|
mod codegen;
|
||||||
mod syntax;
|
mod syntax;
|
||||||
|
|
||||||
|
@ -61,6 +62,11 @@ pub fn app(args: TokenStream, input: TokenStream) -> TokenStream {
|
||||||
Ok(x) => x,
|
Ok(x) => x,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
match check::app(&app) {
|
||||||
|
Err(e) => return e.to_compile_error().into(),
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
|
||||||
let analysis = analyze::app(analysis, &app);
|
let analysis = analyze::app(analysis, &app);
|
||||||
|
|
||||||
let ts = codegen::app(&app, &analysis);
|
let ts = codegen::app(&app, &analysis);
|
||||||
|
|
|
@ -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
|
--> ui/extern-interrupt-not-enough.rs:17:8
|
||||||
|
|
|
|
||||||
17 | fn a(_: a::Context) {}
|
17 | fn a(_: a::Context) {}
|
||||||
|
|
Loading…
Reference in a new issue