aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md2
-rw-r--r--macros/src/codegen/local_resources.rs8
-rw-r--r--macros/src/codegen/shared_resources.rs10
3 files changed, 17 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5ebd3811..7d1a9f3d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,8 @@ For each category, *Added*, *Changed*, *Fixed* add new entries at the top!
### Added
+- Allow custom `link_section` attributes for late resources
+
### Fixed
- Distinguish between thumbv8m.base and thumbv8m.main for basepri usage.
diff --git a/macros/src/codegen/local_resources.rs b/macros/src/codegen/local_resources.rs
index 50621c32..6e7c1daa 100644
--- a/macros/src/codegen/local_resources.rs
+++ b/macros/src/codegen/local_resources.rs
@@ -27,8 +27,14 @@ 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!());
diff --git a/macros/src/codegen/shared_resources.rs b/macros/src/codegen/shared_resources.rs
index 53bb4823..4a750070 100644
--- a/macros/src/codegen/shared_resources.rs
+++ b/macros/src/codegen/shared_resources.rs
@@ -23,10 +23,16 @@ pub fn codegen(
let ty = &res.ty;
let mangled_name = &util::static_shared_resource_ident(name);
- // late resources in `util::link_section_uninit`
- let section = util::link_section_uninit();
let attrs = &res.attrs;
+ // late resources in `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!());
mod_app.push(quote!(