aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2022-08-18 21:15:37 -0700
committerChristian Cunningham <cc@localhost>2022-08-18 21:15:37 -0700
commit1c462971fec7efdb7d92424bfce7653ddacb7b9d (patch)
treecdce448029a0a11b0cc85581b96a268416e54768
parentffdcd4524f6940bb1d6d40b45eb7bf8c6f756223 (diff)
Example variable in specific linker sections
-rw-r--r--src/alloc.rs1
-rw-r--r--src/bsp/raspberrypi/linker.ld1
2 files changed, 2 insertions, 0 deletions
diff --git a/src/alloc.rs b/src/alloc.rs
index 4fe44ee..fd22c67 100644
--- a/src/alloc.rs
+++ b/src/alloc.rs
@@ -89,4 +89,5 @@ impl Debug for CharAllocator {
}
}
+#[link_section = ".data.alloc"]
pub static CHAR_ALLOCATOR: CharAllocator = CharAllocator::new();
diff --git a/src/bsp/raspberrypi/linker.ld b/src/bsp/raspberrypi/linker.ld
index 93ee267..daf4a05 100644
--- a/src/bsp/raspberrypi/linker.ld
+++ b/src/bsp/raspberrypi/linker.ld
@@ -19,6 +19,7 @@ SECTIONS
.data :
{
*(.data*)
+ KEEP(*(.data.alloc))
__stacks_start = .;
KEEP(*(.data.stacks))
}