aboutsummaryrefslogtreecommitdiff
path: root/cortex-m-rt/src/lib.rs
diff options
context:
space:
mode:
authorGravatar Todd Stellanova <tstellanova@users.noreply.github.com> 2020-07-30 17:09:09 -0700
committerGravatar Todd Stellanova <tstellanova@users.noreply.github.com> 2020-07-30 17:09:09 -0700
commit44c56187772e88f7c38e0b68824a9d163958fd49 (patch)
tree07b459e5e468eba7e50be838876d19515e9ceee9 /cortex-m-rt/src/lib.rs
parent1ac145307c2d3a7668660108bc80484f4c0463ff (diff)
downloadcortex-m-44c56187772e88f7c38e0b68824a9d163958fd49.tar.gz
cortex-m-44c56187772e88f7c38e0b68824a9d163958fd49.tar.zst
cortex-m-44c56187772e88f7c38e0b68824a9d163958fd49.zip
Doc adding memory sections in memory.x
Diffstat (limited to '')
-rw-r--r--cortex-m-rt/src/lib.rs34
1 files changed, 34 insertions, 0 deletions
diff --git a/cortex-m-rt/src/lib.rs b/cortex-m-rt/src/lib.rs
index 47bc1f7..8139e7f 100644
--- a/cortex-m-rt/src/lib.rs
+++ b/cortex-m-rt/src/lib.rs
@@ -92,6 +92,7 @@
//! _stext = ORIGIN(FLASH) + 0x40C
//! ```
//!
+//!
//! # An example
//!
//! This section presents a minimal application built on top of `cortex-m-rt`. Apart from the
@@ -387,6 +388,39 @@
//! undefined behavior. At some point in the future we may add an attribute to safely place static
//! variables in this section.
//!
+//! ## Extra Sections
+//!
+//! Some microcontrollers provide additional memory regions beyond RAM and FLASH.
+//! For example, some STM32 devices provide "CCM" or core-coupled RAM that is
+//! only accessible from the core. In order to access these using
+//! `#[link_section=".foo"]` from your code, you need to modify `memory.x`
+//! to declare the additional sections:
+//!
+//! ```text
+//! MEMORY
+//! {
+//! FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
+//! RAM (rw) : ORIGIN = 0x20000000, LENGTH = 128K
+//! CCMRAM (rw) : ORIGIN = 0x10000000, LENGTH = 64K
+//! }
+//!
+//! SECTIONS
+//! {
+//! .ccmram (NOLOAD) : ALIGN(4)
+//! {
+//! *(.ccmram .ccmram.*);
+//! . = ALIGN(4);
+//! } > CCMRAM
+//! } INSERT AFTER .bss;
+//! ```
+//!
+//! You can then use something like this to place a variable into this specific section of memory:
+//!
+//! ```no_run,edition2018
+//! #[link_section=".ccmram.BUFFERS"]
+//! static mut BUF: [u8; 1024] = [0u8; 1024];
+//! ```
+//!
//! [attr-entry]: attr.entry.html
//! [attr-exception]: attr.exception.html
//! [attr-pre_init]: attr.pre_init.html