diff options
author | Dario Nieuwenhuis <dirbaio@dirbaio.net> | 2020-11-25 22:03:28 +0100 |
---|---|---|
committer | Dario Nieuwenhuis <dirbaio@dirbaio.net> | 2020-11-25 22:03:28 +0100 |
commit | 25949bdf807b9e66e193d0b2e7bb638329bac9f7 (patch) | |
tree | 738705ef16155c16e44530244d7ca1e30d4c5ac2 | |
parent | 5231fd670327bdae54643ba88548788c535848b1 (diff) | |
download | nrf-softdevice-25949bdf807b9e66e193d0b2e7bb638329bac9f7.zip |
Random cleanup
-rw-r--r-- | .cargo/config | 1 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | nrf-softdevice-defmt-rtt/src/lib.rs | 2 | ||||
-rw-r--r-- | nrf-softdevice/src/interrupt.rs | 5 |
4 files changed, 8 insertions, 2 deletions
diff --git a/.cargo/config b/.cargo/config index 3f319ae..8d2de5d 100644 --- a/.cargo/config +++ b/.cargo/config @@ -4,6 +4,7 @@ runner = "probe-run --chip nRF52840_xxAA --defmt" rustflags = [ # LLD (shipped with the Rust toolchain) is used as the default linker "-C", "link-arg=--nmagic", + "-Z", "trap-unreachable=no", "-C", "link-arg=-Tlink.x", "-C", "link-arg=-Tdefmt.x", @@ -42,7 +42,7 @@ debug = 2 debug-assertions = false incremental = false lto = "fat" -opt-level = 3 +opt-level = 's' overflow-checks = false # do not optimize proc-macro crates = faster builds from scratch diff --git a/nrf-softdevice-defmt-rtt/src/lib.rs b/nrf-softdevice-defmt-rtt/src/lib.rs index 0700bf7..3889677 100644 --- a/nrf-softdevice-defmt-rtt/src/lib.rs +++ b/nrf-softdevice-defmt-rtt/src/lib.rs @@ -52,7 +52,7 @@ unsafe impl defmt::Logger for Logger { unsafe fn release(_: NonNull<dyn defmt::Write>) { TAKEN.store(false, Ordering::Relaxed); - unsafe { interrupt::enable_all(INTERRUPTS_TOKEN.load(Ordering::Relaxed)) }; + interrupt::enable_all(INTERRUPTS_TOKEN.load(Ordering::Relaxed)); } } diff --git a/nrf-softdevice/src/interrupt.rs b/nrf-softdevice/src/interrupt.rs index 4b2e771..255ba5c 100644 --- a/nrf-softdevice/src/interrupt.rs +++ b/nrf-softdevice/src/interrupt.rs @@ -143,10 +143,15 @@ pub unsafe fn disable_all() -> u8 { nvic.icer[1].write(!RESERVED_IRQS[1]); }); } + + compiler_fence(Ordering::SeqCst); + return nested_cs as u8; } pub unsafe fn enable_all(token: u8) { + compiler_fence(Ordering::SeqCst); + let nvic = &*NVIC::ptr(); if token == 0 { raw_free(|| { |