diff --git a/ci/install.sh b/ci/install.sh index 390304b..ea7997c 100644 --- a/ci/install.sh +++ b/ci/install.sh @@ -2,8 +2,6 @@ set -euxo pipefail main() { rustup target add $TARGET - - cargo install cargo-edit || true } main diff --git a/ci/script.sh b/ci/script.sh index 922fdd2..82d2e0f 100644 --- a/ci/script.sh +++ b/ci/script.sh @@ -17,9 +17,7 @@ EOF local examples=( crash - # device hello - itm override-exception-handler panic ) @@ -28,13 +26,29 @@ EOF cargo build --target $TARGET --example $ex --release done - cargo add alloc-cortex-m + # ITM is not available on Cortex-M0 + if [ $TARGET != thumbv6m-none-eabi ]; then + local ex=itm + cargo build --target $TARGET --example $ex + cargo build --target $TARGET --example $ex --release - cargo build --target $TARGET --example allocator - cargo build --target $TARGET --example allocator --release + examples+=( $ex ) - examples+=( allocator ) + fi + # Allocator example needs an extra dependency + cat >>Cargo.toml <<'EOF' +[dependencies.alloc-cortex-m] +version = "0.3.3" +EOF + + local ex=allocator + cargo build --target $TARGET --example $ex + cargo build --target $TARGET --example $ex --release + + examples+=( $ex ) + + # Device example needs an extra dependency if [ $TARGET = thumbv7m-none-eabi ]; then cat >>Cargo.toml <<'EOF' [dependencies.stm32f103xx] @@ -42,10 +56,11 @@ features = ["rt"] version = "0.9.0" EOF - cargo build --target $TARGET --example device - cargo build --target $TARGET --example device --release + local ex=device + cargo build --target $TARGET --example $ex + cargo build --target $TARGET --example $ex --release - examples+=( device ) + examples+=( $ex ) fi IFS=,;eval arm-none-eabi-size target/$TARGET/release/examples/"{${examples[*]}}" diff --git a/examples/itm.rs b/examples/itm.rs index 7cb0dc5..f5b9f17 100644 --- a/examples/itm.rs +++ b/examples/itm.rs @@ -18,7 +18,7 @@ #[macro_use] extern crate cortex_m; extern crate cortex_m_rt; -extern crate panic_itm; // panicking behavior +extern crate panic_abort; // panicking behavior use cortex_m::{asm, Peripherals}; @@ -27,9 +27,6 @@ fn main() { let mut itm = p.ITM; iprintln!(&mut itm.stim[0], "Hello, world!"); - - // Also prints the panic message to the ITM - panic!("Oops"); } // As we are not using interrupts, we just register a dummy catch all handler diff --git a/src/examples/_1_itm.rs b/src/examples/_1_itm.rs index bc5d67c..6793f70 100644 --- a/src/examples/_1_itm.rs +++ b/src/examples/_1_itm.rs @@ -20,7 +20,7 @@ //! #[macro_use] //! extern crate cortex_m; //! extern crate cortex_m_rt; -//! extern crate panic_itm; // panicking behavior +//! extern crate panic_abort; // panicking behavior //! //! use cortex_m::{asm, Peripherals}; //! @@ -29,9 +29,6 @@ //! let mut itm = p.ITM; //! //! iprintln!(&mut itm.stim[0], "Hello, world!"); -//! -//! // Also prints the panic message to the ITM -//! panic!("Oops"); //! } //! //! // As we are not using interrupts, we just register a dummy catch all handler