diff options
author | 2021-07-06 22:47:48 +0200 | |
---|---|---|
committer | 2021-07-06 22:47:48 +0200 | |
commit | ef5307d83a1d62df0569d78db75d4006147c927d (patch) | |
tree | 542ff46adf7600cbd7f908cb62ac3a44e1bfa683 /macros/src/codegen/util.rs | |
parent | 3f85cb5caf1ae930e6551e139978ceec859a2348 (diff) | |
download | rtic-ef5307d83a1d62df0569d78db75d4006147c927d.tar.gz rtic-ef5307d83a1d62df0569d78db75d4006147c927d.tar.zst rtic-ef5307d83a1d62df0569d78db75d4006147c927d.zip |
Minimal app now compiles
Diffstat (limited to 'macros/src/codegen/util.rs')
-rw-r--r-- | macros/src/codegen/util.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/macros/src/codegen/util.rs b/macros/src/codegen/util.rs index 21b31411..dd0fb6d9 100644 --- a/macros/src/codegen/util.rs +++ b/macros/src/codegen/util.rs @@ -41,7 +41,7 @@ pub fn impl_mutex( ptr: TokenStream2, ) -> TokenStream2 { let (path, priority) = if resources_prefix { - (quote!(resources::#name), quote!(self.priority())) + (quote!(shared_resources::#name), quote!(self.priority())) } else { (quote!(#name), quote!(self.priority)) }; @@ -167,7 +167,7 @@ pub fn link_section_uninit(empty_expr: bool) -> Option<TokenStream2> { pub fn locals_ident(ctxt: Context, app: &App) -> Ident { let mut s = match ctxt { Context::Init => app.init.name.to_string(), - Context::Idle => app.idle.unwrap().name.to_string(), + Context::Idle => app.idle.as_ref().unwrap().name.to_string(), Context::HardwareTask(ident) | Context::SoftwareTask(ident) => ident.to_string(), }; @@ -229,7 +229,7 @@ pub fn regroup_inputs( pub fn shared_resources_ident(ctxt: Context, app: &App) -> Ident { let mut s = match ctxt { Context::Init => app.init.name.to_string(), - Context::Idle => app.idle.unwrap().name.to_string(), + Context::Idle => app.idle.as_ref().unwrap().name.to_string(), Context::HardwareTask(ident) | Context::SoftwareTask(ident) => ident.to_string(), }; @@ -242,7 +242,7 @@ pub fn shared_resources_ident(ctxt: Context, app: &App) -> Ident { pub fn local_resources_ident(ctxt: Context, app: &App) -> Ident { let mut s = match ctxt { Context::Init => app.init.name.to_string(), - Context::Idle => app.idle.unwrap().name.to_string(), + Context::Idle => app.idle.as_ref().unwrap().name.to_string(), Context::HardwareTask(ident) | Context::SoftwareTask(ident) => ident.to_string(), }; @@ -288,6 +288,14 @@ pub fn monotonic_ident(name: &str) -> Ident { Ident::new(&format!("MONOTONIC_STORAGE_{}", name), Span::call_site()) } +pub fn static_shared_resource_ident(name: &Ident) -> Ident { + Ident::new(&format!("shared_{}", name.to_string()), Span::call_site()) +} + +pub fn static_local_resource_ident(name: &Ident) -> Ident { + Ident::new(&format!("local_{}", name.to_string()), Span::call_site()) +} + /// The name to get better RT flag errors pub fn rt_err_ident() -> Ident { Ident::new( |