diff options
author | 2018-04-09 01:24:43 +0200 | |
---|---|---|
committer | 2018-04-09 01:28:51 +0200 | |
commit | aa39e5c88de45d5231bb0affe3a41aa309f2a23a (patch) | |
tree | 0d452aa966081fe8955bd625943292a7bd047964 | |
parent | 0f4484b52348467158b9af691cd5fc5930eac205 (diff) | |
download | cortex-m-aa39e5c88de45d5231bb0affe3a41aa309f2a23a.tar.gz cortex-m-aa39e5c88de45d5231bb0affe3a41aa309f2a23a.tar.zst cortex-m-aa39e5c88de45d5231bb0affe3a41aa309f2a23a.zip |
drop the panic_fmt lang item and the abort-on-panic feature
closes #30
-rw-r--r-- | cortex-m-rt/Cargo.toml | 6 | ||||
-rw-r--r-- | cortex-m-rt/src/lang_items.rs | 7 | ||||
-rw-r--r-- | cortex-m-rt/src/lib.rs | 15 |
3 files changed, 6 insertions, 22 deletions
diff --git a/cortex-m-rt/Cargo.toml b/cortex-m-rt/Cargo.toml index 45f0b07..cd31b2d 100644 --- a/cortex-m-rt/Cargo.toml +++ b/cortex-m-rt/Cargo.toml @@ -11,8 +11,4 @@ version = "0.4.0" [dependencies] cortex-m = "0.3.0" -r0 = "0.2.1" - -[features] -# provides a panic_fmt implementation that calls the abort instruction (`udf 0xfe`) -abort-on-panic = [] +r0 = "0.2.1"
\ No newline at end of file diff --git a/cortex-m-rt/src/lang_items.rs b/cortex-m-rt/src/lang_items.rs index 7d7a598..571a8a5 100644 --- a/cortex-m-rt/src/lang_items.rs +++ b/cortex-m-rt/src/lang_items.rs @@ -1,10 +1,3 @@ -/// Default panic handler -#[cfg(feature = "abort-on-panic")] -#[lang = "panic_fmt"] -unsafe extern "C" fn panic_fmt(_: ::core::fmt::Arguments, _: &'static str, _: u32, _: u32) -> ! { - ::core::intrinsics::abort() -} - // Lang item required to make the normal `main` work in applications // // This is how the `start` lang item works: diff --git a/cortex-m-rt/src/lib.rs b/cortex-m-rt/src/lib.rs index e57916f..f639af8 100644 --- a/cortex-m-rt/src/lib.rs +++ b/cortex-m-rt/src/lib.rs @@ -8,11 +8,6 @@ //! //! - Before main initialization of the FPU (for targets that have a FPU). //! -//! - A `panic_fmt` implementation that just calls abort that you can opt into -//! through the "abort-on-panic" Cargo feature. If you don't use this feature -//! you'll have to provide the `panic_fmt` lang item yourself. Documentation -//! [here](https://doc.rust-lang.org/unstable-book/language-features/lang-items.html) -//! //! - A minimal `start` lang item to support the standard `fn main()` //! interface. (The processor goes to sleep (`loop { asm!("wfi") }`) after //! returning from `main`) @@ -41,10 +36,10 @@ //! $ cargo new --bin app && cd $_ //! //! $ # add this crate as a dependency -//! $ $EDITOR Cargo.toml && tail $_ -//! [dependencies.cortex-m-rt] -//! features = ["abort-on-panic"] -//! version = "0.3.0" +//! $ cargo add cortex-m-rt --vers 0.4.0 +//! +//! $ # select a panicking behavior +//! $ cargo add panic-abort //! //! $ # memory layout of the device //! $ $EDITOR memory.x && cat $_ @@ -63,6 +58,7 @@ //! #![no_std] //! //! extern crate cortex_m_rt; +//! extern crate panic_abort; // panicking behavior //! //! fn main() { //! // do something here @@ -276,7 +272,6 @@ //! [qs]: https://docs.rs/cortex-m-quickstart/0.2.0/cortex_m_quickstart/ //! [2]: https://sourceware.org/binutils/docs/ld/MEMORY.html -#![cfg_attr(any(target_arch = "arm", feature = "abort-on-panic"), feature(core_intrinsics))] #![deny(missing_docs)] #![deny(warnings)] #![feature(asm)] |