Skip to content

Commit 26cae65

Browse files
Norbert Fabritiusadamgreig
Norbert Fabritius
authored andcommitted
Add documentation, test and changelog entry for zero-init-ram feature
1 parent 4714f43 commit 26cae65

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

cortex-m-rt/CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10-
## [v0.7.3]
11-
1210
- Fixed a potential miscompilation caused by the initial stack pointer
1311
not being 8-byte aligned. This issue affected 0.7.1 and 0.7.2; for
1412
more details please see [the advisory] ([#467]).
1513
- A linker error is generated if the initial stack pointer is not 8-byte aligned ([#464]).
1614
- The initial stack pointer is now forced to be 8-byte aligned in the linker script,
1715
to defend against it being overridden outside of the cortex-m-rt linker script ([#465]).
16+
- Add `zero-init-ram` feature to initialize RAM with zeros on startup. This can be necessary on
17+
safety-critical hardware to properly initialize memory integrity measures.
1818

1919
[the advisory]: https://github.com/rust-embedded/cortex-m/discussions/469
2020
[#464]: https://github.com/rust-embedded/cortex-m/issues/464

cortex-m-rt/ci/script.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ main() {
6363

6464
cargo rustc --target "$TARGET" --example minimal --features "set-sp,${needed_features}" -- $linker
6565
cargo rustc --target "$TARGET" --example minimal --features "set-sp,${needed_features}" --release -- $linker
66+
cargo rustc --target "$TARGET" --example minimal --features "zero-init-ram,${needed_features}" -- $linker
67+
cargo rustc --target "$TARGET" --example minimal --features "zero-init-ram,${needed_features}" --release -- $linker
6668
cargo rustc --target "$TARGET" --example minimal --features "set-vtor,${needed_features}" -- $linker
6769
cargo rustc --target "$TARGET" --example minimal --features "set-vtor,${needed_features}" --release -- $linker
6870
done

cortex-m-rt/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,13 @@
169169
//! `_stack_start` value from the linker script. This is not usually required, but some debuggers
170170
//! do not initialise SP when performing a soft reset, which can lead to stack corruption.
171171
//!
172+
//! ## `zero-init-ram`
173+
//!
174+
//! If this feature is enabled, RAM is initialized with zeros during startup from the `_ram_start`
175+
//! value to the `_ram_end` value from the linker script. This is not usually required, but might be
176+
//! necessary to properly initialize checksum-based memory integrity measures on safety-critical
177+
//! hardware.
178+
//!
172179
//! ## `set-vtor`
173180
//!
174181
//! If this feature is enabled, the vector table offset register (VTOR) is initialised in the reset

0 commit comments

Comments
 (0)