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/resources.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/resources.rs')
-rw-r--r-- | macros/src/codegen/resources.rs | 43 |
1 files changed, 6 insertions, 37 deletions
diff --git a/macros/src/codegen/resources.rs b/macros/src/codegen/resources.rs index 0bec3e5a..4196ee7a 100644 --- a/macros/src/codegen/resources.rs +++ b/macros/src/codegen/resources.rs @@ -1,9 +1,6 @@ use proc_macro2::TokenStream as TokenStream2; use quote::quote; -use rtic_syntax::{ - analyze::{Location, Ownership}, - ast::App, -}; +use rtic_syntax::{analyze::Ownership, ast::App}; use crate::{analyze::Analysis, check::Extra, codegen::util}; @@ -21,37 +18,15 @@ pub fn codegen( let mut const_app = vec![]; let mut mod_resources = vec![]; - for (name, res, expr, loc) in app.resources(analysis) { + for (name, res, expr, _) in app.resources(analysis) { let cfgs = &res.cfgs; let ty = &res.ty; { - let (loc_attr, section) = match loc { - Location::Owned { - core, - cross_initialized: false, - } => ( - util::cfg_core(*core, app.args.cores), - if expr.is_none() { - util::link_section_uninit(Some(*core)) - } else { - util::link_section("data", *core) - }, - ), - - // shared `static`s and cross-initialized resources need to be in `.shared` memory - _ => ( - if cfg!(feature = "heterogeneous") { - Some(quote!(#[rtic::export::shared])) - } else { - None - }, - if expr.is_none() { - util::link_section_uninit(None) - } else { - None - }, - ), + let section = if expr.is_none() { + util::link_section_uninit(true) + } else { + None }; let (ty, expr) = if let Some(expr) = expr { @@ -68,25 +43,20 @@ pub fn codegen( #[allow(non_upper_case_globals)] #(#attrs)* #(#cfgs)* - #loc_attr #section static mut #name: #ty = #expr; )); } if let Some(Ownership::Contended { ceiling }) = analysis.ownerships.get(name) { - let cfg_core = util::cfg_core(loc.core().expect("UNREACHABLE"), app.args.cores); - mod_resources.push(quote!( #[allow(non_camel_case_types)] #(#cfgs)* - #cfg_core pub struct #name<'a> { priority: &'a Priority, } #(#cfgs)* - #cfg_core impl<'a> #name<'a> { #[inline(always)] pub unsafe fn new(priority: &'a Priority) -> Self { @@ -115,7 +85,6 @@ pub fn codegen( const_app.push(util::impl_mutex( extra, cfgs, - cfg_core.as_ref(), true, name, quote!(#ty), |