mirror of
https://github.com/ferrous-systems/embedded-trainings-2020.git
synced 2025-01-24 06:48:11 +00:00
add a compiler fence before exiting
the rtt-target implementation is light on compiler fences so the compiler could be doing unwanted reordering of memory operations. At least patch up a place where these orderings may result in an observable change of behavior
This commit is contained in:
parent
9c1e496ef5
commit
80cb2caa09
1 changed files with 3 additions and 1 deletions
|
@ -6,7 +6,7 @@
|
|||
|
||||
use core::{
|
||||
ops,
|
||||
sync::atomic::{AtomicU32, Ordering},
|
||||
sync::atomic::{self, AtomicU32, Ordering},
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
|
@ -302,6 +302,8 @@ fn RTC0() {
|
|||
/// Cargo runner
|
||||
pub fn exit() -> ! {
|
||||
log::info!("`dk::exit() called; exiting ...`");
|
||||
// force any pending memory operation to complete before the BKPT instruction that follows
|
||||
atomic::compiler_fence(Ordering::SeqCst);
|
||||
loop {
|
||||
asm::bkpt()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue