From 7976f950b0de72c521f92efa350c67ccd197fab9 Mon Sep 17 00:00:00 2001 From: Matteo Meluzzi Date: Fri, 24 Oct 2025 15:48:34 +0200 Subject: Merge branch 'main' into 17-add-support-for-boot-protocol --- tests/mspm0/Cargo.toml | 2 +- tests/mspm0/src/bin/dma.rs | 2 +- tests/nrf/Cargo.toml | 2 +- tests/perf-client/Cargo.toml | 2 +- tests/perf-client/src/lib.rs | 2 +- tests/perf-server/Cargo.toml | 2 +- tests/riscv32/Cargo.toml | 2 +- tests/rp/Cargo.toml | 2 +- tests/rp/src/bin/cyw43-perf.rs | 2 +- tests/rp/src/bin/gpio_multicore.rs | 4 ++-- tests/rp/src/bin/multicore.rs | 2 +- tests/rp/src/bin/overclock.rs | 2 +- tests/rp/src/bin/pio_multi_load.rs | 4 +++- tests/rp/src/bin/rtc.rs | 2 +- tests/rp/src/bin/spinlock_mutex_multicore.rs | 2 +- tests/stm32/Cargo.toml | 2 +- tests/stm32/src/bin/afio.rs | 2 +- tests/stm32/src/bin/cryp.rs | 2 +- tests/stm32/src/bin/fdcan.rs | 2 +- tests/stm32/src/bin/stop.rs | 4 ++-- tests/stm32/src/bin/ucpd.rs | 2 +- tests/stm32/src/bin/usart.rs | 2 +- tests/stm32/src/bin/wpan_ble.rs | 4 ++-- tests/stm32/src/bin/wpan_mac.rs | 2 +- tests/stm32/src/common.rs | 2 +- tests/utils/Cargo.toml | 2 +- tests/utils/src/bin/saturate_serial.rs | 2 +- 27 files changed, 32 insertions(+), 30 deletions(-) (limited to 'tests') diff --git a/tests/mspm0/Cargo.toml b/tests/mspm0/Cargo.toml index 227d898d5..df52b538d 100644 --- a/tests/mspm0/Cargo.toml +++ b/tests/mspm0/Cargo.toml @@ -1,5 +1,5 @@ [package] -edition = "2021" +edition = "2024" name = "embassy-mspm0-tests" version = "0.1.0" license = "MIT OR Apache-2.0" diff --git a/tests/mspm0/src/bin/dma.rs b/tests/mspm0/src/bin/dma.rs index 6fd973a18..9c56acadc 100644 --- a/tests/mspm0/src/bin/dma.rs +++ b/tests/mspm0/src/bin/dma.rs @@ -11,8 +11,8 @@ use core::slice; use defmt::{assert, assert_eq, *}; use embassy_executor::Spawner; -use embassy_mspm0::dma::{Channel, Transfer, TransferMode, TransferOptions, Word}; use embassy_mspm0::Peri; +use embassy_mspm0::dma::{Channel, Transfer, TransferMode, TransferOptions, Word}; use {defmt_rtt as _, panic_probe as _}; #[embassy_executor::main] diff --git a/tests/nrf/Cargo.toml b/tests/nrf/Cargo.toml index 8acf27ce7..3a9b86cef 100644 --- a/tests/nrf/Cargo.toml +++ b/tests/nrf/Cargo.toml @@ -1,5 +1,5 @@ [package] -edition = "2021" +edition = "2024" name = "embassy-nrf-examples" version = "0.1.0" license = "MIT OR Apache-2.0" diff --git a/tests/perf-client/Cargo.toml b/tests/perf-client/Cargo.toml index c426fdd74..3756046fa 100644 --- a/tests/perf-client/Cargo.toml +++ b/tests/perf-client/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "perf-client" version = "0.1.0" -edition = "2021" +edition = "2024" license = "MIT OR Apache-2.0" publish = false diff --git a/tests/perf-client/src/lib.rs b/tests/perf-client/src/lib.rs index 4bd9e5674..1ba071e8d 100644 --- a/tests/perf-client/src/lib.rs +++ b/tests/perf-client/src/lib.rs @@ -4,7 +4,7 @@ use defmt::{assert, *}; use embassy_futures::join::join; use embassy_net::tcp::TcpSocket; use embassy_net::{Ipv4Address, Stack}; -use embassy_time::{with_timeout, Duration, Timer}; +use embassy_time::{Duration, Timer, with_timeout}; pub struct Expected { pub down_kbps: usize, diff --git a/tests/perf-server/Cargo.toml b/tests/perf-server/Cargo.toml index f048eade2..72f92ed8d 100644 --- a/tests/perf-server/Cargo.toml +++ b/tests/perf-server/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "perf-server" version = "0.1.0" -edition = "2021" +edition = "2024" license = "MIT OR Apache-2.0" publish = false diff --git a/tests/riscv32/Cargo.toml b/tests/riscv32/Cargo.toml index c441e8ed3..935c6a2ee 100644 --- a/tests/riscv32/Cargo.toml +++ b/tests/riscv32/Cargo.toml @@ -1,5 +1,5 @@ [package] -edition = "2021" +edition = "2024" name = "embassy-riscv-tests" version = "0.1.0" license = "MIT OR Apache-2.0" diff --git a/tests/rp/Cargo.toml b/tests/rp/Cargo.toml index 19461520a..640e58f11 100644 --- a/tests/rp/Cargo.toml +++ b/tests/rp/Cargo.toml @@ -1,5 +1,5 @@ [package] -edition = "2021" +edition = "2024" name = "embassy-rp-tests" version = "0.1.0" license = "MIT OR Apache-2.0" diff --git a/tests/rp/src/bin/cyw43-perf.rs b/tests/rp/src/bin/cyw43-perf.rs index 555134ffd..9487f5e1a 100644 --- a/tests/rp/src/bin/cyw43-perf.rs +++ b/tests/rp/src/bin/cyw43-perf.rs @@ -3,7 +3,7 @@ teleprobe_meta::target!(b"rpi-pico"); use cyw43::JoinOptions; -use cyw43_pio::{PioSpi, DEFAULT_CLOCK_DIVIDER}; +use cyw43_pio::{DEFAULT_CLOCK_DIVIDER, PioSpi}; use defmt::{panic, *}; use embassy_executor::Spawner; use embassy_net::{Config, StackResources}; diff --git a/tests/rp/src/bin/gpio_multicore.rs b/tests/rp/src/bin/gpio_multicore.rs index f48dd207b..6abcba590 100644 --- a/tests/rp/src/bin/gpio_multicore.rs +++ b/tests/rp/src/bin/gpio_multicore.rs @@ -7,10 +7,10 @@ teleprobe_meta::target!(b"pimoroni-pico-plus-2"); use defmt::{info, unwrap}; use embassy_executor::Executor; +use embassy_rp::Peri; use embassy_rp::gpio::{Input, Level, Output, Pull}; -use embassy_rp::multicore::{spawn_core1, Stack}; +use embassy_rp::multicore::{Stack, spawn_core1}; use embassy_rp::peripherals::{PIN_0, PIN_1}; -use embassy_rp::Peri; use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use embassy_sync::channel::Channel; use static_cell::StaticCell; diff --git a/tests/rp/src/bin/multicore.rs b/tests/rp/src/bin/multicore.rs index 11b03cfea..7e34bc778 100644 --- a/tests/rp/src/bin/multicore.rs +++ b/tests/rp/src/bin/multicore.rs @@ -7,7 +7,7 @@ teleprobe_meta::target!(b"pimoroni-pico-plus-2"); use defmt::{info, unwrap}; use embassy_executor::Executor; -use embassy_rp::multicore::{spawn_core1, Stack}; +use embassy_rp::multicore::{Stack, spawn_core1}; use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use embassy_sync::channel::Channel; use static_cell::StaticCell; diff --git a/tests/rp/src/bin/overclock.rs b/tests/rp/src/bin/overclock.rs index 167a26eb2..87a03b5e2 100644 --- a/tests/rp/src/bin/overclock.rs +++ b/tests/rp/src/bin/overclock.rs @@ -8,7 +8,7 @@ teleprobe_meta::target!(b"pimoroni-pico-plus-2"); use defmt::info; use embassy_executor::Spawner; -use embassy_rp::clocks::{clk_sys_freq, core_voltage, ClockConfig, CoreVoltage}; +use embassy_rp::clocks::{ClockConfig, CoreVoltage, clk_sys_freq, core_voltage}; use embassy_rp::config::Config; use embassy_time::Instant; use {defmt_rtt as _, panic_probe as _}; diff --git a/tests/rp/src/bin/pio_multi_load.rs b/tests/rp/src/bin/pio_multi_load.rs index aca476d56..82bbab272 100644 --- a/tests/rp/src/bin/pio_multi_load.rs +++ b/tests/rp/src/bin/pio_multi_load.rs @@ -57,7 +57,9 @@ async fn main(_spawner: Spawner) { assert_eq!(loaded2.wrap.target, 14); // wrapping around the end of program space automatically works - let prg3 = pio_asm!("nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "irq 2",); + let prg3 = pio_asm!( + "nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "irq 2", + ); let loaded3 = common.load_program(&prg3.program); assert_eq!(loaded3.origin, 24); assert_eq!(loaded3.wrap.source, 3); diff --git a/tests/rp/src/bin/rtc.rs b/tests/rp/src/bin/rtc.rs index c66981d95..e1def7b5b 100644 --- a/tests/rp/src/bin/rtc.rs +++ b/tests/rp/src/bin/rtc.rs @@ -5,7 +5,7 @@ teleprobe_meta::target!(b"rpi-pico"); use defmt::{assert, *}; use embassy_executor::Spawner; -use embassy_futures::select::{select, Either}; +use embassy_futures::select::{Either, select}; use embassy_rp::bind_interrupts; use embassy_rp::rtc::{DateTime, DateTimeFilter, DayOfWeek, Rtc}; use embassy_time::{Duration, Instant, Timer}; diff --git a/tests/rp/src/bin/spinlock_mutex_multicore.rs b/tests/rp/src/bin/spinlock_mutex_multicore.rs index c56d43ade..25c4faf37 100644 --- a/tests/rp/src/bin/spinlock_mutex_multicore.rs +++ b/tests/rp/src/bin/spinlock_mutex_multicore.rs @@ -7,7 +7,7 @@ teleprobe_meta::target!(b"pimoroni-pico-plus-2"); use defmt::{info, unwrap}; use embassy_executor::Executor; -use embassy_rp::multicore::{spawn_core1, Stack}; +use embassy_rp::multicore::{Stack, spawn_core1}; use embassy_rp::spinlock_mutex::SpinlockRawMutex; use embassy_sync::channel::Channel; use static_cell::StaticCell; diff --git a/tests/stm32/Cargo.toml b/tests/stm32/Cargo.toml index 891ec93fd..1161e827b 100644 --- a/tests/stm32/Cargo.toml +++ b/tests/stm32/Cargo.toml @@ -1,5 +1,5 @@ [package] -edition = "2021" +edition = "2024" name = "embassy-stm32-tests" version = "0.1.0" license = "MIT OR Apache-2.0" diff --git a/tests/stm32/src/bin/afio.rs b/tests/stm32/src/bin/afio.rs index 81d50874b..d88765717 100644 --- a/tests/stm32/src/bin/afio.rs +++ b/tests/stm32/src/bin/afio.rs @@ -16,7 +16,7 @@ use embassy_stm32::timer::qei::Qei; use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm}; use embassy_stm32::timer::{Ch1, Ch2}; use embassy_stm32::usart::{Uart, UartRx, UartTx}; -use embassy_stm32::{bind_interrupts, Peripherals}; +use embassy_stm32::{Peripherals, bind_interrupts}; #[cfg(not(feature = "afio-connectivity-line"))] bind_interrupts!(struct Irqs { diff --git a/tests/stm32/src/bin/cryp.rs b/tests/stm32/src/bin/cryp.rs index f54c99cc3..640de50e3 100644 --- a/tests/stm32/src/bin/cryp.rs +++ b/tests/stm32/src/bin/cryp.rs @@ -5,9 +5,9 @@ #[path = "../common.rs"] mod common; +use aes_gcm::Aes128Gcm; use aes_gcm::aead::heapless::Vec; use aes_gcm::aead::{AeadInPlace, KeyInit}; -use aes_gcm::Aes128Gcm; use common::*; use embassy_executor::Spawner; use embassy_stm32::cryp::{self, *}; diff --git a/tests/stm32/src/bin/fdcan.rs b/tests/stm32/src/bin/fdcan.rs index c2a1a7bb8..d97f493df 100644 --- a/tests/stm32/src/bin/fdcan.rs +++ b/tests/stm32/src/bin/fdcan.rs @@ -8,7 +8,7 @@ mod common; use common::*; use embassy_executor::Spawner; use embassy_stm32::peripherals::*; -use embassy_stm32::{bind_interrupts, can, Config}; +use embassy_stm32::{Config, bind_interrupts, can}; use embassy_time::Duration; use {defmt_rtt as _, panic_probe as _}; diff --git a/tests/stm32/src/bin/stop.rs b/tests/stm32/src/bin/stop.rs index 8119c1f39..833ca05d0 100644 --- a/tests/stm32/src/bin/stop.rs +++ b/tests/stm32/src/bin/stop.rs @@ -9,10 +9,10 @@ use chrono::NaiveDate; use common::*; use cortex_m_rt::entry; use embassy_executor::Spawner; -use embassy_stm32::low_power::{stop_ready, stop_with_rtc, Executor, StopMode}; +use embassy_stm32::Config; +use embassy_stm32::low_power::{Executor, StopMode, stop_ready, stop_with_rtc}; use embassy_stm32::rcc::LsConfig; use embassy_stm32::rtc::{Rtc, RtcConfig}; -use embassy_stm32::Config; use embassy_time::Timer; use static_cell::StaticCell; diff --git a/tests/stm32/src/bin/ucpd.rs b/tests/stm32/src/bin/ucpd.rs index 97aefe1a0..c794afff8 100644 --- a/tests/stm32/src/bin/ucpd.rs +++ b/tests/stm32/src/bin/ucpd.rs @@ -9,7 +9,7 @@ use defmt::{assert, assert_eq}; use embassy_executor::Spawner; use embassy_futures::join::join; use embassy_stm32::ucpd::{self, CcPhy, CcPull, CcSel, CcVState, RxError, Ucpd}; -use embassy_stm32::{bind_interrupts, peripherals, Peri}; +use embassy_stm32::{Peri, bind_interrupts, peripherals}; use embassy_time::Timer; bind_interrupts!(struct Irqs { diff --git a/tests/stm32/src/bin/usart.rs b/tests/stm32/src/bin/usart.rs index 129c7b692..0b98d3eeb 100644 --- a/tests/stm32/src/bin/usart.rs +++ b/tests/stm32/src/bin/usart.rs @@ -7,7 +7,7 @@ use common::*; use defmt::{assert, assert_eq, unreachable}; use embassy_executor::Spawner; use embassy_stm32::usart::{Config, ConfigError, Error, Uart}; -use embassy_time::{block_for, Duration, Instant}; +use embassy_time::{Duration, Instant, block_for}; #[embassy_executor::main] async fn main(_spawner: Spawner) { diff --git a/tests/stm32/src/bin/wpan_ble.rs b/tests/stm32/src/bin/wpan_ble.rs index 8957bfc04..0f396b848 100644 --- a/tests/stm32/src/bin/wpan_ble.rs +++ b/tests/stm32/src/bin/wpan_ble.rs @@ -12,16 +12,16 @@ use embassy_executor::Spawner; use embassy_stm32::bind_interrupts; use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; use embassy_stm32::rcc::WPAN_DEFAULT; +use embassy_stm32_wpan::TlMbox; +use embassy_stm32_wpan::hci::BdAddr; use embassy_stm32_wpan::hci::host::uart::UartHci; use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType}; use embassy_stm32_wpan::hci::types::AdvertisingType; use embassy_stm32_wpan::hci::vendor::command::gap::{AdvertisingDataType, DiscoverableParameters, GapCommands, Role}; use embassy_stm32_wpan::hci::vendor::command::gatt::GattCommands; use embassy_stm32_wpan::hci::vendor::command::hal::{ConfigData, HalCommands, PowerLevel}; -use embassy_stm32_wpan::hci::BdAddr; use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp; use embassy_stm32_wpan::sub::mm; -use embassy_stm32_wpan::TlMbox; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs{ diff --git a/tests/stm32/src/bin/wpan_mac.rs b/tests/stm32/src/bin/wpan_mac.rs index 79e13d524..f27146c44 100644 --- a/tests/stm32/src/bin/wpan_mac.rs +++ b/tests/stm32/src/bin/wpan_mac.rs @@ -10,13 +10,13 @@ use embassy_executor::Spawner; use embassy_stm32::bind_interrupts; use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; use embassy_stm32::rcc::WPAN_DEFAULT; +use embassy_stm32_wpan::TlMbox; use embassy_stm32_wpan::mac::commands::{AssociateRequest, GetRequest, ResetRequest, SetRequest}; use embassy_stm32_wpan::mac::event::MacEvent; use embassy_stm32_wpan::mac::typedefs::{ AddressMode, Capabilities, KeyIdMode, MacAddress, MacChannel, PanId, PibId, SecurityLevel, }; use embassy_stm32_wpan::sub::mm; -use embassy_stm32_wpan::TlMbox; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs{ diff --git a/tests/stm32/src/common.rs b/tests/stm32/src/common.rs index f800769ab..2bd934d6f 100644 --- a/tests/stm32/src/common.rs +++ b/tests/stm32/src/common.rs @@ -1,11 +1,11 @@ #![macro_use] pub use defmt::*; +use embassy_stm32::Config; #[allow(unused)] use embassy_stm32::rcc::*; #[allow(unused)] use embassy_stm32::time::Hertz; -use embassy_stm32::Config; use {defmt_rtt as _, panic_probe as _}; #[cfg(feature = "stm32f103c8")] diff --git a/tests/utils/Cargo.toml b/tests/utils/Cargo.toml index ddb990e0f..da04a1f5d 100644 --- a/tests/utils/Cargo.toml +++ b/tests/utils/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "test-utils" version = "0.1.0" -edition = "2021" +edition = "2024" license = "MIT OR Apache-2.0" publish = false diff --git a/tests/utils/src/bin/saturate_serial.rs b/tests/utils/src/bin/saturate_serial.rs index 85676b106..1c8a8b322 100644 --- a/tests/utils/src/bin/saturate_serial.rs +++ b/tests/utils/src/bin/saturate_serial.rs @@ -2,7 +2,7 @@ use std::path::Path; use std::time::Duration; use std::{env, io, process, thread}; -use rand::{rng, Rng}; +use rand::{Rng, rng}; use serial::SerialPort; pub fn main() { -- cgit From 44881e643702b9ca41fc72109c3d16afd4b0449b Mon Sep 17 00:00:00 2001 From: datdenkikniet Date: Wed, 12 Nov 2025 22:02:09 +0100 Subject: ETH no longer knows about Station management --- tests/stm32/src/bin/eth.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'tests') diff --git a/tests/stm32/src/bin/eth.rs b/tests/stm32/src/bin/eth.rs index a65682a02..95789ffc5 100644 --- a/tests/stm32/src/bin/eth.rs +++ b/tests/stm32/src/bin/eth.rs @@ -7,8 +7,8 @@ mod common; use common::*; use embassy_executor::Spawner; use embassy_net::StackResources; -use embassy_stm32::eth::{Ethernet, GenericPhy, PacketQueue}; -use embassy_stm32::peripherals::ETH; +use embassy_stm32::eth::{Ethernet, GenericPhy, PacketQueue, Sma}; +use embassy_stm32::peripherals::{ETH, ETH_SMA}; use embassy_stm32::rng::Rng; use embassy_stm32::{bind_interrupts, eth, peripherals, rng}; use static_cell::StaticCell; @@ -27,7 +27,7 @@ bind_interrupts!(struct Irqs { RNG => rng::InterruptHandler; }); -type Device = Ethernet<'static, ETH, GenericPhy>; +type Device = Ethernet<'static, ETH, GenericPhy>>; #[embassy_executor::task] async fn net_task(mut runner: embassy_net::Runner<'static, Device>) -> ! { @@ -69,13 +69,15 @@ async fn main(spawner: Spawner) { const PACKET_QUEUE_SIZE: usize = 4; static PACKETS: StaticCell> = StaticCell::new(); + + let sma = Sma::new(p.ETH_SMA, p.PA2, p.PC1); + let phy = GenericPhy::new_auto(sma); + let device = Ethernet::new( PACKETS.init(PacketQueue::::new()), p.ETH, Irqs, p.PA1, - p.PA2, - p.PC1, p.PA7, p.PC4, p.PC5, @@ -85,7 +87,7 @@ async fn main(spawner: Spawner) { #[cfg(feature = "stm32h563zi")] p.PB15, p.PG11, - GenericPhy::new_auto(), + phy, mac_addr, ); -- cgit From 0b3bc35b7dc0f3d2ffa1673ab790df8e6650fe0f Mon Sep 17 00:00:00 2001 From: datdenkikniet Date: Thu, 13 Nov 2025 23:00:58 +0100 Subject: Add new{_with_phy}, new_mii{_with_phy} --- tests/stm32/src/bin/eth.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/stm32/src/bin/eth.rs b/tests/stm32/src/bin/eth.rs index 95789ffc5..ffc76b96f 100644 --- a/tests/stm32/src/bin/eth.rs +++ b/tests/stm32/src/bin/eth.rs @@ -70,9 +70,6 @@ async fn main(spawner: Spawner) { static PACKETS: StaticCell> = StaticCell::new(); - let sma = Sma::new(p.ETH_SMA, p.PA2, p.PC1); - let phy = GenericPhy::new_auto(sma); - let device = Ethernet::new( PACKETS.init(PacketQueue::::new()), p.ETH, @@ -87,8 +84,10 @@ async fn main(spawner: Spawner) { #[cfg(feature = "stm32h563zi")] p.PB15, p.PG11, - phy, mac_addr, + p.ETH_SMA, + p.PA2, + p.PC1, ); let config = embassy_net::Config::dhcpv4(Default::default()); -- cgit From 29d4ade2866e6c8d2114b393853354ded1e61db7 Mon Sep 17 00:00:00 2001 From: xoviat Date: Sun, 16 Nov 2025 07:50:49 -0600 Subject: low_power: misc cleanups and allow main macro --- tests/stm32/src/bin/stop.rs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'tests') diff --git a/tests/stm32/src/bin/stop.rs b/tests/stm32/src/bin/stop.rs index 1fe65d867..83c375bc5 100644 --- a/tests/stm32/src/bin/stop.rs +++ b/tests/stm32/src/bin/stop.rs @@ -7,21 +7,13 @@ mod common; use chrono::NaiveDate; use common::*; -use cortex_m_rt::entry; use embassy_executor::Spawner; -use embassy_stm32::Config; -use embassy_stm32::low_power::{Executor, StopMode, stop_ready}; +use embassy_stm32::low_power::{StopMode, stop_ready}; use embassy_stm32::rcc::LsConfig; use embassy_stm32::rtc::Rtc; +use embassy_stm32::{Config, low_power}; use embassy_time::Timer; -#[entry] -fn main() -> ! { - Executor::take().run(|spawner| { - spawner.spawn(unwrap!(async_main(spawner))); - }); -} - #[embassy_executor::task] async fn task_1() { for _ in 0..9 { @@ -43,7 +35,7 @@ async fn task_2() { cortex_m::asm::bkpt(); } -#[embassy_executor::task] +#[embassy_executor::main(executor = "low_power::Executor")] async fn async_main(spawner: Spawner) { let _ = config(); -- cgit From 141685f6f7ff5e78fb08d3aefb67be5d16485ceb Mon Sep 17 00:00:00 2001 From: xoviat Date: Wed, 19 Nov 2025 13:20:17 -0600 Subject: hsem: add hardware test and rework --- tests/stm32/Cargo.toml | 10 ++++++++-- tests/stm32/src/bin/hsem.rs | 47 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 tests/stm32/src/bin/hsem.rs (limited to 'tests') diff --git a/tests/stm32/Cargo.toml b/tests/stm32/Cargo.toml index b92b47be2..f5684d4df 100644 --- a/tests/stm32/Cargo.toml +++ b/tests/stm32/Cargo.toml @@ -31,9 +31,9 @@ stm32l4r5zi = ["embassy-stm32/stm32l4r5zi", "chrono", "not-gpdma", "rng", "dual- stm32l552ze = ["embassy-stm32/stm32l552ze", "not-gpdma", "rng", "hash", "dual-bank"] stm32u585ai = ["embassy-stm32/stm32u585ai", "spi-v345", "chrono", "rng", "hash", "cordic"] stm32u5a5zj = ["embassy-stm32/stm32u5a5zj", "spi-v345", "chrono", "rng", "hash"] # FIXME: cordic test cause it crash -stm32wb55rg = ["embassy-stm32/stm32wb55rg", "chrono", "not-gpdma", "ble", "mac" , "rng"] +stm32wb55rg = ["embassy-stm32/stm32wb55rg", "chrono", "not-gpdma", "ble", "mac" , "rng", "hsem"] stm32wba52cg = ["embassy-stm32/stm32wba52cg", "spi-v345", "chrono", "rng", "hash"] -stm32wl55jc = ["embassy-stm32/stm32wl55jc-cm4", "not-gpdma", "rng", "chrono"] +stm32wl55jc = ["embassy-stm32/stm32wl55jc-cm4", "not-gpdma", "rng", "chrono", "hsem"] stm32f091rc = ["embassy-stm32/stm32f091rc", "cm0", "not-gpdma", "chrono"] stm32h503rb = ["embassy-stm32/stm32h503rb", "spi-v345", "rng", "stop"] stm32h7s3l8 = ["embassy-stm32/stm32h7s3l8", "spi-v345", "rng", "cordic", "hash-v34"] # TODO: fdcan crashes, cryp dma hangs. @@ -58,6 +58,7 @@ not-gpdma = [] dac = [] ucpd = [] cordic = ["dep:num-traits"] +hsem = [] dual-bank = ["embassy-stm32/dual-bank"] single-bank = ["embassy-stm32/single-bank"] eeprom = [] @@ -224,6 +225,11 @@ name = "wpan_mac" path = "src/bin/wpan_mac.rs" required-features = [ "mac",] +[[bin]] +name = "hsem" +path = "src/bin/hsem.rs" +required-features = [ "hsem",] + # END TESTS [profile.dev] diff --git a/tests/stm32/src/bin/hsem.rs b/tests/stm32/src/bin/hsem.rs new file mode 100644 index 000000000..19648997c --- /dev/null +++ b/tests/stm32/src/bin/hsem.rs @@ -0,0 +1,47 @@ +// required-features: hsem +#![no_std] +#![no_main] + +#[path = "../common.rs"] +mod common; + +use common::*; +use embassy_executor::Spawner; +use embassy_stm32::bind_interrupts; +use embassy_stm32::hsem::{HardwareSemaphore, HardwareSemaphoreInterruptHandler}; +use embassy_stm32::peripherals::HSEM; + +bind_interrupts!(struct Irqs{ + HSEM => HardwareSemaphoreInterruptHandler; +}); + +#[embassy_executor::main] +async fn main(_spawner: Spawner) { + let p: embassy_stm32::Peripherals = init(); + + let hsem = HardwareSemaphore::new(p.HSEM, Irqs); + + // if hsem.channel_for(SemaphoreNumber::Channel5).is_semaphore_locked() { + // defmt::panic!("Semaphore 5 already locked!") + // } + // + // hsem.channel_for(SemaphoreNumber::Channel5).one_step_lock().unwrap(); + // hsem.channel_for(SemaphoreNumber::Channel1).two_step_lock(0).unwrap(); + // + // hsem.channel_for(SemaphoreNumber::Channel5).unlock(0); + + let [_channel1, _channel2, _channel3, _channel4, mut channel5, _channel6] = hsem.split(); + + info!("Locking channel 5"); + + let mutex = channel5.lock(0).await; + + info!("Locked channel 5"); + + drop(mutex); + + info!("Unlocked channel 5"); + + info!("Test OK"); + cortex_m::asm::bkpt(); +} -- cgit From 19e61543198e2d15fd4c7aef9377c8f40ae86ae0 Mon Sep 17 00:00:00 2001 From: xoviat Date: Wed, 19 Nov 2025 16:14:23 -0600 Subject: stm32: impl. low power test for stm32wb55 --- tests/stm32/Cargo.toml | 2 +- tests/stm32/src/bin/hsem.rs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/stm32/Cargo.toml b/tests/stm32/Cargo.toml index f5684d4df..8fcb6b2b4 100644 --- a/tests/stm32/Cargo.toml +++ b/tests/stm32/Cargo.toml @@ -31,7 +31,7 @@ stm32l4r5zi = ["embassy-stm32/stm32l4r5zi", "chrono", "not-gpdma", "rng", "dual- stm32l552ze = ["embassy-stm32/stm32l552ze", "not-gpdma", "rng", "hash", "dual-bank"] stm32u585ai = ["embassy-stm32/stm32u585ai", "spi-v345", "chrono", "rng", "hash", "cordic"] stm32u5a5zj = ["embassy-stm32/stm32u5a5zj", "spi-v345", "chrono", "rng", "hash"] # FIXME: cordic test cause it crash -stm32wb55rg = ["embassy-stm32/stm32wb55rg", "chrono", "not-gpdma", "ble", "mac" , "rng", "hsem"] +stm32wb55rg = ["embassy-stm32/stm32wb55rg", "chrono", "not-gpdma", "ble", "mac" , "rng", "hsem", "stop"] stm32wba52cg = ["embassy-stm32/stm32wba52cg", "spi-v345", "chrono", "rng", "hash"] stm32wl55jc = ["embassy-stm32/stm32wl55jc-cm4", "not-gpdma", "rng", "chrono", "hsem"] stm32f091rc = ["embassy-stm32/stm32f091rc", "cm0", "not-gpdma", "chrono"] diff --git a/tests/stm32/src/bin/hsem.rs b/tests/stm32/src/bin/hsem.rs index 19648997c..fa69f22b2 100644 --- a/tests/stm32/src/bin/hsem.rs +++ b/tests/stm32/src/bin/hsem.rs @@ -30,6 +30,9 @@ async fn main(_spawner: Spawner) { // // hsem.channel_for(SemaphoreNumber::Channel5).unlock(0); + #[cfg(feature = "stm32wb55rg")] + let [_channel1, _channel2, mut channel5, _channel6] = hsem.split(); + #[cfg(not(feature = "stm32wb55rg"))] let [_channel1, _channel2, _channel3, _channel4, mut channel5, _channel6] = hsem.split(); info!("Locking channel 5"); -- cgit From 14436ce1300a5d621b617d56ee037e09ce55ea0a Mon Sep 17 00:00:00 2001 From: xoviat Date: Fri, 21 Nov 2025 08:22:31 -0600 Subject: adc: add test for wba --- tests/stm32/Cargo.toml | 8 +++++++- tests/stm32/src/bin/adc.rs | 39 +++++++++++++++++++++++++++++++++++++++ tests/stm32/src/common.rs | 1 + 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 tests/stm32/src/bin/adc.rs (limited to 'tests') diff --git a/tests/stm32/Cargo.toml b/tests/stm32/Cargo.toml index 8fcb6b2b4..496a9de18 100644 --- a/tests/stm32/Cargo.toml +++ b/tests/stm32/Cargo.toml @@ -32,7 +32,7 @@ stm32l552ze = ["embassy-stm32/stm32l552ze", "not-gpdma", "rng", "hash", "dual-ba stm32u585ai = ["embassy-stm32/stm32u585ai", "spi-v345", "chrono", "rng", "hash", "cordic"] stm32u5a5zj = ["embassy-stm32/stm32u5a5zj", "spi-v345", "chrono", "rng", "hash"] # FIXME: cordic test cause it crash stm32wb55rg = ["embassy-stm32/stm32wb55rg", "chrono", "not-gpdma", "ble", "mac" , "rng", "hsem", "stop"] -stm32wba52cg = ["embassy-stm32/stm32wba52cg", "spi-v345", "chrono", "rng", "hash"] +stm32wba52cg = ["embassy-stm32/stm32wba52cg", "spi-v345", "chrono", "rng", "hash", "adc"] stm32wl55jc = ["embassy-stm32/stm32wl55jc-cm4", "not-gpdma", "rng", "chrono", "hsem"] stm32f091rc = ["embassy-stm32/stm32f091rc", "cm0", "not-gpdma", "chrono"] stm32h503rb = ["embassy-stm32/stm32h503rb", "spi-v345", "rng", "stop"] @@ -56,6 +56,7 @@ mac = ["dep:embassy-stm32-wpan", "embassy-stm32-wpan/mac"] embassy-stm32-wpan = [] not-gpdma = [] dac = [] +adc = [] ucpd = [] cordic = ["dep:num-traits"] hsem = [] @@ -110,6 +111,11 @@ name = "afio" path = "src/bin/afio.rs" required-features = [ "afio",] +[[bin]] +name = "adc" +path = "src/bin/adc.rs" +required-features = [ "adc",] + [[bin]] name = "can" path = "src/bin/can.rs" diff --git a/tests/stm32/src/bin/adc.rs b/tests/stm32/src/bin/adc.rs new file mode 100644 index 000000000..6cedc6498 --- /dev/null +++ b/tests/stm32/src/bin/adc.rs @@ -0,0 +1,39 @@ +#![no_std] +#![no_main] + +// required-features: dac + +#[path = "../common.rs"] +mod common; + +use common::*; +use embassy_executor::Spawner; +use embassy_stm32::adc::{Adc, SampleTime}; +use embassy_time::Timer; +use {defmt_rtt as _, panic_probe as _}; + +#[embassy_executor::main] +async fn main(_spawner: Spawner) { + // Initialize the board and obtain a Peripherals instance + let p: embassy_stm32::Peripherals = init(); + + let adc = peri!(p, ADC); + let mut adc_pin = peri!(p, DAC_PIN); + + let mut adc = Adc::new_adc4(adc); + + // Now wait a little to obtain a stable value + Timer::after_millis(30).await; + let _ = adc.blocking_read(&mut adc_pin, SampleTime::from_bits(0)); + + for _ in 0..=255 { + // Now wait a little to obtain a stable value + Timer::after_millis(30).await; + + // Need to steal the peripherals here because PA4 is obviously in use already + let _ = adc.blocking_read(&mut adc_pin, SampleTime::from_bits(0)); + } + + info!("Test OK"); + cortex_m::asm::bkpt(); +} diff --git a/tests/stm32/src/common.rs b/tests/stm32/src/common.rs index 096cce947..9f88b182a 100644 --- a/tests/stm32/src/common.rs +++ b/tests/stm32/src/common.rs @@ -259,6 +259,7 @@ define_peris!( define_peris!( UART = LPUART1, UART_TX = PB5, UART_RX = PA10, UART_TX_DMA = GPDMA1_CH0, UART_RX_DMA = GPDMA1_CH1, SPI = SPI1, SPI_SCK = PB4, SPI_MOSI = PA15, SPI_MISO = PB3, SPI_TX_DMA = GPDMA1_CH0, SPI_RX_DMA = GPDMA1_CH1, + ADC = ADC4, DAC_PIN = PA0, @irq UART = {LPUART1 => embassy_stm32::usart::InterruptHandler;}, ); #[cfg(feature = "stm32h7s3l8")] -- cgit From 08125aa919a4dc4de79f91de9a7f3586e51a7739 Mon Sep 17 00:00:00 2001 From: xoviat Date: Sun, 23 Nov 2025 13:11:18 -0600 Subject: wpan: restructure ipcc and hil test wpan_mac --- tests/stm32/src/bin/wpan_ble.rs | 120 ++++++++++++++++++---------------------- tests/stm32/src/bin/wpan_mac.rs | 29 +++++----- 2 files changed, 66 insertions(+), 83 deletions(-) (limited to 'tests') diff --git a/tests/stm32/src/bin/wpan_ble.rs b/tests/stm32/src/bin/wpan_ble.rs index 0f396b848..b4c0cbf56 100644 --- a/tests/stm32/src/bin/wpan_ble.rs +++ b/tests/stm32/src/bin/wpan_ble.rs @@ -32,7 +32,7 @@ bind_interrupts!(struct Irqs{ const BLE_GAP_DEVICE_NAME_LENGTH: u8 = 7; #[embassy_executor::task] -async fn run_mm_queue(memory_manager: mm::MemoryManager) { +async fn run_mm_queue(mut memory_manager: mm::MemoryManager<'static>) { memory_manager.run_queue().await; } @@ -45,14 +45,13 @@ async fn main(spawner: Spawner) { info!("Hello World!"); let config = Config::default(); - let mut mbox = TlMbox::init(p.IPCC, Irqs, config); + let mbox = TlMbox::init(p.IPCC, Irqs, config).await; + let mut sys = mbox.sys_subsystem; + let mut ble = mbox.ble_subsystem; spawner.spawn(run_mm_queue(mbox.mm_subsystem).unwrap()); - let sys_event = mbox.sys_subsystem.read().await; - info!("sys event: {}", sys_event.payload()); - - let fw_info = mbox.sys_subsystem.wireless_fw_info().unwrap(); + let fw_info = sys.wireless_fw_info().unwrap(); let version_major = fw_info.version_major(); let version_minor = fw_info.version_minor(); let subversion = fw_info.subversion(); @@ -65,121 +64,108 @@ async fn main(spawner: Spawner) { version_major, version_minor, subversion, sram2a_size, sram2b_size ); - let _ = mbox.sys_subsystem.shci_c2_ble_init(Default::default()).await; + let _ = sys.shci_c2_ble_init(Default::default()).await; info!("resetting BLE..."); - mbox.ble_subsystem.reset().await; - let response = mbox.ble_subsystem.read().await.unwrap(); + ble.reset().await; + let response = ble.read().await.unwrap(); info!("{}", response); info!("config public address..."); - mbox.ble_subsystem - .write_config_data(&ConfigData::public_address(get_bd_addr()).build()) + ble.write_config_data(&ConfigData::public_address(get_bd_addr()).build()) .await; - let response = mbox.ble_subsystem.read().await.unwrap(); + let response = ble.read().await.unwrap(); info!("{}", response); info!("config random address..."); - mbox.ble_subsystem - .write_config_data(&ConfigData::random_address(get_random_addr()).build()) + ble.write_config_data(&ConfigData::random_address(get_random_addr()).build()) .await; - let response = mbox.ble_subsystem.read().await.unwrap(); + let response = ble.read().await.unwrap(); info!("{}", response); info!("config identity root..."); - mbox.ble_subsystem - .write_config_data(&ConfigData::identity_root(&get_irk()).build()) + ble.write_config_data(&ConfigData::identity_root(&get_irk()).build()) .await; - let response = mbox.ble_subsystem.read().await.unwrap(); + let response = ble.read().await.unwrap(); info!("{}", response); info!("config encryption root..."); - mbox.ble_subsystem - .write_config_data(&ConfigData::encryption_root(&get_erk()).build()) + ble.write_config_data(&ConfigData::encryption_root(&get_erk()).build()) .await; - let response = mbox.ble_subsystem.read().await.unwrap(); + let response = ble.read().await.unwrap(); info!("{}", response); info!("config tx power level..."); - mbox.ble_subsystem.set_tx_power_level(PowerLevel::ZerodBm).await; - let response = mbox.ble_subsystem.read().await.unwrap(); + ble.set_tx_power_level(PowerLevel::ZerodBm).await; + let response = ble.read().await.unwrap(); info!("{}", response); info!("GATT init..."); - mbox.ble_subsystem.init_gatt().await; - let response = mbox.ble_subsystem.read().await.unwrap(); + ble.init_gatt().await; + let response = ble.read().await.unwrap(); info!("{}", response); info!("GAP init..."); - mbox.ble_subsystem - .init_gap(Role::PERIPHERAL, false, BLE_GAP_DEVICE_NAME_LENGTH) - .await; - let response = mbox.ble_subsystem.read().await.unwrap(); + ble.init_gap(Role::PERIPHERAL, false, BLE_GAP_DEVICE_NAME_LENGTH).await; + let response = ble.read().await.unwrap(); info!("{}", response); // info!("set scan response..."); - // mbox.ble_subsystem.le_set_scan_response_data(&[]).await.unwrap(); - // let response = mbox.ble_subsystem.read().await.unwrap(); + // ble.le_set_scan_response_data(&[]).await.unwrap(); + // let response = ble.read().await.unwrap(); // info!("{}", response); info!("set discoverable..."); - mbox.ble_subsystem - .set_discoverable(&DiscoverableParameters { - advertising_type: AdvertisingType::NonConnectableUndirected, - advertising_interval: Some((Duration::from_millis(250), Duration::from_millis(250))), - address_type: OwnAddressType::Public, - filter_policy: AdvertisingFilterPolicy::AllowConnectionAndScan, - local_name: None, - advertising_data: &[], - conn_interval: (None, None), - }) - .await - .unwrap(); - - let response = mbox.ble_subsystem.read().await; + ble.set_discoverable(&DiscoverableParameters { + advertising_type: AdvertisingType::NonConnectableUndirected, + advertising_interval: Some((Duration::from_millis(250), Duration::from_millis(250))), + address_type: OwnAddressType::Public, + filter_policy: AdvertisingFilterPolicy::AllowConnectionAndScan, + local_name: None, + advertising_data: &[], + conn_interval: (None, None), + }) + .await + .unwrap(); + + let response = ble.read().await; info!("{}", response); // remove some advertisement to decrease the packet size info!("delete tx power ad type..."); - mbox.ble_subsystem - .delete_ad_type(AdvertisingDataType::TxPowerLevel) - .await; - let response = mbox.ble_subsystem.read().await.unwrap(); + ble.delete_ad_type(AdvertisingDataType::TxPowerLevel).await; + let response = ble.read().await.unwrap(); info!("{}", response); info!("delete conn interval ad type..."); - mbox.ble_subsystem - .delete_ad_type(AdvertisingDataType::PeripheralConnectionInterval) + ble.delete_ad_type(AdvertisingDataType::PeripheralConnectionInterval) .await; - let response = mbox.ble_subsystem.read().await.unwrap(); + let response = ble.read().await.unwrap(); info!("{}", response); info!("update advertising data..."); - mbox.ble_subsystem - .update_advertising_data(&eddystone_advertising_data()) + ble.update_advertising_data(&eddystone_advertising_data()) .await .unwrap(); - let response = mbox.ble_subsystem.read().await.unwrap(); + let response = ble.read().await.unwrap(); info!("{}", response); info!("update advertising data type..."); - mbox.ble_subsystem - .update_advertising_data(&[3, AdvertisingDataType::UuidCompleteList16 as u8, 0xaa, 0xfe]) + ble.update_advertising_data(&[3, AdvertisingDataType::UuidCompleteList16 as u8, 0xaa, 0xfe]) .await .unwrap(); - let response = mbox.ble_subsystem.read().await.unwrap(); + let response = ble.read().await.unwrap(); info!("{}", response); info!("update advertising data flags..."); - mbox.ble_subsystem - .update_advertising_data(&[ - 2, - AdvertisingDataType::Flags as u8, - (0x02 | 0x04) as u8, // BLE general discoverable, without BR/EDR support - ]) - .await - .unwrap(); - let response = mbox.ble_subsystem.read().await.unwrap(); + ble.update_advertising_data(&[ + 2, + AdvertisingDataType::Flags as u8, + (0x02 | 0x04) as u8, // BLE general discoverable, without BR/EDR support + ]) + .await + .unwrap(); + let response = ble.read().await.unwrap(); info!("{}", response); info!("Test OK"); diff --git a/tests/stm32/src/bin/wpan_mac.rs b/tests/stm32/src/bin/wpan_mac.rs index f27146c44..42db39e7e 100644 --- a/tests/stm32/src/bin/wpan_mac.rs +++ b/tests/stm32/src/bin/wpan_mac.rs @@ -25,7 +25,7 @@ bind_interrupts!(struct Irqs{ }); #[embassy_executor::task] -async fn run_mm_queue(memory_manager: mm::MemoryManager) { +async fn run_mm_queue(mut memory_manager: mm::MemoryManager<'static>) { memory_manager.run_queue().await; } @@ -38,20 +38,17 @@ async fn main(spawner: Spawner) { info!("Hello World!"); let config = Config::default(); - let mbox = TlMbox::init(p.IPCC, Irqs, config); + let mbox = TlMbox::init(p.IPCC, Irqs, config).await; + let mut sys = mbox.sys_subsystem; + let (mut mac_rx, mut mac_tx) = mbox.mac_subsystem.split(); spawner.spawn(run_mm_queue(mbox.mm_subsystem).unwrap()); - let sys_event = mbox.sys_subsystem.read().await; - info!("sys event: {}", sys_event.payload()); - - core::mem::drop(sys_event); - - let result = mbox.sys_subsystem.shci_c2_mac_802_15_4_init().await; + let result = sys.shci_c2_mac_802_15_4_init().await; info!("initialized mac: {}", result); info!("resetting"); - mbox.mac_subsystem + mac_tx .send_command(&ResetRequest { set_default_pib: true, ..Default::default() @@ -59,13 +56,13 @@ async fn main(spawner: Spawner) { .await .unwrap(); { - let evt = mbox.mac_subsystem.read().await.unwrap(); + let evt = mac_rx.read().await.unwrap(); info!("{:#x}", evt); } info!("setting extended address"); let extended_address: u64 = 0xACDE480000000002; - mbox.mac_subsystem + mac_tx .send_command(&SetRequest { pib_attribute_ptr: &extended_address as *const _ as *const u8, pib_attribute: PibId::ExtendedAddress, @@ -73,12 +70,12 @@ async fn main(spawner: Spawner) { .await .unwrap(); { - let evt = mbox.mac_subsystem.read().await.unwrap(); + let evt = mac_rx.read().await.unwrap(); info!("{:#x}", evt); } info!("getting extended address"); - mbox.mac_subsystem + mac_tx .send_command(&GetRequest { pib_attribute: PibId::ExtendedAddress, ..Default::default() @@ -87,7 +84,7 @@ async fn main(spawner: Spawner) { .unwrap(); { - let evt = mbox.mac_subsystem.read().await.unwrap(); + let evt = mac_rx.read().await.unwrap(); info!("{:#x}", evt); if let MacEvent::MlmeGetCnf(evt) = evt { @@ -113,8 +110,8 @@ async fn main(spawner: Spawner) { key_index: 152, }; info!("{}", a); - mbox.mac_subsystem.send_command(&a).await.unwrap(); - let short_addr = if let MacEvent::MlmeAssociateCnf(conf) = mbox.mac_subsystem.read().await.unwrap() { + mac_tx.send_command(&a).await.unwrap(); + let short_addr = if let MacEvent::MlmeAssociateCnf(conf) = mac_rx.read().await.unwrap() { conf.assoc_short_address } else { defmt::panic!() -- cgit