diff options
author | 2020-12-03 11:51:32 +0000 | |
---|---|---|
committer | 2020-12-03 11:51:32 +0000 | |
commit | d6fb22e0fe541595d0a710e5b4faa323171c18f4 (patch) | |
tree | 5229dcf85f25dba82d2d523eeb59e3b1478c19af | |
parent | 038396e6f944fb8697e2d4ecbd88cfca9d16b90e (diff) | |
parent | 99cf0fb3dfb20037e00fb48d2839158637991e7f (diff) | |
download | cortex-m-d6fb22e0fe541595d0a710e5b4faa323171c18f4.tar.gz cortex-m-d6fb22e0fe541595d0a710e5b4faa323171c18f4.tar.zst cortex-m-d6fb22e0fe541595d0a710e5b4faa323171c18f4.zip |
Merge #297
297: Deprecate msp::write r=adamgreig a=jonas-schievink
The function can not be used from Rust code, because it destroys the stack frame.
Users must use an assembly block (inline or out-of-line) that both sets MSP and performs a method call.
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
-rw-r--r-- | CHANGELOG.md | 6 | ||||
-rw-r--r-- | src/register/msp.rs | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index e6d8ef7..27cc20b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - New assembly methods `asm::semihosting_syscall`, `asm::bootstrap`, and `asm::bootload`. +### Changed + +- `msp::write` has been deprecated in favor of `asm::bootstrap`. It was not + possible to use `msp::write` without causing Undefined Behavior, so all + existing users are encouraged to migrate. + ## [v0.7.0] - 2020-11-09 ### Added diff --git a/src/register/msp.rs b/src/register/msp.rs index 2e8261e..78f507c 100644 --- a/src/register/msp.rs +++ b/src/register/msp.rs @@ -8,6 +8,7 @@ pub fn read() -> u32 { /// Writes `bits` to the CPU register #[inline] +#[deprecated = "calling this function invokes Undefined Behavior"] pub unsafe fn write(bits: u32) { call_asm!(__msp_w(bits: u32)); } |