Skip to content

Commit aa39e5c

Browse files
committed
drop the panic_fmt lang item and the abort-on-panic feature
closes #30
1 parent 0f4484b commit aa39e5c

File tree

3 files changed

+6
-22
lines changed

3 files changed

+6
-22
lines changed

cortex-m-rt/Cargo.toml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,4 @@ version = "0.4.0"
1111

1212
[dependencies]
1313
cortex-m = "0.3.0"
14-
r0 = "0.2.1"
15-
16-
[features]
17-
# provides a panic_fmt implementation that calls the abort instruction (`udf 0xfe`)
18-
abort-on-panic = []
14+
r0 = "0.2.1"

cortex-m-rt/src/lang_items.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
/// Default panic handler
2-
#[cfg(feature = "abort-on-panic")]
3-
#[lang = "panic_fmt"]
4-
unsafe extern "C" fn panic_fmt(_: ::core::fmt::Arguments, _: &'static str, _: u32, _: u32) -> ! {
5-
::core::intrinsics::abort()
6-
}
7-
81
// Lang item required to make the normal `main` work in applications
92
//
103
// This is how the `start` lang item works:

cortex-m-rt/src/lib.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@
88
//!
99
//! - Before main initialization of the FPU (for targets that have a FPU).
1010
//!
11-
//! - A `panic_fmt` implementation that just calls abort that you can opt into
12-
//! through the "abort-on-panic" Cargo feature. If you don't use this feature
13-
//! you'll have to provide the `panic_fmt` lang item yourself. Documentation
14-
//! [here](https://doc.rust-lang.org/unstable-book/language-features/lang-items.html)
15-
//!
1611
//! - A minimal `start` lang item to support the standard `fn main()`
1712
//! interface. (The processor goes to sleep (`loop { asm!("wfi") }`) after
1813
//! returning from `main`)
@@ -41,10 +36,10 @@
4136
//! $ cargo new --bin app && cd $_
4237
//!
4338
//! $ # add this crate as a dependency
44-
//! $ $EDITOR Cargo.toml && tail $_
45-
//! [dependencies.cortex-m-rt]
46-
//! features = ["abort-on-panic"]
47-
//! version = "0.3.0"
39+
//! $ cargo add cortex-m-rt --vers 0.4.0
40+
//!
41+
//! $ # select a panicking behavior
42+
//! $ cargo add panic-abort
4843
//!
4944
//! $ # memory layout of the device
5045
//! $ $EDITOR memory.x && cat $_
@@ -63,6 +58,7 @@
6358
//! #![no_std]
6459
//!
6560
//! extern crate cortex_m_rt;
61+
//! extern crate panic_abort; // panicking behavior
6662
//!
6763
//! fn main() {
6864
//! // do something here
@@ -276,7 +272,6 @@
276272
//! [qs]: https://docs.rs/cortex-m-quickstart/0.2.0/cortex_m_quickstart/
277273
//! [2]: https://sourceware.org/binutils/docs/ld/MEMORY.html
278274
279-
#![cfg_attr(any(target_arch = "arm", feature = "abort-on-panic"), feature(core_intrinsics))]
280275
#![deny(missing_docs)]
281276
#![deny(warnings)]
282277
#![feature(asm)]

0 commit comments

Comments
 (0)