aboutsummaryrefslogtreecommitdiff
path: root/macros/src/codegen/resources.rs
diff options
context:
space:
mode:
authorGravatar Jorge Aparicio <jorge@japaric.io> 2019-06-29 09:11:42 +0200
committerGravatar Jorge Aparicio <jorge@japaric.io> 2019-06-29 09:11:57 +0200
commitbe92041a592f65f38cee8475b61d35e7fcee3694 (patch)
tree3d7f59dff198183dee3920e790693a93063f3996 /macros/src/codegen/resources.rs
parentdf4a7fd3e5df370a83fcdc24aa628bed3fa9f543 (diff)
downloadrtic-be92041a592f65f38cee8475b61d35e7fcee3694.tar.gz
rtic-be92041a592f65f38cee8475b61d35e7fcee3694.tar.zst
rtic-be92041a592f65f38cee8475b61d35e7fcee3694.zip
WIP
Diffstat (limited to 'macros/src/codegen/resources.rs')
-rw-r--r--macros/src/codegen/resources.rs17
1 files changed, 11 insertions, 6 deletions
diff --git a/macros/src/codegen/resources.rs b/macros/src/codegen/resources.rs
index 2425681b..1161a7a5 100644
--- a/macros/src/codegen/resources.rs
+++ b/macros/src/codegen/resources.rs
@@ -26,20 +26,24 @@ pub fn codegen(
let ty = &res.ty;
{
- let loc_attr = match loc {
+ let (loc_attr, section) = match loc {
Location::Owned {
core,
cross_initialized: false,
- } => util::cfg_core(*core, app.args.cores),
+ } => (
+ util::cfg_core(*core, app.args.cores),
+ util::link_section("data", *core),
+ ),
// shared `static`s and cross-initialized resources need to be in `.shared` memory
- _ => {
+ _ => (
if cfg!(feature = "heterogeneous") {
Some(quote!(#[rtfm::export::shared]))
} else {
None
- }
- }
+ },
+ None,
+ ),
};
let (ty, expr) = if let Some(expr) = expr {
@@ -53,9 +57,10 @@ pub fn codegen(
let attrs = &res.attrs;
const_app.push(quote!(
- #loc_attr
#(#attrs)*
#(#cfgs)*
+ #loc_attr
+ #section
static mut #name: #ty = #expr;
));
}