diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e5e2e8f7cd..529b1f8f3e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -173,13 +173,12 @@ jobs: cd examples-runner cargo xtask --target ${{ matrix.target }} --runner qemu - testexamplesembeddedci: - name: testexamplesembeddedci + testexamplesembeddedcim0: + name: testexamplesembeddedcim0 runs-on: ubuntu-20.04 strategy: matrix: target: - - thumbv7m-none-eabi - thumbv6m-none-eabi toolchain: - stable @@ -211,7 +210,124 @@ jobs: EMBEDDED_CI_SERVER: ${{ secrets.EMBEDDED_CI_SERVER }} run: | cd examples-runner - cargo xtask --target ${{ matrix.target }} --runner embedded-ci + cargo xtask --target ${{ matrix.target }} --runner embedded-ci --core-runner cortex-m0 + + testexamplesembeddedcim3: + name: testexamplesembeddedcim3 + runs-on: ubuntu-20.04 + strategy: + matrix: + target: + - thumbv7m-none-eabi + toolchain: + - stable + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install Rust ${{ matrix.toolchain }} with target (${{ matrix.target }}) + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.toolchain }} + target: ${{ matrix.target }} + override: true + components: llvm-tools-preview + + - name: Cache Dependencies + uses: Swatinem/rust-cache@v1 + + - name: Install embedded-ci-client + run: | + cargo install --git https://github.com/korken89/embedded-ci.git embedded-ci-client + + - name: Fail on warnings + run: sed -i 's,//deny_warnings_placeholder_for_ci,#![deny(warnings)],' src/lib.rs macros/src/lib.rs + + - name: Run-pass tests + env: + EMBEDDED_CI_TOKEN: ${{ secrets.EMBEDDED_CI_TOKEN }} + EMBEDDED_CI_SERVER: ${{ secrets.EMBEDDED_CI_SERVER }} + run: | + cd examples-runner + cargo xtask --target ${{ matrix.target }} --runner embedded-ci --core-runner cortex-m3 + + testexamplesembeddedcim4: + name: testexamplesembeddedcim4 + runs-on: ubuntu-20.04 + strategy: + matrix: + target: + - thumbv7m-none-eabi + toolchain: + - stable + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install Rust ${{ matrix.toolchain }} with target (${{ matrix.target }}) + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.toolchain }} + target: ${{ matrix.target }} + override: true + components: llvm-tools-preview + + - name: Cache Dependencies + uses: Swatinem/rust-cache@v1 + + - name: Install embedded-ci-client + run: | + cargo install --git https://github.com/korken89/embedded-ci.git embedded-ci-client + + - name: Fail on warnings + run: sed -i 's,//deny_warnings_placeholder_for_ci,#![deny(warnings)],' src/lib.rs macros/src/lib.rs + + - name: Run-pass tests + env: + EMBEDDED_CI_TOKEN: ${{ secrets.EMBEDDED_CI_TOKEN }} + EMBEDDED_CI_SERVER: ${{ secrets.EMBEDDED_CI_SERVER }} + run: | + cd examples-runner + cargo xtask --target ${{ matrix.target }} --runner embedded-ci --core-runner cortex-m4 + + testexamplesembeddedcim7: + name: testexamplesembeddedcim7 + runs-on: ubuntu-20.04 + strategy: + matrix: + target: + - thumbv7m-none-eabi + toolchain: + - stable + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install Rust ${{ matrix.toolchain }} with target (${{ matrix.target }}) + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.toolchain }} + target: ${{ matrix.target }} + override: true + components: llvm-tools-preview + + - name: Cache Dependencies + uses: Swatinem/rust-cache@v1 + + - name: Install embedded-ci-client + run: | + cargo install --git https://github.com/korken89/embedded-ci.git embedded-ci-client + + - name: Fail on warnings + run: sed -i 's,//deny_warnings_placeholder_for_ci,#![deny(warnings)],' src/lib.rs macros/src/lib.rs + + - name: Run-pass tests + env: + EMBEDDED_CI_TOKEN: ${{ secrets.EMBEDDED_CI_TOKEN }} + EMBEDDED_CI_SERVER: ${{ secrets.EMBEDDED_CI_SERVER }} + run: | + cd examples-runner + cargo xtask --target ${{ matrix.target }} --runner embedded-ci --core-runner cortex-m7 # Check the correctness of macros/ crate checkmacros: @@ -408,7 +524,10 @@ jobs: - clippy - checkexamples - testexamplesqemu - - testexamplesembeddedci + - testexamplesembeddedcim0 + - testexamplesembeddedcim3 + - testexamplesembeddedcim4 + - testexamplesembeddedcim7 - checkmacros - testmacros - tests @@ -591,7 +710,10 @@ jobs: - clippy - checkexamples - testexamplesqemu - - testexamplesembeddedci + - testexamplesembeddedcim0 + - testexamplesembeddedcim3 + - testexamplesembeddedcim4 + - testexamplesembeddedcim7 - checkmacros - testmacros - tests diff --git a/examples-runner/src/bin/cancel-reschedule.rs b/examples-runner/src/bin/cancel-reschedule.rs index 0f9398c4f8..6f1e62a158 100644 --- a/examples-runner/src/bin/cancel-reschedule.rs +++ b/examples-runner/src/bin/cancel-reschedule.rs @@ -25,8 +25,7 @@ mod app { fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) { let systick = cx.core.SYST; - // Initialize the monotonic (SysTick rate in QEMU is 12 MHz) - let mono = Systick::new(systick, 12_000_000); + let mono = Systick::new(systick, 1_000_000); println!("init"); diff --git a/examples-runner/src/bin/periodic-at.rs b/examples-runner/src/bin/periodic-at.rs index 8e235c23c3..59689b9628 100644 --- a/examples-runner/src/bin/periodic-at.rs +++ b/examples-runner/src/bin/periodic-at.rs @@ -25,8 +25,7 @@ mod app { fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) { let systick = cx.core.SYST; - // Initialize the monotonic (SysTick rate in QEMU is 12 MHz) - let mut mono = Systick::new(systick, 12_000_000); + let mut mono = Systick::new(systick, 1_000_000); foo::spawn_after(1.secs(), mono.now()).unwrap(); diff --git a/examples-runner/src/bin/periodic-at2.rs b/examples-runner/src/bin/periodic-at2.rs index 5071c430f6..1cea1c4788 100644 --- a/examples-runner/src/bin/periodic-at2.rs +++ b/examples-runner/src/bin/periodic-at2.rs @@ -25,8 +25,7 @@ mod app { fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) { let systick = cx.core.SYST; - // Initialize the monotonic (SysTick rate in QEMU is 12 MHz) - let mut mono = Systick::new(systick, 12_000_000); + let mut mono = Systick::new(systick, 1_000_000); foo::spawn_after(1.secs(), mono.now()).unwrap(); diff --git a/examples-runner/src/bin/periodic.rs b/examples-runner/src/bin/periodic.rs index e654820297..45600e1e44 100644 --- a/examples-runner/src/bin/periodic.rs +++ b/examples-runner/src/bin/periodic.rs @@ -25,8 +25,8 @@ mod app { fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) { let systick = cx.core.SYST; - // Initialize the monotonic (SysTick rate in QEMU is 12 MHz) - let mono = Systick::new(systick, 12_000_000); + // Initialize the monotonic + let mono = Systick::new(systick, 1_000_000); foo::spawn_after(1.secs()).unwrap(); diff --git a/examples-runner/src/bin/schedule.rs b/examples-runner/src/bin/schedule.rs index 4242d7e5ff..1e319461f0 100644 --- a/examples-runner/src/bin/schedule.rs +++ b/examples-runner/src/bin/schedule.rs @@ -25,8 +25,7 @@ mod app { fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) { let systick = cx.core.SYST; - // Initialize the monotonic (SysTick rate in QEMU is 12 MHz) - let mono = Systick::new(systick, 12_000_000); + let mono = Systick::new(systick, 1_000_000); println!("init"); diff --git a/examples-runner/xtask/src/command.rs b/examples-runner/xtask/src/command.rs index 38ddba72d0..5b88451a49 100644 --- a/examples-runner/xtask/src/command.rs +++ b/examples-runner/xtask/src/command.rs @@ -17,6 +17,14 @@ pub enum Runner { EmbeddedCi, } +#[derive(Debug, Copy, Clone, PartialEq, Eq, ArgEnum)] +pub enum CoreRun { + CortexM0, + CortexM3, + CortexM4, + CortexM7, +} + #[derive(Debug)] pub enum CargoCommand<'a> { Run { @@ -25,6 +33,7 @@ pub enum CargoCommand<'a> { features: Option<&'a str>, mode: BuildMode, runner: Runner, + core_runner: Option, }, BuildAll { target: &'a str, @@ -54,6 +63,7 @@ impl<'a> CargoCommand<'a> { features, mode, runner, + core_runner, } => match runner { Runner::Qemu => { let mut args = vec![self.name(), "--bin", example, "--target", target]; @@ -68,12 +78,22 @@ impl<'a> CargoCommand<'a> { } Runner::EmbeddedCi => { let mut args = vec![]; - if target.contains("thumbv6") { - args.extend_from_slice(&["--cores", "cortexm0plus"]) - } else if target.contains("thumbv7") { - args.extend_from_slice(&["--cores", "cortexm3,cortexm4,cortexm7"]) - } else { - panic!("Unknown target: {}", target); + match core_runner { + Some(CoreRun::CortexM0) => { + args.extend_from_slice(&["--cores", "cortexm0plus"]) + } + Some(CoreRun::CortexM3) => args.extend_from_slice(&["--cores", "cortexm3"]), + Some(CoreRun::CortexM4) => args.extend_from_slice(&["--cores", "cortexm4"]), + Some(CoreRun::CortexM7) => args.extend_from_slice(&["--cores", "cortexm7"]), + None => { + if target.contains("thumbv6") { + args.extend_from_slice(&["--cores", "cortexm0plus"]) + } else if target.contains("thumbv7") { + args.extend_from_slice(&["--cores", "cortexm3,cortexm4,cortexm7"]) + } else { + panic!("Unknown target: {}", target); + } + } } let s = Box::new(format!("target/{target}/{mode}/{example}")); let s = s.into_boxed_str(); @@ -112,6 +132,7 @@ impl<'a> CargoCommand<'a> { features: _, mode: _, runner, + core_runner: _, } => match runner { Runner::Qemu => "cargo", Runner::EmbeddedCi => "embedded-ci-client", diff --git a/examples-runner/xtask/src/main.rs b/examples-runner/xtask/src/main.rs index 459307ac85..5063508fdf 100644 --- a/examples-runner/xtask/src/main.rs +++ b/examples-runner/xtask/src/main.rs @@ -2,7 +2,7 @@ mod build; mod command; use anyhow::bail; -use clap::Parser; +use clap::{ArgEnum, Parser}; use core::fmt; use std::{ error::Error, @@ -15,7 +15,7 @@ use std::{ use crate::{ build::init_build_dir, - command::{run_command, run_successful, BuildMode, CargoCommand, Runner}, + command::{run_command, run_successful, BuildMode, CargoCommand, Runner, CoreRun}, }; const ARMV6M: &str = "thumbv6m-none-eabi"; @@ -28,6 +28,8 @@ struct Options { target: String, #[clap(short, long, arg_enum)] runner: Runner, + #[clap(short, long, arg_enum)] + core_runner: Option } #[derive(Debug, Clone)] @@ -99,14 +101,14 @@ fn main() -> anyhow::Result<()> { let opts = Options::parse(); let target = &opts.target; - init_build_dir()?; + // init_build_dir()?; if target == "all" { for t in targets { - run_tests(t, opts.runner, &examples)?; + run_tests(t, opts.runner, opts.core_runner, &examples)?; } } else if targets.contains(&target.as_str()) { - run_tests(&target, opts.runner, &examples)?; + run_tests(&target, opts.runner, opts.core_runner, &examples)?; } else { eprintln!( "The target you specified is not available. Available targets are:\ @@ -120,7 +122,7 @@ fn main() -> anyhow::Result<()> { Ok(()) } -fn run_tests(target: &str, runner: Runner, examples: &[String]) -> anyhow::Result<()> { +fn run_tests(target: &str, runner: Runner, core_runner: Option, examples: &[String]) -> anyhow::Result<()> { let features = Some(match runner { Runner::Qemu => "qemu", Runner::EmbeddedCi => "embedded-ci", @@ -139,6 +141,7 @@ fn run_tests(target: &str, runner: Runner, examples: &[String]) -> anyhow::Resul features, mode: BuildMode::Release, runner, + core_runner, }; arm_example(&cmd)?;