Use panic-halt crate, panic-abort requires nightly toolchain features

When trying to follow the Getting Started->Building instructions, the
`panic-abort` crate throws the following build error on rust stable
version 1.33:

```
   Compiling panic-abort v0.3.1
error[E0554]: #![feature] may not be used on the stable release channel
  --> /home/mike/.cargo/registry/src/github.com-1ecc6299db9ec823/panic-abort-0.3.1/src/lib.rs:22:1
   |
22 | #![feature(core_intrinsics)]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0554]: #![feature] may not be used on the stable release channel
  --> /home/mike/.cargo/registry/src/github.com-1ecc6299db9ec823/panic-abort-0.3.1/src/lib.rs:23:1
   |
23 | #![feature(panic_handler)]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0554`.
error: Could not compile `panic-abort`.

To learn more, run the command again with --verbose.
```

Switch to the `panic-halt` crate that builds on stable and provides the
`#[panic_handler]` function necesary to get a minimal successful build.
This commit is contained in:
Michael Mogenson
2019-03-14 10:37:41 -04:00
parent c2d5c26e49
commit 9c6bcd2ee8
3 changed files with 8 additions and 8 deletions

View File

@@ -116,7 +116,7 @@ If you have forgotten how to do this, try looking at [the cargo book][cargo].
``` rust
#![no_std]
extern crate panic_abort;
extern crate panic_halt;
fn main() {
}
@@ -141,8 +141,8 @@ neither the crt0 nor the rust runtime are available,
so even implementing `start` would not help us.
We need to replace the operating system entry point.
You could for example name a function after the default entry point,
which for linux is `_start`, and start that way.
You could for example name a function after the default entry point,
which for linux is `_start`, and start that way.
Note, you would also need to disable [name mangling][nm]:
``` rust
@@ -232,11 +232,11 @@ and cargo will automatically add `--target thumbv6m-none-eabi`.
### `src/main.rs`
``` rust
``` rust
#![no_std]
#![no_main]
extern crate panic_abort;
extern crate panic_halt;
use cortex_m_rt::entry;
@@ -271,7 +271,7 @@ An easy way to implement this is to use an infinite loop.
#![no_std]
#![no_main]
extern crate panic_abort;
extern crate panic_halt;
use cortex_m_rt::entry;

View File

@@ -3,6 +3,6 @@ name = "start"
version = "0.2.0"
[dependencies]
panic-abort = "~0.3"
panic-halt = "~0.2"
microbit="~0.6"
cortex-m-rt="~0.6"

View File

@@ -3,7 +3,7 @@
extern crate cortex_m_rt;
extern crate microbit;
extern crate panic_abort;
extern crate panic_halt;
use cortex_m_rt::entry;