diff options
Diffstat (limited to 'macros/src/codegen/resources.rs')
-rw-r--r-- | macros/src/codegen/resources.rs | 39 |
1 files changed, 13 insertions, 26 deletions
diff --git a/macros/src/codegen/resources.rs b/macros/src/codegen/resources.rs index 0bec3e5a..07e01cb1 100644 --- a/macros/src/codegen/resources.rs +++ b/macros/src/codegen/resources.rs @@ -1,7 +1,7 @@ use proc_macro2::TokenStream as TokenStream2; use quote::quote; use rtic_syntax::{ - analyze::{Location, Ownership}, + analyze::Ownership, ast::App, }; @@ -21,38 +21,29 @@ 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])) + //let loc_attr = None; + let section = if expr.is_none() { + util::link_section_uninit(true) } else { None - }, + }; + /* + let (loc_attr, section) = match loc { + Location::Owned => ( + None, if expr.is_none() { - util::link_section_uninit(None) + util::link_section_uninit(true) } else { None }, ), }; + */ let (ty, expr) = if let Some(expr) = expr { (quote!(#ty), quote!(#expr)) @@ -68,25 +59,22 @@ pub fn codegen( #[allow(non_upper_case_globals)] #(#attrs)* #(#cfgs)* - #loc_attr + //#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 +103,6 @@ pub fn codegen( const_app.push(util::impl_mutex( extra, cfgs, - cfg_core.as_ref(), true, name, quote!(#ty), |