From 17012621dd2562e80446fc7bd12b7a859d19dbad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20J=C3=B6rdens?= Date: Tue, 22 Oct 2019 13:43:49 +0000 Subject: [PATCH] use stable rust (1.38.0) --- Cargo.lock | 7 +++++++ Cargo.toml | 4 +++- README.md | 1 - src/main.rs | 11 +++++++---- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 545313a..e8ec985 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -163,6 +163,11 @@ name = "managed" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "panic-halt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "panic-semihosting" version = "0.5.3" @@ -313,6 +318,7 @@ dependencies = [ "cortex-m-rtfm 0.5.0-beta.1 (git+https://github.com/rtfm-rs/cortex-m-rtfm?rev=3830638)", "heapless 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "panic-halt 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "panic-semihosting 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", "serde-json-core 0.0.1 (git+https://github.com/quartiq/serde-json-core.git?rev=fc764de)", @@ -405,6 +411,7 @@ dependencies = [ "checksum indexmap 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a61202fbe46c4a951e9404a720a0180bcf3212c750d735cb5c4ba4dc551299f3" "checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" "checksum managed 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fdcec5e97041c7f0f1c5b7d93f12e57293c831c646f4cc7a5db59460c7ea8de6" +"checksum panic-halt 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de96540e0ebde571dc55c73d60ef407c653844e6f9a1e2fdbd40c07b9252d812" "checksum panic-semihosting 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c03864ac862876c16a308f5286f4aa217f1a69ac45df87ad3cd2847f818a642c" "checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" "checksum proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e98a83a9f9b331f54b924e68a66acb1bb35cb01fb0a23645139967abefb697e8" diff --git a/Cargo.toml b/Cargo.toml index 8d5010d..a386926 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,11 +27,12 @@ features = [] default-target = "thumbv7em-none-eabihf" [dependencies] -cortex-m = { version = "0.6", features = ["inline-asm", "const-fn"] } +cortex-m = { version = "0.6", features = ["const-fn"] } cortex-m-rt = { version = "0.6", features = ["device"] } cortex-m-log = { version = "0.6", features = ["log-integration"] } log = "0.4" panic-semihosting = { version = "0.5", optional = true } +panic-halt = { version = "0.2" } serde = { version = "1.0", features = ["derive"], default-features = false } heapless = { version = "0.5" } @@ -57,6 +58,7 @@ rev = "3830638" [features] semihosting = ["panic-semihosting", "cortex-m-log/semihosting"] bkpt = [ ] +nightly = ["cortex-m/inline-asm"] [profile.dev] codegen-units = 1 diff --git a/README.md b/README.md index efd79e5..8efa07e 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,6 @@ See https://github.com/sinara-hw/Stabilizer * Clone or download this * Get [rustup](https://rustup.rs/) -* `rustup override add nightly` * `rustup target add thumbv7em-none-eabihf` * `cargo build --release` * Do not try the debug (default) mode. It is guaranteed to panic. diff --git a/src/main.rs b/src/main.rs index 92a3574..96ad21e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,13 +1,13 @@ #![no_std] #![no_main] -#![feature(asm)] +#![cfg_attr(feature = "nightly", feature(asm))] // Enable returning `!` -#![feature(never_type)] -#![feature(core_intrinsics)] +#![cfg_attr(feature = "nightly", feature(never_type))] +#![cfg_attr(feature = "nightly", feature(core_intrinsics))] #[inline(never)] #[panic_handler] -#[cfg(not(feature = "semihosting"))] +#[cfg(all(feature = "nightly", not(feature = "semihosting")))] fn panic(_info: &core::panic::PanicInfo) -> ! { let gpiod = unsafe { &*pac::GPIOD::ptr() }; gpiod.odr.modify(|_, w| w.odr6().high().odr12().high()); // FP_LED_1, FP_LED_3 @@ -17,6 +17,9 @@ fn panic(_info: &core::panic::PanicInfo) -> ! { #[cfg(feature = "semihosting")] extern crate panic_semihosting; +#[cfg(not(any(feature = "nightly", feature = "semihosting")))] +extern crate panic_halt; + #[macro_use] extern crate log;