aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/mspm0/Cargo.toml2
-rw-r--r--tests/nrf/Cargo.toml6
-rw-r--r--tests/perf-client/Cargo.toml2
-rw-r--r--tests/rp/Cargo.toml7
-rw-r--r--tests/rp/src/bin/ethernet_w5100s_perf.rs1
-rw-r--r--tests/rp/src/bin/overclock.rs49
-rw-r--r--tests/stm32/Cargo.toml10
-rw-r--r--tests/stm32/src/bin/eth.rs1
-rw-r--r--tests/utils/Cargo.toml2
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
23cortex-m-rt = "0.7.0" 23cortex-m-rt = "0.7.0"
24embedded-hal = { package = "embedded-hal", version = "1.0" } 24embedded-hal = { package = "embedded-hal", version = "1.0" }
25embedded-hal-async = { version = "1.0" } 25embedded-hal-async = { version = "1.0" }
26panic-probe = { version = "0.3.0", features = ["print-defmt"] } 26panic-probe = { version = "1.0.0", features = ["print-defmt"] }
27static_cell = "2" 27static_cell = "2"
28portable-atomic = { version = "1.5", features = ["critical-section"] } 28portable-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"] }
21static_cell = "2" 21static_cell = "2"
22perf-client = { path = "../perf-client" } 22perf-client = { path = "../perf-client" }
23 23
24defmt = "0.3" 24defmt = "1.0.1"
25defmt-rtt = "0.4" 25defmt-rtt = "1.0.0"
26 26
27cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } 27cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
28cortex-m-rt = "0.7.0" 28cortex-m-rt = "0.7.0"
29panic-probe = { version = "0.3", features = ["print-defmt"] } 29panic-probe = { version = "1.0.0", features = ["print-defmt"] }
30portable-atomic = { version = "1.6.0" } 30portable-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"
7embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4"] } 7embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4"] }
8embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", ] } 8embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", ] }
9embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } 9embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
10defmt = "0.3" 10defmt = "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"] }
24cyw43-pio = { path = "../../cyw43-pio", features = ["defmt"] } 24cyw43-pio = { path = "../../cyw43-pio", features = ["defmt"] }
25perf-client = { path = "../perf-client" } 25perf-client = { path = "../perf-client" }
26 26
27defmt = "0.3" 27defmt = "1.0.1"
28defmt-rtt = "0.4" 28defmt-rtt = "1.0.0"
29 29
30cortex-m = { version = "0.7.6" } 30cortex-m = { version = "0.7.6" }
31cortex-m-rt = "0.7.0" 31cortex-m-rt = "0.7.0"
@@ -33,12 +33,11 @@ embedded-hal = "0.2.6"
33embedded-hal-1 = { package = "embedded-hal", version = "1.0" } 33embedded-hal-1 = { package = "embedded-hal", version = "1.0" }
34embedded-hal-async = { version = "1.0" } 34embedded-hal-async = { version = "1.0" }
35embedded-hal-bus = { version = "0.1", features = ["async"] } 35embedded-hal-bus = { version = "0.1", features = ["async"] }
36panic-probe = { version = "0.3.0", features = ["print-defmt"] } 36panic-probe = { version = "1.0.0", features = ["print-defmt"] }
37embedded-io-async = { version = "0.6.1" } 37embedded-io-async = { version = "0.6.1" }
38embedded-storage = { version = "0.3" } 38embedded-storage = { version = "0.3" }
39static_cell = "2" 39static_cell = "2"
40portable-atomic = { version = "1.5", features = ["critical-section"] } 40portable-atomic = { version = "1.5", features = ["critical-section"] }
41rand = { 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;
14use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; 14use embassy_rp::spi::{Async, Config as SpiConfig, Spi};
15use embassy_time::Delay; 15use embassy_time::Delay;
16use embedded_hal_bus::spi::ExclusiveDevice; 16use embedded_hal_bus::spi::ExclusiveDevice;
17use rand::RngCore;
18use static_cell::StaticCell; 17use static_cell::StaticCell;
19use {defmt_rtt as _, panic_probe as _}; 18use {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");
7teleprobe_meta::target!(b"pimoroni-pico-plus-2"); 7teleprobe_meta::target!(b"pimoroni-pico-plus-2");
8 8
9use defmt::info; 9use defmt::info;
10#[cfg(feature = "rp2040")]
11use defmt::{assert, assert_eq};
12use embassy_executor::Spawner; 10use embassy_executor::Spawner;
13use embassy_rp::clocks; 11use embassy_rp::clocks::{clk_sys_freq, core_voltage, ClockConfig, CoreVoltage};
14#[cfg(feature = "rp2040")]
15use embassy_rp::clocks::ClockConfig;
16#[cfg(feature = "rp2040")]
17use embassy_rp::clocks::CoreVoltage;
18use embassy_rp::config::Config; 12use embassy_rp::config::Config;
19use embassy_time::Instant; 13use embassy_time::Instant;
20use {defmt_rtt as _, panic_probe as _}; 14use {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]
25async fn main(_spawner: Spawner) { 19async 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
70embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "tcp", "udp", "dhcpv4", "medium-ethernet"] } 70embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "tcp", "udp", "dhcpv4", "medium-ethernet"] }
71perf-client = { path = "../perf-client" } 71perf-client = { path = "../perf-client" }
72 72
73defmt = "0.3" 73defmt = "1.0.1"
74defmt-rtt = "0.4" 74defmt-rtt = "1.0.0"
75 75
76cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } 76cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
77cortex-m-rt = "0.7.0" 77cortex-m-rt = "0.7.0"
@@ -80,9 +80,9 @@ embedded-hal-1 = { package = "embedded-hal", version = "1.0" }
80embedded-hal-async = { version = "1.0" } 80embedded-hal-async = { version = "1.0" }
81embedded-can = { version = "0.4" } 81embedded-can = { version = "0.4" }
82micromath = "2.0.0" 82micromath = "2.0.0"
83panic-probe = { version = "0.3.0", features = ["print-defmt"] } 83panic-probe = { version = "1.0.0", features = ["print-defmt"] }
84rand_core = { version = "0.6", default-features = false } 84rand_core = { version = "0.9.1", default-features = false }
85rand_chacha = { version = "0.3", default-features = false } 85rand_chacha = { version = "0.9.0", default-features = false }
86static_cell = "2" 86static_cell = "2"
87portable-atomic = { version = "1.5", features = [] } 87portable-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};
11use embassy_stm32::peripherals::ETH; 11use embassy_stm32::peripherals::ETH;
12use embassy_stm32::rng::Rng; 12use embassy_stm32::rng::Rng;
13use embassy_stm32::{bind_interrupts, eth, peripherals, rng}; 13use embassy_stm32::{bind_interrupts, eth, peripherals, rng};
14use rand_core::RngCore;
15use static_cell::StaticCell; 14use static_cell::StaticCell;
16use {defmt_rtt as _, panic_probe as _}; 15use {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"
4edition = "2021" 4edition = "2021"
5 5
6[dependencies] 6[dependencies]
7rand = "0.8" 7rand = "0.9"
8serial = "0.4" 8serial = "0.4"