From 489d5ee2cd40ac9daebe107ffb98df9c4e423299 Mon Sep 17 00:00:00 2001 From: Alex Martens Date: Sun, 4 Feb 2024 14:41:38 -0800 Subject: [PATCH 1/2] probe-run -> probe-rs --- .github/workflows/on-target.yml | 12 ++++++------ testsuite/Cargo.toml | 13 +++---------- testsuite/README.md | 10 +++++----- testsuite/minitest/Cargo.toml | 13 +++---------- testsuite/minitest/macros/Cargo.toml | 1 - testsuite/minitest/src/lib.rs | 13 +------------ testsuite/src/main.rs | 2 +- 7 files changed, 19 insertions(+), 45 deletions(-) diff --git a/.github/workflows/on-target.yml b/.github/workflows/on-target.yml index 7d4d596a..1034607f 100644 --- a/.github/workflows/on-target.yml +++ b/.github/workflows/on-target.yml @@ -21,7 +21,7 @@ jobs: - name: Build testsuite env: RUSTFLAGS: -C link-arg=-Tlink.x -D warnings - run: cargo build -p testsuite --target thumbv7m-none-eabi --features semihosting,cortex-m/critical-section-single-core + run: cargo build -p testsuite --target thumbv7m-none-eabi - name: Install QEMU run: sudo apt-get update && sudo apt-get install qemu qemu-system-arm - name: Run testsuite @@ -47,7 +47,7 @@ jobs: - name: Build testsuite env: RUSTFLAGS: -C link-arg=-Tlink.x -D warnings - run: cargo build -p testsuite --target thumbv6m-none-eabi --features rtt,cortex-m/critical-section-single-core + run: cargo build -p testsuite --target thumbv6m-none-eabi --features rtt - name: Upload testsuite binaries uses: actions/upload-artifact@v4 with: @@ -62,10 +62,10 @@ jobs: - hil-compile-rtt steps: - uses: actions/checkout@v4 - - name: Display probe-run version - run: probe-run --version + - name: Display probe-rs version + run: probe-rs --version - name: List probes - run: probe-run --list-probes + run: probe-rs list - uses: actions/download-artifact@v4 with: name: testsuite-bin @@ -73,7 +73,7 @@ jobs: - name: Run on-target tests timeout-minutes: 5 run: | - probe-run \ + probe-rs run \ --chip STM32F070RBTx \ --connect-under-reset \ testsuite-bin/testsuite diff --git a/testsuite/Cargo.toml b/testsuite/Cargo.toml index 3e111bf4..39d2dad4 100644 --- a/testsuite/Cargo.toml +++ b/testsuite/Cargo.toml @@ -7,18 +7,11 @@ version = "0.1.0" [features] rtt = ["rtt-target", "minitest/rtt"] -semihosting = ["cortex-m-semihosting", "minitest/semihosting"] [dependencies] cortex-m-rt.path = "../cortex-m-rt" -cortex-m.path = "../cortex-m" +cortex-m = { path = "../cortex-m", features = ["critical-section-single-core"] } minitest.path = "minitest" critical-section = "1.0.0" - -[dependencies.rtt-target] -version = "0.3.1" -optional = true - -[dependencies.cortex-m-semihosting] -path = "../cortex-m-semihosting" -optional = true +cortex-m-semihosting.path = "../cortex-m-semihosting" +rtt-target = { version = "0.3.1", optional = true } diff --git a/testsuite/README.md b/testsuite/README.md index c11d8502..c5f5ad7c 100644 --- a/testsuite/README.md +++ b/testsuite/README.md @@ -13,7 +13,7 @@ Assuming you are at the root of the repository you can build like this: ```console $ cd testsuite -$ cargo build --features semihosting +$ cargo build Compiling testsuite v0.1.0 (cortex-m/testsuite) Finished dev [unoptimized + debuginfo] target(s) in 0.08 ``` @@ -27,7 +27,7 @@ For more information on QEMU reference the QEMU section in [The Embedded Rust Bo ```console $ cd testsuite -$ cargo run --features semihosting +$ cargo run Finished dev [unoptimized + debuginfo] target(s) in 0.01s Running `qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel /cortex-m/target/thumbv7m-none-eabi/debug/testsuite` Timer with period zero, disabling @@ -40,10 +40,10 @@ all tests passed! No implementation-specific features are tested right now; any physical `thumbv7m` target should work. -Tests are executed with [probe-run](https://github.com/knurling-rs/probe-run). +Tests are executed with [probe-rs](https://github.com/probe-rs/probe-rs). * Update `memory.x` in the root of the repository to match your target memory layout. -* Change the `probe-run` chip argument to match your chip, supported chips can be found with `probe-run --list-chips` +* Change the `probe-rs` chip argument to match your chip, supported chips can be found with `probe-rs chip list` * Change the target to match your CPU ```console @@ -53,7 +53,7 @@ $ cargo build --target thumbv7em-none-eabi --features rtt Compiling minitest v0.1.0 (/cortex-m/testsuite/minitest) Compiling testsuite v0.1.0 (/cortex-m/testsuite) Finished dev [unoptimized + debuginfo] target(s) in 0.16s -$ probe-run --chip STM32WLE5JCIx --connect-under-reset ../target/thumbv7em-none-eabi/debug/testsuite +$ probe-rs run --chip STM32WLE5JCIx --connect-under-reset ../target/thumbv7em-none-eabi/debug/testsuite (HOST) INFO flashing program (19 pages / 19.00 KiB) (HOST) INFO success! ──────────────────────────────────────────────────────────────────────────────── diff --git a/testsuite/minitest/Cargo.toml b/testsuite/minitest/Cargo.toml index 37a93f01..ecb8f198 100644 --- a/testsuite/minitest/Cargo.toml +++ b/testsuite/minitest/Cargo.toml @@ -6,18 +6,11 @@ edition = "2018" version = "0.1.0" [features] -semihosting = ["cortex-m-semihosting", "minitest-macros/semihosting"] rtt = ["rtt-target", "minitest-macros/rtt"] [dependencies] -cortex-m.path = "../../cortex-m" cortex-m-rt.path = "../../cortex-m-rt" +cortex-m-semihosting.path = "../../cortex-m-semihosting" +cortex-m.path = "../../cortex-m" minitest-macros.path = "macros" - -[dependencies.rtt-target] -version = "0.3.1" -optional = true - -[dependencies.cortex-m-semihosting] -path = "../../cortex-m-semihosting" -optional = true +rtt-target = { version = "0.3.1", optional = true } diff --git a/testsuite/minitest/macros/Cargo.toml b/testsuite/minitest/macros/Cargo.toml index 077e3163..5f11235c 100644 --- a/testsuite/minitest/macros/Cargo.toml +++ b/testsuite/minitest/macros/Cargo.toml @@ -9,7 +9,6 @@ version = "0.1.0" proc-macro = true [features] -semihosting = [] rtt = [] [dependencies] diff --git a/testsuite/minitest/src/lib.rs b/testsuite/minitest/src/lib.rs index d98fb64c..8aeeeb6c 100644 --- a/testsuite/minitest/src/lib.rs +++ b/testsuite/minitest/src/lib.rs @@ -38,33 +38,22 @@ impl TestOutcome for Result { macro_rules! log { ($s:literal $(, $x:expr)* $(,)?) => { { - #[cfg(feature = "semihosting")] + #[cfg(not(feature = "rtt"))] ::cortex_m_semihosting::hprintln!($s $(, $x)*); #[cfg(feature = "rtt")] ::rtt_target::rprintln!($s $(, $x)*); - #[cfg(not(any(feature = "semihosting", feature="rtt")))] - let _ = ($( & $x ),*); } }; } /// Stop all tests without failure. pub fn exit() -> ! { - #[cfg(feature = "rtt")] - cortex_m::asm::bkpt(); - #[cfg(feature = "semihosting")] cortex_m_semihosting::debug::exit(cortex_m_semihosting::debug::EXIT_SUCCESS); - unreachable!() } /// Stop all tests and report a failure. pub fn fail() -> ! { - #[cfg(feature = "rtt")] - cortex_m::asm::udf(); - #[cfg(feature = "semihosting")] cortex_m_semihosting::debug::exit(cortex_m_semihosting::debug::EXIT_FAILURE); - - #[cfg(not(feature = "rtt"))] unreachable!() } diff --git a/testsuite/src/main.rs b/testsuite/src/main.rs index 46ab629b..f6718b36 100644 --- a/testsuite/src/main.rs +++ b/testsuite/src/main.rs @@ -27,7 +27,7 @@ mod tests { } #[test] - #[cfg(not(feature = "semihosting"))] // QEMU does not model the cycle counter + #[cfg(feature = "rtt")] // QEMU does not model the cycle counter fn cycle_count(p: &mut cortex_m::Peripherals) { #[cfg(not(armv6m))] { From d401bb29535865b8054db06a1fea51789bba04e5 Mon Sep 17 00:00:00 2001 From: Alex Martens Date: Sun, 4 Feb 2024 14:43:24 -0800 Subject: [PATCH 2/2] rtt-target: 0.3.1 -> 0.5.0 --- testsuite/Cargo.toml | 2 +- testsuite/minitest/Cargo.toml | 2 +- testsuite/minitest/macros/src/lib.rs | 17 +---------------- 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/testsuite/Cargo.toml b/testsuite/Cargo.toml index 39d2dad4..6a539108 100644 --- a/testsuite/Cargo.toml +++ b/testsuite/Cargo.toml @@ -14,4 +14,4 @@ cortex-m = { path = "../cortex-m", features = ["critical-section-single-core"] } minitest.path = "minitest" critical-section = "1.0.0" cortex-m-semihosting.path = "../cortex-m-semihosting" -rtt-target = { version = "0.3.1", optional = true } +rtt-target = { version = "0.5.0", optional = true } diff --git a/testsuite/minitest/Cargo.toml b/testsuite/minitest/Cargo.toml index ecb8f198..29a09718 100644 --- a/testsuite/minitest/Cargo.toml +++ b/testsuite/minitest/Cargo.toml @@ -13,4 +13,4 @@ cortex-m-rt.path = "../../cortex-m-rt" cortex-m-semihosting.path = "../../cortex-m-semihosting" cortex-m.path = "../../cortex-m" minitest-macros.path = "macros" -rtt-target = { version = "0.3.1", optional = true } +rtt-target = { version = "0.5.0", optional = true } diff --git a/testsuite/minitest/macros/src/lib.rs b/testsuite/minitest/macros/src/lib.rs index e8a1087a..0d0dd0a8 100644 --- a/testsuite/minitest/macros/src/lib.rs +++ b/testsuite/minitest/macros/src/lib.rs @@ -203,22 +203,7 @@ fn tests_impl(args: TokenStream, input: TokenStream) -> parse::Result