diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/mspm0/Cargo.toml | 2 | ||||
| -rw-r--r-- | tests/nrf/Cargo.toml | 6 | ||||
| -rw-r--r-- | tests/perf-client/Cargo.toml | 2 | ||||
| -rw-r--r-- | tests/rp/Cargo.toml | 7 | ||||
| -rw-r--r-- | tests/rp/src/bin/ethernet_w5100s_perf.rs | 1 | ||||
| -rw-r--r-- | tests/rp/src/bin/overclock.rs | 49 | ||||
| -rw-r--r-- | tests/stm32/Cargo.toml | 10 | ||||
| -rw-r--r-- | tests/stm32/src/bin/eth.rs | 1 | ||||
| -rw-r--r-- | tests/utils/Cargo.toml | 2 |
9 files changed, 38 insertions, 42 deletions
diff --git a/tests/mspm0/Cargo.toml b/tests/mspm0/Cargo.toml index d76aaff73..386536bee 100644 --- a/tests/mspm0/Cargo.toml +++ b/tests/mspm0/Cargo.toml | |||
| @@ -23,7 +23,7 @@ cortex-m = { version = "0.7.6", features = [ "inline-asm", "critical-section-sin | |||
| 23 | cortex-m-rt = "0.7.0" | 23 | cortex-m-rt = "0.7.0" |
| 24 | embedded-hal = { package = "embedded-hal", version = "1.0" } | 24 | embedded-hal = { package = "embedded-hal", version = "1.0" } |
| 25 | embedded-hal-async = { version = "1.0" } | 25 | embedded-hal-async = { version = "1.0" } |
| 26 | panic-probe = { version = "0.3.0", features = ["print-defmt"] } | 26 | panic-probe = { version = "1.0.0", features = ["print-defmt"] } |
| 27 | static_cell = "2" | 27 | static_cell = "2" |
| 28 | portable-atomic = { version = "1.5", features = ["critical-section"] } | 28 | portable-atomic = { version = "1.5", features = ["critical-section"] } |
| 29 | 29 | ||
diff --git a/tests/nrf/Cargo.toml b/tests/nrf/Cargo.toml index 410d62bdd..32087940e 100644 --- a/tests/nrf/Cargo.toml +++ b/tests/nrf/Cargo.toml | |||
| @@ -21,12 +21,12 @@ embedded-hal-bus = { version = "0.1", features = ["async"] } | |||
| 21 | static_cell = "2" | 21 | static_cell = "2" |
| 22 | perf-client = { path = "../perf-client" } | 22 | perf-client = { path = "../perf-client" } |
| 23 | 23 | ||
| 24 | defmt = "0.3" | 24 | defmt = "1.0.1" |
| 25 | defmt-rtt = "0.4" | 25 | defmt-rtt = "1.0.0" |
| 26 | 26 | ||
| 27 | cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } | 27 | cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } |
| 28 | cortex-m-rt = "0.7.0" | 28 | cortex-m-rt = "0.7.0" |
| 29 | panic-probe = { version = "0.3", features = ["print-defmt"] } | 29 | panic-probe = { version = "1.0.0", features = ["print-defmt"] } |
| 30 | portable-atomic = { version = "1.6.0" } | 30 | portable-atomic = { version = "1.6.0" } |
| 31 | 31 | ||
| 32 | [features] | 32 | [features] |
diff --git a/tests/perf-client/Cargo.toml b/tests/perf-client/Cargo.toml index 9620972c3..e31d6361b 100644 --- a/tests/perf-client/Cargo.toml +++ b/tests/perf-client/Cargo.toml | |||
| @@ -7,4 +7,4 @@ edition = "2021" | |||
| 7 | embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4"] } | 7 | embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4"] } |
| 8 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", ] } | 8 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", ] } |
| 9 | embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } | 9 | embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } |
| 10 | defmt = "0.3" | 10 | defmt = "1.0.1" |
diff --git a/tests/rp/Cargo.toml b/tests/rp/Cargo.toml index 1335aa84b..2c2ed73cc 100644 --- a/tests/rp/Cargo.toml +++ b/tests/rp/Cargo.toml | |||
| @@ -24,8 +24,8 @@ cyw43 = { path = "../../cyw43", features = ["defmt", "firmware-logs"] } | |||
| 24 | cyw43-pio = { path = "../../cyw43-pio", features = ["defmt"] } | 24 | cyw43-pio = { path = "../../cyw43-pio", features = ["defmt"] } |
| 25 | perf-client = { path = "../perf-client" } | 25 | perf-client = { path = "../perf-client" } |
| 26 | 26 | ||
| 27 | defmt = "0.3" | 27 | defmt = "1.0.1" |
| 28 | defmt-rtt = "0.4" | 28 | defmt-rtt = "1.0.0" |
| 29 | 29 | ||
| 30 | cortex-m = { version = "0.7.6" } | 30 | cortex-m = { version = "0.7.6" } |
| 31 | cortex-m-rt = "0.7.0" | 31 | cortex-m-rt = "0.7.0" |
| @@ -33,12 +33,11 @@ embedded-hal = "0.2.6" | |||
| 33 | embedded-hal-1 = { package = "embedded-hal", version = "1.0" } | 33 | embedded-hal-1 = { package = "embedded-hal", version = "1.0" } |
| 34 | embedded-hal-async = { version = "1.0" } | 34 | embedded-hal-async = { version = "1.0" } |
| 35 | embedded-hal-bus = { version = "0.1", features = ["async"] } | 35 | embedded-hal-bus = { version = "0.1", features = ["async"] } |
| 36 | panic-probe = { version = "0.3.0", features = ["print-defmt"] } | 36 | panic-probe = { version = "1.0.0", features = ["print-defmt"] } |
| 37 | embedded-io-async = { version = "0.6.1" } | 37 | embedded-io-async = { version = "0.6.1" } |
| 38 | embedded-storage = { version = "0.3" } | 38 | embedded-storage = { version = "0.3" } |
| 39 | static_cell = "2" | 39 | static_cell = "2" |
| 40 | portable-atomic = { version = "1.5", features = ["critical-section"] } | 40 | portable-atomic = { version = "1.5", features = ["critical-section"] } |
| 41 | rand = { version = "0.8.5", default-features = false } | ||
| 42 | 41 | ||
| 43 | # bootsel not currently supported on 2350 | 42 | # bootsel not currently supported on 2350 |
| 44 | [[bin]] | 43 | [[bin]] |
diff --git a/tests/rp/src/bin/ethernet_w5100s_perf.rs b/tests/rp/src/bin/ethernet_w5100s_perf.rs index ae2adfa55..89e0ad32e 100644 --- a/tests/rp/src/bin/ethernet_w5100s_perf.rs +++ b/tests/rp/src/bin/ethernet_w5100s_perf.rs | |||
| @@ -14,7 +14,6 @@ use embassy_rp::peripherals::SPI0; | |||
| 14 | use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; | 14 | use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; |
| 15 | use embassy_time::Delay; | 15 | use embassy_time::Delay; |
| 16 | use embedded_hal_bus::spi::ExclusiveDevice; | 16 | use embedded_hal_bus::spi::ExclusiveDevice; |
| 17 | use rand::RngCore; | ||
| 18 | use static_cell::StaticCell; | 17 | use static_cell::StaticCell; |
| 19 | use {defmt_rtt as _, panic_probe as _}; | 18 | use {defmt_rtt as _, panic_probe as _}; |
| 20 | 19 | ||
diff --git a/tests/rp/src/bin/overclock.rs b/tests/rp/src/bin/overclock.rs index be8e85a3f..167a26eb2 100644 --- a/tests/rp/src/bin/overclock.rs +++ b/tests/rp/src/bin/overclock.rs | |||
| @@ -7,14 +7,8 @@ teleprobe_meta::target!(b"rpi-pico"); | |||
| 7 | teleprobe_meta::target!(b"pimoroni-pico-plus-2"); | 7 | teleprobe_meta::target!(b"pimoroni-pico-plus-2"); |
| 8 | 8 | ||
| 9 | use defmt::info; | 9 | use defmt::info; |
| 10 | #[cfg(feature = "rp2040")] | ||
| 11 | use defmt::{assert, assert_eq}; | ||
| 12 | use embassy_executor::Spawner; | 10 | use embassy_executor::Spawner; |
| 13 | use embassy_rp::clocks; | 11 | use embassy_rp::clocks::{clk_sys_freq, core_voltage, ClockConfig, CoreVoltage}; |
| 14 | #[cfg(feature = "rp2040")] | ||
| 15 | use embassy_rp::clocks::ClockConfig; | ||
| 16 | #[cfg(feature = "rp2040")] | ||
| 17 | use embassy_rp::clocks::CoreVoltage; | ||
| 18 | use embassy_rp::config::Config; | 12 | use embassy_rp::config::Config; |
| 19 | use embassy_time::Instant; | 13 | use embassy_time::Instant; |
| 20 | use {defmt_rtt as _, panic_probe as _}; | 14 | use {defmt_rtt as _, panic_probe as _}; |
| @@ -23,23 +17,26 @@ const COUNT_TO: i64 = 10_000_000; | |||
| 23 | 17 | ||
| 24 | #[embassy_executor::main] | 18 | #[embassy_executor::main] |
| 25 | async fn main(_spawner: Spawner) { | 19 | async fn main(_spawner: Spawner) { |
| 26 | #[cfg(feature = "rp2040")] | ||
| 27 | let mut config = Config::default(); | 20 | let mut config = Config::default(); |
| 28 | #[cfg(not(feature = "rp2040"))] | ||
| 29 | let config = Config::default(); | ||
| 30 | 21 | ||
| 31 | // Initialize with 200MHz clock configuration for RP2040, other chips will use default clock | 22 | // Initialize with 200MHz clock configuration |
| 32 | #[cfg(feature = "rp2040")] | 23 | config.clocks = ClockConfig::system_freq(200_000_000).unwrap(); |
| 24 | |||
| 25 | // if we are rp235x, we need to manually set the core voltage. rp2040 should do this automatically | ||
| 26 | #[cfg(feature = "rp235xb")] | ||
| 33 | { | 27 | { |
| 34 | config.clocks = ClockConfig::system_freq(200_000_000); | 28 | config.clocks.core_voltage = CoreVoltage::V1_15; |
| 35 | let voltage = config.clocks.core_voltage; | ||
| 36 | assert!(matches!(voltage, CoreVoltage::V1_15), "Expected voltage scale V1_15"); | ||
| 37 | } | 29 | } |
| 38 | 30 | ||
| 39 | let _p = embassy_rp::init(config); | 31 | let _p = embassy_rp::init(config); |
| 40 | 32 | ||
| 33 | // We should be at core voltage of 1.15V | ||
| 34 | assert_eq!(core_voltage().unwrap(), CoreVoltage::V1_15, "Core voltage is not 1.15V"); | ||
| 35 | // We should be at 200MHz | ||
| 36 | assert_eq!(clk_sys_freq(), 200_000_000, "System clock frequency is not 200MHz"); | ||
| 37 | |||
| 41 | // Test the system speed | 38 | // Test the system speed |
| 42 | let (time_elapsed, clk_sys_freq) = { | 39 | let time_elapsed = { |
| 43 | let mut counter = 0; | 40 | let mut counter = 0; |
| 44 | let start = Instant::now(); | 41 | let start = Instant::now(); |
| 45 | while counter < COUNT_TO { | 42 | while counter < COUNT_TO { |
| @@ -47,24 +44,26 @@ async fn main(_spawner: Spawner) { | |||
| 47 | } | 44 | } |
| 48 | let elapsed = Instant::now() - start; | 45 | let elapsed = Instant::now() - start; |
| 49 | 46 | ||
| 50 | (elapsed.as_millis(), clocks::clk_sys_freq()) | 47 | elapsed.as_millis() |
| 51 | }; | 48 | }; |
| 52 | 49 | ||
| 53 | // Report the elapsed time, so that the compiler doesn't optimize it away for chips other than RP2040 | 50 | // Tests will fail if unused variables are detected: |
| 51 | // Report the elapsed time, so that the compiler doesn't optimize it away for the chip not on test | ||
| 54 | info!( | 52 | info!( |
| 55 | "At {}Mhz: Elapsed time to count to {}: {}ms", | 53 | "At {}Mhz: Elapsed time to count to {}: {}ms", |
| 56 | clk_sys_freq / 1_000_000, | 54 | clk_sys_freq() / 1_000_000, |
| 57 | COUNT_TO, | 55 | COUNT_TO, |
| 58 | time_elapsed | 56 | time_elapsed |
| 59 | ); | 57 | ); |
| 60 | 58 | ||
| 59 | // Check if the elapsed time is within expected limits | ||
| 60 | // for rp2040 we expect about 600ms | ||
| 61 | #[cfg(feature = "rp2040")] | 61 | #[cfg(feature = "rp2040")] |
| 62 | { | 62 | // allow 1% error |
| 63 | // we should be at 200MHz | 63 | assert!(time_elapsed < 606, "Elapsed time is too long"); |
| 64 | assert_eq!(clk_sys_freq, 200_000_000, "System clock frequency is not 200MHz"); | 64 | // for rp235x we expect about 450ms |
| 65 | // At 200MHz, the time to count to 10_000_000 should be at 600ms, testing with 1% margin | 65 | #[cfg(feature = "rp235xb")] |
| 66 | assert!(time_elapsed <= 606, "Elapsed time is too long"); | 66 | assert!(time_elapsed < 455, "Elapsed time is too long"); |
| 67 | } | ||
| 68 | 67 | ||
| 69 | cortex_m::asm::bkpt(); | 68 | cortex_m::asm::bkpt(); |
| 70 | } | 69 | } |
diff --git a/tests/stm32/Cargo.toml b/tests/stm32/Cargo.toml index 3a347e279..6036a5a97 100644 --- a/tests/stm32/Cargo.toml +++ b/tests/stm32/Cargo.toml | |||
| @@ -70,8 +70,8 @@ embassy-stm32-wpan = { version = "0.1.0", path = "../../embassy-stm32-wpan", opt | |||
| 70 | embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "tcp", "udp", "dhcpv4", "medium-ethernet"] } | 70 | embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "tcp", "udp", "dhcpv4", "medium-ethernet"] } |
| 71 | perf-client = { path = "../perf-client" } | 71 | perf-client = { path = "../perf-client" } |
| 72 | 72 | ||
| 73 | defmt = "0.3" | 73 | defmt = "1.0.1" |
| 74 | defmt-rtt = "0.4" | 74 | defmt-rtt = "1.0.0" |
| 75 | 75 | ||
| 76 | cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } | 76 | cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } |
| 77 | cortex-m-rt = "0.7.0" | 77 | cortex-m-rt = "0.7.0" |
| @@ -80,9 +80,9 @@ embedded-hal-1 = { package = "embedded-hal", version = "1.0" } | |||
| 80 | embedded-hal-async = { version = "1.0" } | 80 | embedded-hal-async = { version = "1.0" } |
| 81 | embedded-can = { version = "0.4" } | 81 | embedded-can = { version = "0.4" } |
| 82 | micromath = "2.0.0" | 82 | micromath = "2.0.0" |
| 83 | panic-probe = { version = "0.3.0", features = ["print-defmt"] } | 83 | panic-probe = { version = "1.0.0", features = ["print-defmt"] } |
| 84 | rand_core = { version = "0.6", default-features = false } | 84 | rand_core = { version = "0.9.1", default-features = false } |
| 85 | rand_chacha = { version = "0.3", default-features = false } | 85 | rand_chacha = { version = "0.9.0", default-features = false } |
| 86 | static_cell = "2" | 86 | static_cell = "2" |
| 87 | portable-atomic = { version = "1.5", features = [] } | 87 | portable-atomic = { version = "1.5", features = [] } |
| 88 | 88 | ||
diff --git a/tests/stm32/src/bin/eth.rs b/tests/stm32/src/bin/eth.rs index a7e76fd8e..bcb362b42 100644 --- a/tests/stm32/src/bin/eth.rs +++ b/tests/stm32/src/bin/eth.rs | |||
| @@ -11,7 +11,6 @@ use embassy_stm32::eth::{Ethernet, GenericPhy, PacketQueue}; | |||
| 11 | use embassy_stm32::peripherals::ETH; | 11 | use embassy_stm32::peripherals::ETH; |
| 12 | use embassy_stm32::rng::Rng; | 12 | use embassy_stm32::rng::Rng; |
| 13 | use embassy_stm32::{bind_interrupts, eth, peripherals, rng}; | 13 | use embassy_stm32::{bind_interrupts, eth, peripherals, rng}; |
| 14 | use rand_core::RngCore; | ||
| 15 | use static_cell::StaticCell; | 14 | use static_cell::StaticCell; |
| 16 | use {defmt_rtt as _, panic_probe as _}; | 15 | use {defmt_rtt as _, panic_probe as _}; |
| 17 | 16 | ||
diff --git a/tests/utils/Cargo.toml b/tests/utils/Cargo.toml index 7b54a4f52..bda55ad32 100644 --- a/tests/utils/Cargo.toml +++ b/tests/utils/Cargo.toml | |||
| @@ -4,5 +4,5 @@ version = "0.1.0" | |||
| 4 | edition = "2021" | 4 | edition = "2021" |
| 5 | 5 | ||
| 6 | [dependencies] | 6 | [dependencies] |
| 7 | rand = "0.8" | 7 | rand = "0.9" |
| 8 | serial = "0.4" | 8 | serial = "0.4" |
