Skip to content

Commit

Permalink
Add stub abort() handler to examples which calls panic.
Browse files Browse the repository at this point in the history
  • Loading branch information
cr1901 committed Sep 20, 2020
1 parent cee9e9a commit 8abde0b
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 1 deletion.
6 changes: 5 additions & 1 deletion examples/blinky.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,12 @@ fn main() -> ! {
}
}


#[interrupt]
fn TIMER0_A0() {

}

#[no_mangle]
extern "C" fn abort() -> ! {
panic!();
}
5 changes: 5 additions & 0 deletions examples/override-default-handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,8 @@ fn DefaultHandler() {
ptr::write_volatile(&mut X, ptr::read_volatile(&X) + 1);
}
}

#[no_mangle]
extern "C" fn abort() -> ! {
panic!();
}
5 changes: 5 additions & 0 deletions examples/timer-oncecell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,8 @@ fn TIMER0_A1() {
.p6().bit(!r.p6().bit()));
});
}

#[no_mangle]
extern "C" fn abort() -> ! {
panic!();
}
5 changes: 5 additions & 0 deletions examples/timer-unsafe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,8 @@ fn TIMER0_A1() {
.p6().bit(!r.p6().bit()));
});
}

#[no_mangle]
extern "C" fn abort() -> ! {
panic!();
}
5 changes: 5 additions & 0 deletions examples/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,8 @@ fn TIMER0_A1() {
.p6().bit(!r.p6().bit()));
});
}

#[no_mangle]
extern "C" fn abort() -> ! {
panic!();
}
8 changes: 8 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,11 @@ fn main() -> ! {
// Application begins here.
}
}

// The compiler will emit calls to the abort() compiler intrinsic if debug assertions are
// enabled (default for dev profile). MSP430 does not actually have meaningful abort() support
// so for now, we create our own in each application where debug assertions are present.
#[no_mangle]
extern "C" fn abort() -> ! {
panic!();
}

0 comments on commit 8abde0b

Please sign in to comment.