mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-23 20:22:51 +01:00
adapt to changes in rtfm-syntax
This commit is contained in:
parent
2f4f185778
commit
0e146f8d11
11 changed files with 28 additions and 14 deletions
|
@ -5,20 +5,26 @@ matrix:
|
||||||
# NOTE used to build docs on successful merges to master
|
# NOTE used to build docs on successful merges to master
|
||||||
- env: TARGET=x86_64-unknown-linux-gnu
|
- env: TARGET=x86_64-unknown-linux-gnu
|
||||||
|
|
||||||
|
# MSRV
|
||||||
|
- env: TARGET=thumbv7m-none-eabi
|
||||||
|
rust: 1.36.0
|
||||||
|
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
|
||||||
|
|
||||||
- env: TARGET=thumbv6m-none-eabi
|
- env: TARGET=thumbv6m-none-eabi
|
||||||
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
|
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
|
||||||
|
|
||||||
- env: TARGET=thumbv7m-none-eabi
|
- env: TARGET=thumbv7m-none-eabi
|
||||||
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
|
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
|
||||||
|
|
||||||
|
# compile-fail tests
|
||||||
- env: TARGET=x86_64-unknown-linux-gnu
|
- env: TARGET=x86_64-unknown-linux-gnu
|
||||||
rust: nightly
|
rust: nightly
|
||||||
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
|
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
|
||||||
|
|
||||||
|
# heterogeneous multi-core support
|
||||||
- env: TARGET=thumbv6m-none-eabi
|
- env: TARGET=thumbv6m-none-eabi
|
||||||
rust: nightly
|
rust: nightly
|
||||||
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
|
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
|
||||||
|
|
||||||
- env: TARGET=thumbv7m-none-eabi
|
- env: TARGET=thumbv7m-none-eabi
|
||||||
rust: nightly
|
rust: nightly
|
||||||
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
|
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
|
||||||
|
|
|
@ -15,9 +15,9 @@ version = "0.5.0-alpha.1"
|
||||||
proc-macro = true
|
proc-macro = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
proc-macro2 = "0.4.30"
|
proc-macro2 = "1"
|
||||||
quote = "0.6.12"
|
quote = "1"
|
||||||
syn = "0.15.34"
|
syn = "1"
|
||||||
|
|
||||||
[dependencies.rtfm-syntax]
|
[dependencies.rtfm-syntax]
|
||||||
git = "https://github.com/japaric/rtfm-syntax"
|
git = "https://github.com/japaric/rtfm-syntax"
|
||||||
|
|
|
@ -169,9 +169,10 @@ pub fn app<'a>(app: &'a App, analysis: &Analysis) -> parse::Result<Extra<'a>> {
|
||||||
peripherals = if *x { Some(0) } else { None }
|
peripherals = if *x { Some(0) } else { None }
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomArg::UInt(x) if app.args.cores != 1 => {
|
CustomArg::UInt(s) if app.args.cores != 1 => {
|
||||||
peripherals = if *x < u64::from(app.args.cores) {
|
let x = s.parse::<u8>().ok();
|
||||||
Some(*x as u8)
|
peripherals = if x.is_some() && x.unwrap() < app.args.cores {
|
||||||
|
Some(x.unwrap())
|
||||||
} else {
|
} else {
|
||||||
return Err(parse::Error::new(
|
return Err(parse::Error::new(
|
||||||
k.span(),
|
k.span(),
|
||||||
|
|
|
@ -126,7 +126,7 @@ pub fn app(app: &App, analysis: &Analysis, extra: &Extra) -> TokenStream2 {
|
||||||
|
|
||||||
#(#root)*
|
#(#root)*
|
||||||
|
|
||||||
#(#mod_resources)*
|
#mod_resources
|
||||||
|
|
||||||
#(#root_hardware_tasks)*
|
#(#root_hardware_tasks)*
|
||||||
|
|
||||||
|
|
|
@ -115,6 +115,7 @@ pub fn codegen(
|
||||||
let stmts = &task.stmts;
|
let stmts = &task.stmts;
|
||||||
let section = util::link_section("text", core);
|
let section = util::link_section("text", core);
|
||||||
// XXX shouldn't this have a cfg_core?
|
// XXX shouldn't this have a cfg_core?
|
||||||
|
let locals_pat = locals_pat.iter();
|
||||||
user_tasks.push(quote!(
|
user_tasks.push(quote!(
|
||||||
#(#attrs)*
|
#(#attrs)*
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
|
|
|
@ -58,6 +58,7 @@ pub fn codegen(
|
||||||
let context = &idle.context;
|
let context = &idle.context;
|
||||||
let stmts = &idle.stmts;
|
let stmts = &idle.stmts;
|
||||||
let section = util::link_section("text", core);
|
let section = util::link_section("text", core);
|
||||||
|
let locals_pat = locals_pat.iter();
|
||||||
let user_idle = Some(quote!(
|
let user_idle = Some(quote!(
|
||||||
#(#attrs)*
|
#(#attrs)*
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
|
@ -70,6 +71,7 @@ pub fn codegen(
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
|
let locals_new = locals_new.iter();
|
||||||
let call_idle = quote!(#name(
|
let call_idle = quote!(#name(
|
||||||
#(#locals_new,)*
|
#(#locals_new,)*
|
||||||
#name::Context::new(&rtfm::export::Priority::new(0))
|
#name::Context::new(&rtfm::export::Priority::new(0))
|
||||||
|
|
|
@ -83,6 +83,7 @@ pub fn codegen(
|
||||||
let attrs = &init.attrs;
|
let attrs = &init.attrs;
|
||||||
let stmts = &init.stmts;
|
let stmts = &init.stmts;
|
||||||
let section = util::link_section("text", core);
|
let section = util::link_section("text", core);
|
||||||
|
let locals_pat = locals_pat.iter();
|
||||||
let user_init = Some(quote!(
|
let user_init = Some(quote!(
|
||||||
#(#attrs)*
|
#(#attrs)*
|
||||||
#cfg_core
|
#cfg_core
|
||||||
|
@ -102,6 +103,7 @@ pub fn codegen(
|
||||||
const_app = Some(constructor);
|
const_app = Some(constructor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let locals_new = locals_new.iter();
|
||||||
let call_init =
|
let call_init =
|
||||||
Some(quote!(let late = #name(#(#locals_new,)* #name::Context::new(core.into()));));
|
Some(quote!(let late = #name(#(#locals_new,)* #name::Context::new(core.into()));));
|
||||||
|
|
||||||
|
|
|
@ -168,6 +168,7 @@ pub fn codegen(
|
||||||
let attrs = &task.attrs;
|
let attrs = &task.attrs;
|
||||||
let cfgs = &task.cfgs;
|
let cfgs = &task.cfgs;
|
||||||
let stmts = &task.stmts;
|
let stmts = &task.stmts;
|
||||||
|
let locals_pat = locals_pat.iter();
|
||||||
user_tasks.push(quote!(
|
user_tasks.push(quote!(
|
||||||
#(#attrs)*
|
#(#attrs)*
|
||||||
#(#cfgs)*
|
#(#cfgs)*
|
||||||
|
|
|
@ -3,13 +3,13 @@ use core::sync::atomic::{AtomicUsize, Ordering};
|
||||||
use proc_macro2::{Span, TokenStream as TokenStream2};
|
use proc_macro2::{Span, TokenStream as TokenStream2};
|
||||||
use quote::quote;
|
use quote::quote;
|
||||||
use rtfm_syntax::{ast::App, Context, Core};
|
use rtfm_syntax::{ast::App, Context, Core};
|
||||||
use syn::{ArgCaptured, Attribute, Ident, IntSuffix, LitInt};
|
use syn::{Attribute, Ident, LitInt, PatType};
|
||||||
|
|
||||||
use crate::check::Extra;
|
use crate::check::Extra;
|
||||||
|
|
||||||
/// Turns `capacity` into an unsuffixed integer literal
|
/// Turns `capacity` into an unsuffixed integer literal
|
||||||
pub fn capacity_literal(capacity: u8) -> LitInt {
|
pub fn capacity_literal(capacity: u8) -> LitInt {
|
||||||
LitInt::new(u64::from(capacity), IntSuffix::None, Span::call_site())
|
LitInt::new(&capacity.to_string(), Span::call_site())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Turns `capacity` into a type-level (`typenum`) integer
|
/// Turns `capacity` into a type-level (`typenum`) integer
|
||||||
|
@ -194,7 +194,7 @@ pub fn rendezvous_ident(core: Core) -> Ident {
|
||||||
//
|
//
|
||||||
// `inputs` could be &[`input: Foo`] OR &[`mut x: i32`, `ref y: i64`]
|
// `inputs` could be &[`input: Foo`] OR &[`mut x: i32`, `ref y: i64`]
|
||||||
pub fn regroup_inputs(
|
pub fn regroup_inputs(
|
||||||
inputs: &[ArgCaptured],
|
inputs: &[PatType],
|
||||||
) -> (
|
) -> (
|
||||||
// args e.g. &[`_0`], &[`_0: i32`, `_1: i64`]
|
// args e.g. &[`_0`], &[`_0: i32`, `_1: i64`]
|
||||||
Vec<TokenStream2>,
|
Vec<TokenStream2>,
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
#![recursion_limit = "128"]
|
|
||||||
|
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,10 @@ fn ui() {
|
||||||
|
|
||||||
config.mode = Mode::Ui;
|
config.mode = Mode::Ui;
|
||||||
config.src_base = PathBuf::from("ui/single");
|
config.src_base = PathBuf::from("ui/single");
|
||||||
config.target_rustcflags =
|
config.target_rustcflags = Some(
|
||||||
Some("--edition=2018 -L target/debug/deps -Z unstable-options --extern rtfm --extern lm3s6965".to_owned());
|
"--edition=2018 -L target/debug/deps -Z unstable-options --extern rtfm --extern lm3s6965"
|
||||||
|
.to_owned(),
|
||||||
|
);
|
||||||
config.link_deps();
|
config.link_deps();
|
||||||
config.clean_rmeta();
|
config.clean_rmeta();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue