Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cortex-m-rt/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Mark `pre_init` as deprecated
- Add `set_msplim` feature to conditionally set the MSPLIM register at device
reset ([#580]).
- Add `skip-data-copy` feature to prevent copying the `.data` section from the
load address to the virtual address. Use when the load address is inaccessible
by the time user code runs, such as when copying from flash or when booting
from an external device. Note that this relies on the bootloader to have already
copied `.data` to the VMA before relinquishing control.

## [v0.7.5]

Expand Down
1 change: 1 addition & 0 deletions cortex-m-rt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ set-vtor = []
set-msplim = []
zero-init-ram = []
paint-stack = []
skip-data-copy = []

[package.metadata.docs.rs]
features = ["device"]
9 changes: 9 additions & 0 deletions cortex-m-rt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,14 @@
//! where the stack has been used the 'paint' will have been 'scrubbed off' and the memory will
//! have a value other than `STACK_PAINT_VALUE`.
//!
//! ## `skip-data-copy`
//!
//! Skips copying the .data section (containing the initial values for static variables) when a bootloader
//! (or other mechanism) is responsible for initializing the section. Use when the code is loaded from a location
//! that's invalid after the bootloader runs (e.g. copy-from-XIP or copy-from-network boot). For example,
//! rp2040-boot2 with `BOOT_LOADER_RAM_MEMCPY` (not the default of boot2!) set, which copies the code out
//! of the XIP flash memory and then disables the XIP peripheral afterwards.
//!
//! # Inspection
//!
//! This section covers how to inspect a binary that builds on top of `cortex-m-rt`.
Expand Down Expand Up @@ -616,6 +624,7 @@ cfg_global_asm! {
1:",

// Initialise .data memory. `__sdata`, `__sidata`, and `__edata` come from the linker script.
#[cfg(not(feature = "skip-data-copy"))]
"ldr r0, =__sdata
ldr r1, =__edata
ldr r2, =__sidata
Expand Down