aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Norbert Fabritius <norbert.fabritius@esrlabs.com> 2023-01-09 11:02:18 +0100
committerGravatar Adam Greig <adam@adamgreig.com> 2023-02-17 18:21:25 +0000
commit26cae65548eb2c594427caf4a9638e0fdc4f1ba1 (patch)
tree345135843b7baa79e589cf18925ec73547ba97f4
parent4714f43cf88198cdfbe19839e1ff7809033d3b42 (diff)
downloadcortex-m-26cae65548eb2c594427caf4a9638e0fdc4f1ba1.tar.gz
cortex-m-26cae65548eb2c594427caf4a9638e0fdc4f1ba1.tar.zst
cortex-m-26cae65548eb2c594427caf4a9638e0fdc4f1ba1.zip
Add documentation, test and changelog entry for `zero-init-ram` feature
-rw-r--r--cortex-m-rt/CHANGELOG.md4
-rwxr-xr-xcortex-m-rt/ci/script.sh2
-rw-r--r--cortex-m-rt/src/lib.rs7
3 files changed, 11 insertions, 2 deletions
diff --git a/cortex-m-rt/CHANGELOG.md b/cortex-m-rt/CHANGELOG.md
index 65144cf..7f1226a 100644
--- a/cortex-m-rt/CHANGELOG.md
+++ b/cortex-m-rt/CHANGELOG.md
@@ -7,14 +7,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
-## [v0.7.3]
-
- Fixed a potential miscompilation caused by the initial stack pointer
not being 8-byte aligned. This issue affected 0.7.1 and 0.7.2; for
more details please see [the advisory] ([#467]).
- A linker error is generated if the initial stack pointer is not 8-byte aligned ([#464]).
- The initial stack pointer is now forced to be 8-byte aligned in the linker script,
to defend against it being overridden outside of the cortex-m-rt linker script ([#465]).
+- Add `zero-init-ram` feature to initialize RAM with zeros on startup. This can be necessary on
+ safety-critical hardware to properly initialize memory integrity measures.
[the advisory]: https://github.com/rust-embedded/cortex-m/discussions/469
[#464]: https://github.com/rust-embedded/cortex-m/issues/464
diff --git a/cortex-m-rt/ci/script.sh b/cortex-m-rt/ci/script.sh
index 2941e48..02ba51f 100755
--- a/cortex-m-rt/ci/script.sh
+++ b/cortex-m-rt/ci/script.sh
@@ -63,6 +63,8 @@ main() {
cargo rustc --target "$TARGET" --example minimal --features "set-sp,${needed_features}" -- $linker
cargo rustc --target "$TARGET" --example minimal --features "set-sp,${needed_features}" --release -- $linker
+ cargo rustc --target "$TARGET" --example minimal --features "zero-init-ram,${needed_features}" -- $linker
+ cargo rustc --target "$TARGET" --example minimal --features "zero-init-ram,${needed_features}" --release -- $linker
cargo rustc --target "$TARGET" --example minimal --features "set-vtor,${needed_features}" -- $linker
cargo rustc --target "$TARGET" --example minimal --features "set-vtor,${needed_features}" --release -- $linker
done
diff --git a/cortex-m-rt/src/lib.rs b/cortex-m-rt/src/lib.rs
index b90b124..f9df60a 100644
--- a/cortex-m-rt/src/lib.rs
+++ b/cortex-m-rt/src/lib.rs
@@ -169,6 +169,13 @@
//! `_stack_start` value from the linker script. This is not usually required, but some debuggers
//! do not initialise SP when performing a soft reset, which can lead to stack corruption.
//!
+//! ## `zero-init-ram`
+//!
+//! If this feature is enabled, RAM is initialized with zeros during startup from the `_ram_start`
+//! value to the `_ram_end` value from the linker script. This is not usually required, but might be
+//! necessary to properly initialize checksum-based memory integrity measures on safety-critical
+//! hardware.
+//!
//! ## `set-vtor`
//!
//! If this feature is enabled, the vector table offset register (VTOR) is initialised in the reset