diff options
author | 2022-07-06 17:43:38 +0200 | |
---|---|---|
committer | 2022-07-06 17:43:38 +0200 | |
commit | c6fd3cdd0a4e29c1e2d77c6e9107450a1bceed92 (patch) | |
tree | 6cf52ae4d299a591e5e33dc0163dd0fa8e13e547 /macros/src/codegen/local_resources.rs | |
parent | 981fa1fb30a70ec2416778b3e8daa491108deb41 (diff) | |
download | rtic-c6fd3cdd0a4e29c1e2d77c6e9107450a1bceed92.tar.gz rtic-c6fd3cdd0a4e29c1e2d77c6e9107450a1bceed92.tar.zst rtic-c6fd3cdd0a4e29c1e2d77c6e9107450a1bceed92.zip |
Allow custom `link_section` attributes for late resources
This commit makes RTIC aware of user-provided `link_section` attributes,
letting user override default section mapping.
Diffstat (limited to 'macros/src/codegen/local_resources.rs')
-rw-r--r-- | macros/src/codegen/local_resources.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/macros/src/codegen/local_resources.rs b/macros/src/codegen/local_resources.rs index 50621c32..087967f2 100644 --- a/macros/src/codegen/local_resources.rs +++ b/macros/src/codegen/local_resources.rs @@ -27,8 +27,15 @@ pub fn codegen( let mangled_name = util::static_local_resource_ident(name); let attrs = &res.attrs; + // late resources in `util::link_section_uninit` - let section = util::link_section_uninit(); + // unless user specifies custom link section + let section = if attrs.iter().any(|attr| attr.path.is_ident("link_section")) { + None + } + else { + Some(util::link_section_uninit()) + }; // For future use // let doc = format!(" RTIC internal: {}:{}", file!(), line!()); |