diff options
author | 2020-09-04 07:50:13 +0000 | |
---|---|---|
committer | 2020-09-04 07:50:13 +0000 | |
commit | 7506bd8ae0ba335fc058c2138438fab5f20f6dab (patch) | |
tree | fe65b335b19171370bd6be0bd5cd6b776a1d6110 /macros/src/codegen/idle.rs | |
parent | c5e6d1fa49e3596227a8ee8fe89e2e4f66db3169 (diff) | |
parent | ad2b80907899cc335edcebfc77ae4b4b51272b87 (diff) | |
download | rtic-7506bd8ae0ba335fc058c2138438fab5f20f6dab.tar.gz rtic-7506bd8ae0ba335fc058c2138438fab5f20f6dab.tar.zst rtic-7506bd8ae0ba335fc058c2138438fab5f20f6dab.zip |
Merge #355
355: Multi-core removal r=korken89 a=AfoHT
Dependent on https://github.com/rtic-rs/rtic-syntax/pull/27
With the same reasoning as ^^
For now the testing is done against my rtic-syntax/multiremove-branch, but before we merge it should corrected.
Co-authored-by: Henrik Tjäder <henrik@tjaders.com>
Diffstat (limited to 'macros/src/codegen/idle.rs')
-rw-r--r-- | macros/src/codegen/idle.rs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/macros/src/codegen/idle.rs b/macros/src/codegen/idle.rs index 032c8ade..d0bff3e7 100644 --- a/macros/src/codegen/idle.rs +++ b/macros/src/codegen/idle.rs @@ -5,12 +5,11 @@ use rtic_syntax::{ast::App, Context}; use crate::{ analyze::Analysis, check::Extra, - codegen::{locals, module, resources_struct, util}, + codegen::{locals, module, resources_struct}, }; /// Generates support code for `#[idle]` functions pub fn codegen( - core: u8, app: &App, analysis: &Analysis, extra: &Extra, @@ -27,7 +26,8 @@ pub fn codegen( // call_idle TokenStream2, ) { - if let Some(idle) = app.idles.get(&core) { + if app.idles.len() > 0 { + let idle = &app.idles.first().unwrap(); let mut needs_lt = false; let mut const_app = None; let mut root_idle = vec![]; @@ -36,7 +36,7 @@ pub fn codegen( if !idle.args.resources.is_empty() { let (item, constructor) = - resources_struct::codegen(Context::Idle(core), 0, &mut needs_lt, app, analysis); + resources_struct::codegen(Context::Idle, 0, &mut needs_lt, app, analysis); root_idle.push(item); const_app = Some(constructor); @@ -44,26 +44,22 @@ pub fn codegen( let name = &idle.name; if !idle.locals.is_empty() { - let (locals, pat) = locals::codegen(Context::Idle(core), &idle.locals, core, app); + let (locals, pat) = locals::codegen(Context::Idle, &idle.locals, app); locals_new = Some(quote!(#name::Locals::new())); locals_pat = Some(pat); root_idle.push(locals); } - root_idle.push(module::codegen(Context::Idle(core), needs_lt, app, extra)); + root_idle.push(module::codegen(Context::Idle, needs_lt, app, extra)); - let cfg_core = util::cfg_core(core, app.args.cores); let attrs = &idle.attrs; let context = &idle.context; let stmts = &idle.stmts; - let section = util::link_section("text", core); let locals_pat = locals_pat.iter(); let user_idle = Some(quote!( #(#attrs)* #[allow(non_snake_case)] - #cfg_core - #section fn #name(#(#locals_pat,)* #context: #name::Context) -> ! { use rtic::Mutex as _; |