File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 92
92
//! _stext = ORIGIN(FLASH) + 0x40C
93
93
//! ```
94
94
//!
95
+ //!
95
96
//! # An example
96
97
//!
97
98
//! This section presents a minimal application built on top of `cortex-m-rt`. Apart from the
387
388
//! undefined behavior. At some point in the future we may add an attribute to safely place static
388
389
//! variables in this section.
389
390
//!
391
+ //! ## Extra Sections
392
+ //!
393
+ //! Some microcontrollers provide additional memory regions beyond RAM and FLASH.
394
+ //! For example, some STM32 devices provide "CCM" or core-coupled RAM that is
395
+ //! only accessible from the core. In order to access these using
396
+ //! `#[link_section=".foo"]` from your code, you need to modify `memory.x`
397
+ //! to declare the additional sections:
398
+ //!
399
+ //! ```text
400
+ //! MEMORY
401
+ //! {
402
+ //! FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
403
+ //! RAM (rw) : ORIGIN = 0x20000000, LENGTH = 128K
404
+ //! CCMRAM (rw) : ORIGIN = 0x10000000, LENGTH = 64K
405
+ //! }
406
+ //!
407
+ //! SECTIONS
408
+ //! {
409
+ //! .ccmram (NOLOAD) : ALIGN(4)
410
+ //! {
411
+ //! *(.ccmram .ccmram.*);
412
+ //! . = ALIGN(4);
413
+ //! } > CCMRAM
414
+ //! } INSERT AFTER .bss;
415
+ //! ```
416
+ //!
417
+ //! You can then use something like this to place a variable into this specific section of memory:
418
+ //!
419
+ //! ```no_run,edition2018
420
+ //! #[link_section=".ccmram.BUFFERS"]
421
+ //! static mut BUF: [u8; 1024] = [0u8; 1024];
422
+ //! ```
423
+ //!
390
424
//! [attr-entry]: attr.entry.html
391
425
//! [attr-exception]: attr.exception.html
392
426
//! [attr-pre_init]: attr.pre_init.html
You can’t perform that action at this time.
0 commit comments