aboutsummaryrefslogtreecommitdiff
path: root/macros/src/codegen/locals.rs
diff options
context:
space:
mode:
authorJorge Aparicio <jorge@japaric.io>2019-06-29 09:11:42 +0200
committerJorge Aparicio <jorge@japaric.io>2019-06-29 09:11:57 +0200
commitbe92041a592f65f38cee8475b61d35e7fcee3694 (patch)
tree3d7f59dff198183dee3920e790693a93063f3996 /macros/src/codegen/locals.rs
parentdf4a7fd3e5df370a83fcdc24aa628bed3fa9f543 (diff)
WIP
Diffstat (limited to 'macros/src/codegen/locals.rs')
-rw-r--r--macros/src/codegen/locals.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/macros/src/codegen/locals.rs b/macros/src/codegen/locals.rs
index 9663563..799ef7a 100644
--- a/macros/src/codegen/locals.rs
+++ b/macros/src/codegen/locals.rs
@@ -2,7 +2,7 @@ use proc_macro2::TokenStream as TokenStream2;
use quote::quote;
use rtfm_syntax::{
ast::{App, Local},
- Context, Map,
+ Context, Core, Map,
};
use crate::codegen::util;
@@ -10,6 +10,7 @@ use crate::codegen::util;
pub fn codegen(
ctxt: Context,
locals: &Map<Local>,
+ core: Core,
app: &App,
) -> (
// locals
@@ -41,6 +42,7 @@ pub fn codegen(
let cfgs = &local.cfgs;
has_cfgs |= !cfgs.is_empty();
+ let section = util::link_section("data", core);
let expr = &local.expr;
let ty = &local.ty;
fields.push(quote!(
@@ -49,6 +51,7 @@ pub fn codegen(
));
items.push(quote!(
#(#cfgs)*
+ #section
static mut #name: #ty = #expr
));
values.push(quote!(