From 9e785438eecc3a0645e4d3b99d2708f3c2e329b6 Mon Sep 17 00:00:00 2001 From: Caleb Jamison Date: Tue, 18 Feb 2025 09:58:20 -0500 Subject: [PATCH] Inital rp23 ci tests Some tests need more work. * The adc test builds, but isn't set up correctly for the 2350 hardware yet. * The multicore and gpio_multicore tests only work from flash, seems to be a probe-rs issue. * The i2c and flash tests also only works from flash, these are probably bugs but I don't have time to run them down now. * The 2350 gpio test skips anything with pull downs. I think these fail because of E9. The float, bootsel, cyw43, and ethernet tests don't have 2350 equivalents. There's no reason to use the float romfuncs, use the FPU. Bootsel as a button isn't supported on the 2350 yet. The wifi and eth tests don't have appropriate hardware. The i2c test has also been tweaked to run on one core. --- ci.sh | 12 +++++- tests/rp/.cargo/config.toml | 6 ++- tests/rp/Cargo.toml | 31 +++++++++++++- tests/rp/readme.md | 8 ++++ tests/rp/src/bin/adc.rs | 65 ++++++++++++++---------------- tests/rp/src/bin/dma_copy_async.rs | 3 ++ tests/rp/src/bin/flash.rs | 19 ++++++--- tests/rp/src/bin/gpio.rs | 10 ++++- tests/rp/src/bin/gpio_async.rs | 3 ++ tests/rp/src/bin/gpio_multicore.rs | 5 ++- tests/rp/src/bin/i2c.rs | 25 ++++-------- tests/rp/src/bin/multicore.rs | 3 ++ tests/rp/src/bin/pio_irq.rs | 3 ++ tests/rp/src/bin/pio_multi_load.rs | 3 ++ tests/rp/src/bin/pwm.rs | 11 ++++- tests/rp/src/bin/spi.rs | 3 ++ tests/rp/src/bin/spi_async.rs | 3 ++ tests/rp/src/bin/timer.rs | 3 ++ tests/rp/src/bin/uart.rs | 3 ++ tests/rp/src/bin/uart_buffered.rs | 3 ++ tests/rp/src/bin/uart_dma.rs | 3 ++ tests/rp/src/bin/uart_upgrade.rs | 3 ++ 22 files changed, 164 insertions(+), 64 deletions(-) create mode 100644 tests/rp/readme.md diff --git a/ci.sh b/ci.sh index 149999d58..5e01805ef 100755 --- a/ci.sh +++ b/ci.sh @@ -291,7 +291,8 @@ cargo batch \ --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32f091rc --artifact-dir out/tests/stm32f091rc \ --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32h503rb --artifact-dir out/tests/stm32h503rb \ --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32u083rc --artifact-dir out/tests/stm32u083rc \ - --- build --release --manifest-path tests/rp/Cargo.toml --target thumbv6m-none-eabi --artifact-dir out/tests/rpi-pico \ + --- build --release --manifest-path tests/rp/Cargo.toml --target thumbv6m-none-eabi --features rp2040 --artifact-dir out/tests/rpi-pico \ + --- build --release --manifest-path tests/rp/Cargo.toml --target thumbv8m.main-none-eabihf --features rp235xb --artifact-dir out/tests/pimoroni-pico-plus-2 \ --- build --release --manifest-path tests/nrf/Cargo.toml --target thumbv6m-none-eabi --features nrf51422 --artifact-dir out/tests/nrf51422-dk \ --- build --release --manifest-path tests/nrf/Cargo.toml --target thumbv7em-none-eabi --features nrf52832 --artifact-dir out/tests/nrf52832-dk \ --- build --release --manifest-path tests/nrf/Cargo.toml --target thumbv7em-none-eabi --features nrf52833 --artifact-dir out/tests/nrf52833-dk \ @@ -319,6 +320,15 @@ rm out/tests/stm32f207zg/usart_rx_ringbuffered # doesn't work, gives "noise error", no idea why. usart_dma does pass. rm out/tests/stm32u5a5zj/usart +# probe-rs error: "multi-core ram flash start not implemented yet" +# As of 2025-02-17 these tests work when run from flash +rm out/tests/pimoroni-pico-plus-2/multicore +rm out/tests/pimoroni-pico-plus-2/gpio_multicore +# Doesn't work when run from ram on the 2350 +rm out/tests/pimoroni-pico-plus-2/flash +# This test passes locally but fails on the HIL, no idea why +rm out/tests/pimoroni-pico-plus-2/i2c + if [[ -z "${TELEPROBE_TOKEN-}" ]]; then echo No teleprobe token found, skipping running HIL tests exit diff --git a/tests/rp/.cargo/config.toml b/tests/rp/.cargo/config.toml index 4337924cc..649c15048 100644 --- a/tests/rp/.cargo/config.toml +++ b/tests/rp/.cargo/config.toml @@ -5,8 +5,9 @@ #build-std-features = ["panic_immediate_abort"] [target.'cfg(all(target_arch = "arm", target_os = "none"))'] -runner = "teleprobe client run" +#runner = "teleprobe client run" #runner = "teleprobe local run --chip RP2040 --elf" +runner = "teleprobe local run --chip RP235X --elf" rustflags = [ # Code-size optimizations. @@ -15,7 +16,8 @@ rustflags = [ ] [build] -target = "thumbv6m-none-eabi" +#target = "thumbv6m-none-eabi" +target = "thumbv8m.main-none-eabihf" [env] DEFMT_LOG = "trace,embassy_hal_internal=debug,embassy_net_esp_hosted=debug,cyw43=info,cyw43_pio=info,smoltcp=info" diff --git a/tests/rp/Cargo.toml b/tests/rp/Cargo.toml index 5a6a6c75a..22e3d32a2 100644 --- a/tests/rp/Cargo.toml +++ b/tests/rp/Cargo.toml @@ -4,13 +4,18 @@ name = "embassy-rp-tests" version = "0.1.0" license = "MIT OR Apache-2.0" +[features] +rp2040 = ["embassy-rp/rp2040"] +rp235xa = ["embassy-rp/rp235xa"] +rp235xb = ["embassy-rp/rp235xb"] + [dependencies] teleprobe-meta = "1.1" embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "defmt"] } embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", ] } -embassy-rp = { version = "0.3.0", path = "../../embassy-rp", features = [ "defmt", "unstable-pac", "time-driver", "critical-section-impl", "intrinsics", "rom-v2-intrinsics", "run-from-ram", "rp2040"] } +embassy-rp = { version = "0.3.0", path = "../../embassy-rp", features = [ "defmt", "unstable-pac", "time-driver", "critical-section-impl", "intrinsics", "rom-v2-intrinsics", "run-from-ram"] } embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "tcp", "udp", "dhcpv4", "medium-ethernet"] } embassy-net-wiznet = { version = "0.2.0", path = "../../embassy-net-wiznet", features = ["defmt"] } @@ -37,6 +42,30 @@ pio-proc = { git = "https://github.com/rp-rs/pio-rs", rev = "fa586448b0b223217ee pio = { git = "https://github.com/rp-rs/pio-rs", rev = "fa586448b0b223217eec8c92c19fe6823dd04cc4" } rand = { version = "0.8.5", default-features = false } +# bootsel not currently supported on 2350 +[[bin]] +name = "bootsel" +path = "src/bin/bootsel.rs" +required-features = [ "rp2040",] + +# 2350 devboard isn't a W +[[bin]] +name = "cyw43-perf" +path = "src/bin/cyw43-perf.rs" +required-features = [ "rp2040",] + +# Eth test only for the w5100s-evb-pico +[[bin]] +name = "ethernet_w5100s_perf" +path = "src/bin/ethernet_w5100s_perf.rs" +required-features = [ "rp2040",] + +# Float intrinsics are only relevant for the 2040 +[[bin]] +name = "float" +path = "src/bin/float.rs" +required-features = [ "rp2040",] + [profile.dev] debug = 2 debug-assertions = true diff --git a/tests/rp/readme.md b/tests/rp/readme.md new file mode 100644 index 000000000..f8192a95a --- /dev/null +++ b/tests/rp/readme.md @@ -0,0 +1,8 @@ +# Pico and Pico 2 Plus connections + +GP0-GP1 +GP3-GP4 +GP6-GP9 +GP7-GP11 +GP18-GP20 with 10k pullup +GP19-GP21 with 10k pullup diff --git a/tests/rp/src/bin/adc.rs b/tests/rp/src/bin/adc.rs index 65c246472..8eeaad95d 100644 --- a/tests/rp/src/bin/adc.rs +++ b/tests/rp/src/bin/adc.rs @@ -1,12 +1,17 @@ #![no_std] #![no_main] +#[cfg(feature = "rp2040")] teleprobe_meta::target!(b"rpi-pico"); +#[cfg(feature = "rp235xb")] +teleprobe_meta::target!(b"pimoroni-pico-plus-2"); use defmt::*; use embassy_executor::Spawner; -use embassy_rp::adc::{Adc, Channel, Config, InterruptHandler, Sample}; +use embassy_rp::adc::Sample; +use embassy_rp::adc::{Adc, Channel, Config, InterruptHandler}; use embassy_rp::bind_interrupts; -use embassy_rp::gpio::{Level, Output, Pull}; +use embassy_rp::gpio::Pull; +use embassy_rp::gpio::{Level, Output}; use {defmt_rtt as _, panic_probe as _}; bind_interrupts!(struct Irqs { @@ -20,14 +25,19 @@ async fn main(_spawner: Spawner) { let _wifi_off = Output::new(p.PIN_25, Level::High); let mut adc = Adc::new(p.ADC, Irqs, Config::default()); + #[cfg(any(feature = "rp2040", feature = "rp235xa"))] + let (mut a, mut b, mut c, mut d) = (p.PIN_26, p.PIN_27, p.PIN_28, p.PIN_29); + #[cfg(feature = "rp235xb")] + let (mut a, mut b, mut c, mut d) = (p.PIN_44, p.PIN_45, p.PIN_46, p.PIN_47); + { { - let mut p = Channel::new_pin(&mut p.PIN_26, Pull::Down); + let mut p = Channel::new_pin(&mut a, Pull::Down); defmt::assert!(adc.blocking_read(&mut p).unwrap() < 0b01_0000_0000); defmt::assert!(adc.read(&mut p).await.unwrap() < 0b01_0000_0000); } { - let mut p = Channel::new_pin(&mut p.PIN_26, Pull::Up); + let mut p = Channel::new_pin(&mut a, Pull::Up); defmt::assert!(adc.blocking_read(&mut p).unwrap() > 0b11_0000_0000); defmt::assert!(adc.read(&mut p).await.unwrap() > 0b11_0000_0000); } @@ -35,21 +45,21 @@ async fn main(_spawner: Spawner) { // not bothering with async reads from now on { { - let mut p = Channel::new_pin(&mut p.PIN_27, Pull::Down); + let mut p = Channel::new_pin(&mut b, Pull::Down); defmt::assert!(adc.blocking_read(&mut p).unwrap() < 0b01_0000_0000); } { - let mut p = Channel::new_pin(&mut p.PIN_27, Pull::Up); + let mut p = Channel::new_pin(&mut b, Pull::Up); defmt::assert!(adc.blocking_read(&mut p).unwrap() > 0b11_0000_0000); } } { { - let mut p = Channel::new_pin(&mut p.PIN_28, Pull::Down); + let mut p = Channel::new_pin(&mut c, Pull::Down); defmt::assert!(adc.blocking_read(&mut p).unwrap() < 0b01_0000_0000); } { - let mut p = Channel::new_pin(&mut p.PIN_28, Pull::Up); + let mut p = Channel::new_pin(&mut c, Pull::Up); defmt::assert!(adc.blocking_read(&mut p).unwrap() > 0b11_0000_0000); } } @@ -57,15 +67,15 @@ async fn main(_spawner: Spawner) { // gp29 is connected to vsys through a 200k/100k divider, // adding pulls should change the value let low = { - let mut p = Channel::new_pin(&mut p.PIN_29, Pull::Down); + let mut p = Channel::new_pin(&mut d, Pull::Down); adc.blocking_read(&mut p).unwrap() }; let none = { - let mut p = Channel::new_pin(&mut p.PIN_29, Pull::None); + let mut p = Channel::new_pin(&mut d, Pull::None); adc.blocking_read(&mut p).unwrap() }; let up = { - let mut p = Channel::new_pin(&mut p.PIN_29, Pull::Up); + let mut p = Channel::new_pin(&mut d, Pull::Up); adc.blocking_read(&mut p).unwrap() }; defmt::assert!(low < none); @@ -89,29 +99,14 @@ async fn main(_spawner: Spawner) { let mut low = [0u16; 16]; let mut none = [0u8; 16]; let mut up = [Sample::default(); 16]; - adc.read_many( - &mut Channel::new_pin(&mut p.PIN_29, Pull::Down), - &mut low, - 1, - &mut p.DMA_CH0, - ) - .await - .unwrap(); - adc.read_many( - &mut Channel::new_pin(&mut p.PIN_29, Pull::None), - &mut none, - 1, - &mut p.DMA_CH0, - ) - .await - .unwrap(); - adc.read_many_raw( - &mut Channel::new_pin(&mut p.PIN_29, Pull::Up), - &mut up, - 1, - &mut p.DMA_CH0, - ) - .await; + adc.read_many(&mut Channel::new_pin(&mut d, Pull::Down), &mut low, 1, &mut p.DMA_CH0) + .await + .unwrap(); + adc.read_many(&mut Channel::new_pin(&mut d, Pull::None), &mut none, 1, &mut p.DMA_CH0) + .await + .unwrap(); + adc.read_many_raw(&mut Channel::new_pin(&mut d, Pull::Up), &mut up, 1, &mut p.DMA_CH0) + .await; defmt::assert!(low.iter().zip(none.iter()).all(|(l, n)| *l >> 4 < *n as u16)); defmt::assert!(up.iter().all(|s| s.good())); defmt::assert!(none.iter().zip(up.iter()).all(|(n, u)| (*n as u16) < u.value())); @@ -133,7 +128,7 @@ async fn main(_spawner: Spawner) { { let mut multi = [0u16; 2]; let mut channels = [ - Channel::new_pin(&mut p.PIN_26, Pull::Up), + Channel::new_pin(&mut a, Pull::Up), Channel::new_temp_sensor(&mut p.ADC_TEMP_SENSOR), ]; adc.read_many_multichannel(&mut channels, &mut multi, 1, &mut p.DMA_CH0) diff --git a/tests/rp/src/bin/dma_copy_async.rs b/tests/rp/src/bin/dma_copy_async.rs index 7c64bc396..3dcf4f4d8 100644 --- a/tests/rp/src/bin/dma_copy_async.rs +++ b/tests/rp/src/bin/dma_copy_async.rs @@ -1,6 +1,9 @@ #![no_std] #![no_main] +#[cfg(feature = "rp2040")] teleprobe_meta::target!(b"rpi-pico"); +#[cfg(feature = "rp235xb")] +teleprobe_meta::target!(b"pimoroni-pico-plus-2"); use defmt::{assert_eq, *}; use embassy_executor::Spawner; diff --git a/tests/rp/src/bin/flash.rs b/tests/rp/src/bin/flash.rs index 310f0d586..548a6ee72 100644 --- a/tests/rp/src/bin/flash.rs +++ b/tests/rp/src/bin/flash.rs @@ -1,6 +1,9 @@ #![no_std] #![no_main] +#[cfg(feature = "rp2040")] teleprobe_meta::target!(b"rpi-pico"); +#[cfg(feature = "rp235xb")] +teleprobe_meta::target!(b"pimoroni-pico-plus-2"); use defmt::*; use embassy_executor::Spawner; @@ -24,13 +27,19 @@ async fn main(_spawner: Spawner) { let mut flash = embassy_rp::flash::Flash::<_, Async, { 2 * 1024 * 1024 }>::new(p.FLASH, p.DMA_CH0); // Get JEDEC id - let jedec = defmt::unwrap!(flash.blocking_jedec_id()); - info!("jedec id: 0x{:x}", jedec); + #[cfg(feature = "rp2040")] + { + let jedec = defmt::unwrap!(flash.blocking_jedec_id()); + info!("jedec id: 0x{:x}", jedec); + } // Get unique id - let mut uid = [0; 8]; - defmt::unwrap!(flash.blocking_unique_id(&mut uid)); - info!("unique id: {:?}", uid); + #[cfg(feature = "rp2040")] + { + let mut uid = [0; 8]; + defmt::unwrap!(flash.blocking_unique_id(&mut uid)); + info!("unique id: {:?}", uid); + } let mut buf = [0u8; ERASE_SIZE]; defmt::unwrap!(flash.blocking_read(ADDR_OFFSET, &mut buf)); diff --git a/tests/rp/src/bin/gpio.rs b/tests/rp/src/bin/gpio.rs index e0c309887..6c37ac5be 100644 --- a/tests/rp/src/bin/gpio.rs +++ b/tests/rp/src/bin/gpio.rs @@ -1,10 +1,15 @@ #![no_std] #![no_main] +#[cfg(feature = "rp2040")] teleprobe_meta::target!(b"rpi-pico"); +#[cfg(feature = "rp235xb")] +teleprobe_meta::target!(b"pimoroni-pico-plus-2"); use defmt::{assert, *}; use embassy_executor::Spawner; -use embassy_rp::gpio::{Flex, Input, Level, Output, OutputOpenDrain, Pull}; +#[cfg(feature = "rp2040")] +use embassy_rp::gpio::OutputOpenDrain; +use embassy_rp::gpio::{Flex, Input, Level, Output, Pull}; use {defmt_rtt as _, panic_probe as _}; #[embassy_executor::main] @@ -76,6 +81,7 @@ async fn main(_spawner: Spawner) { } // Test input pulldown + #[cfg(feature = "rp2040")] { let b = Input::new(&mut b, Pull::Down); delay(); @@ -104,6 +110,7 @@ async fn main(_spawner: Spawner) { } // OUTPUT OPEN DRAIN + #[cfg(feature = "rp2040")] { let mut b = OutputOpenDrain::new(&mut b, Level::High); let mut a = Flex::new(&mut a); @@ -202,6 +209,7 @@ async fn main(_spawner: Spawner) { } // Test input pulldown + #[cfg(feature = "rp2040")] { let mut b = Flex::new(&mut b); b.set_as_input(); diff --git a/tests/rp/src/bin/gpio_async.rs b/tests/rp/src/bin/gpio_async.rs index 40a304464..39e3d6337 100644 --- a/tests/rp/src/bin/gpio_async.rs +++ b/tests/rp/src/bin/gpio_async.rs @@ -1,6 +1,9 @@ #![no_std] #![no_main] +#[cfg(feature = "rp2040")] teleprobe_meta::target!(b"rpi-pico"); +#[cfg(feature = "rp235xb")] +teleprobe_meta::target!(b"pimoroni-pico-plus-2"); use defmt::{assert, *}; use embassy_executor::Spawner; diff --git a/tests/rp/src/bin/gpio_multicore.rs b/tests/rp/src/bin/gpio_multicore.rs index e9c6f3122..3caa8ef35 100644 --- a/tests/rp/src/bin/gpio_multicore.rs +++ b/tests/rp/src/bin/gpio_multicore.rs @@ -1,6 +1,9 @@ #![no_std] #![no_main] +#[cfg(feature = "rp2040")] teleprobe_meta::target!(b"rpi-pico"); +#[cfg(feature = "rp235xb")] +teleprobe_meta::target!(b"pimoroni-pico-plus-2"); use defmt::{info, unwrap}; use embassy_executor::Executor; @@ -56,7 +59,7 @@ async fn core1_task(p: PIN_1) { CHANNEL0.receive().await; - let mut pin = Input::new(p, Pull::Down); + let mut pin = Input::new(p, Pull::None); let wait = pin.wait_for_rising_edge(); CHANNEL1.send(()).await; diff --git a/tests/rp/src/bin/i2c.rs b/tests/rp/src/bin/i2c.rs index 9615007bd..2c835bd5a 100644 --- a/tests/rp/src/bin/i2c.rs +++ b/tests/rp/src/bin/i2c.rs @@ -1,23 +1,21 @@ #![no_std] #![no_main] +#[cfg(feature = "rp2040")] teleprobe_meta::target!(b"rpi-pico"); +#[cfg(feature = "rp235xb")] +teleprobe_meta::target!(b"pimoroni-pico-plus-2"); -use defmt::{assert_eq, info, panic, unwrap}; +use defmt::{assert_eq, info, panic}; use embassy_embedded_hal::SetConfig; -use embassy_executor::{Executor, Spawner}; +use embassy_executor::Spawner; use embassy_rp::clocks::{PllConfig, XoscConfig}; use embassy_rp::config::Config as rpConfig; -use embassy_rp::multicore::{spawn_core1, Stack}; use embassy_rp::peripherals::{I2C0, I2C1}; use embassy_rp::{bind_interrupts, i2c, i2c_slave}; use embedded_hal_1::i2c::Operation; use embedded_hal_async::i2c::I2c; -use static_cell::StaticCell; use {defmt_rtt as _, panic_probe as _, panic_probe as _, panic_probe as _}; -static mut CORE1_STACK: Stack<1024> = Stack::new(); -static EXECUTOR1: StaticCell = StaticCell::new(); - use crate::i2c::AbortReason; bind_interrupts!(struct Irqs { @@ -106,7 +104,7 @@ async fn device_task(mut dev: i2c_slave::I2cSlave<'static, I2C1>) -> ! { } async fn controller_task(con: &mut i2c::I2c<'static, I2C0, i2c::Async>) { - info!("Device start"); + info!("Controller start"); { let buf = [0xCA, 0x11]; @@ -180,7 +178,7 @@ async fn controller_task(con: &mut i2c::I2c<'static, I2C0, i2c::Async>) { } #[embassy_executor::main] - async fn main(_core0_spawner: Spawner) { + async fn main(spawner: Spawner) { let mut config = rpConfig::default(); // Configure clk_sys to 48MHz to support 1kHz scl. // In theory it can go lower, but we won't bother to test below 1kHz. @@ -210,14 +208,7 @@ async fn controller_task(con: &mut i2c::I2c<'static, I2C0, i2c::Async>) { config.addr = DEV_ADDR as u16; let device = i2c_slave::I2cSlave::new(p.I2C1, d_sda, d_scl, Irqs, config); - spawn_core1( - p.CORE1, - unsafe { &mut *core::ptr::addr_of_mut!(CORE1_STACK) }, - move || { - let executor1 = EXECUTOR1.init(Executor::new()); - executor1.run(|spawner| unwrap!(spawner.spawn(device_task(device)))); - }, - ); + spawner.must_spawn(device_task(device)); let c_sda = p.PIN_21; let c_scl = p.PIN_20; diff --git a/tests/rp/src/bin/multicore.rs b/tests/rp/src/bin/multicore.rs index 783ea0f27..902169c40 100644 --- a/tests/rp/src/bin/multicore.rs +++ b/tests/rp/src/bin/multicore.rs @@ -1,6 +1,9 @@ #![no_std] #![no_main] +#[cfg(feature = "rp2040")] teleprobe_meta::target!(b"rpi-pico"); +#[cfg(feature = "rp235xb")] +teleprobe_meta::target!(b"pimoroni-pico-plus-2"); use defmt::{info, unwrap}; use embassy_executor::Executor; diff --git a/tests/rp/src/bin/pio_irq.rs b/tests/rp/src/bin/pio_irq.rs index 33cdaaac9..512c7f799 100644 --- a/tests/rp/src/bin/pio_irq.rs +++ b/tests/rp/src/bin/pio_irq.rs @@ -1,6 +1,9 @@ #![no_std] #![no_main] +#[cfg(feature = "rp2040")] teleprobe_meta::target!(b"rpi-pico"); +#[cfg(feature = "rp235xb")] +teleprobe_meta::target!(b"pimoroni-pico-plus-2"); use defmt::info; use embassy_executor::Spawner; diff --git a/tests/rp/src/bin/pio_multi_load.rs b/tests/rp/src/bin/pio_multi_load.rs index cd28f99b6..b584bc34e 100644 --- a/tests/rp/src/bin/pio_multi_load.rs +++ b/tests/rp/src/bin/pio_multi_load.rs @@ -1,6 +1,9 @@ #![no_std] #![no_main] +#[cfg(feature = "rp2040")] teleprobe_meta::target!(b"rpi-pico"); +#[cfg(feature = "rp235xb")] +teleprobe_meta::target!(b"pimoroni-pico-plus-2"); use defmt::info; use embassy_executor::Spawner; diff --git a/tests/rp/src/bin/pwm.rs b/tests/rp/src/bin/pwm.rs index c05197000..d8ee78dcd 100644 --- a/tests/rp/src/bin/pwm.rs +++ b/tests/rp/src/bin/pwm.rs @@ -1,10 +1,15 @@ #![no_std] #![no_main] +#[cfg(feature = "rp2040")] teleprobe_meta::target!(b"rpi-pico"); +#[cfg(feature = "rp235xb")] +teleprobe_meta::target!(b"pimoroni-pico-plus-2"); use defmt::{assert, assert_eq, assert_ne, *}; use embassy_executor::Spawner; -use embassy_rp::gpio::{Input, Level, Output, Pull}; +use embassy_rp::gpio::{Input, Pull}; +#[cfg(feature = "rp2040")] +use embassy_rp::gpio::{Level, Output}; use embassy_rp::pwm::{Config, InputMode, Pwm}; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; @@ -92,6 +97,7 @@ async fn main(_spawner: Spawner) { } // Test level-gated + #[cfg(feature = "rp2040")] { let mut pin2 = Output::new(&mut p11, Level::Low); let pwm = Pwm::new_input(&mut p.PWM_SLICE3, &mut p7, Pull::None, InputMode::Level, cfg.clone()); @@ -102,12 +108,14 @@ async fn main(_spawner: Spawner) { Timer::after_millis(1).await; pin2.set_low(); let ctr = pwm.counter(); + info!("ctr: {}", ctr); assert!(ctr >= 1000); Timer::after_millis(1).await; assert_eq!(pwm.counter(), ctr); } // Test rising-gated + #[cfg(feature = "rp2040")] { let mut pin2 = Output::new(&mut p11, Level::Low); let pwm = Pwm::new_input( @@ -129,6 +137,7 @@ async fn main(_spawner: Spawner) { } // Test falling-gated + #[cfg(feature = "rp2040")] { let mut pin2 = Output::new(&mut p11, Level::High); let pwm = Pwm::new_input( diff --git a/tests/rp/src/bin/spi.rs b/tests/rp/src/bin/spi.rs index 4b02942a7..6802bfc99 100644 --- a/tests/rp/src/bin/spi.rs +++ b/tests/rp/src/bin/spi.rs @@ -1,6 +1,9 @@ #![no_std] #![no_main] +#[cfg(feature = "rp2040")] teleprobe_meta::target!(b"rpi-pico"); +#[cfg(feature = "rp235xb")] +teleprobe_meta::target!(b"pimoroni-pico-plus-2"); use defmt::{assert_eq, *}; use embassy_executor::Spawner; diff --git a/tests/rp/src/bin/spi_async.rs b/tests/rp/src/bin/spi_async.rs index efdc80b53..e50667435 100644 --- a/tests/rp/src/bin/spi_async.rs +++ b/tests/rp/src/bin/spi_async.rs @@ -3,7 +3,10 @@ //! #![no_std] #![no_main] +#[cfg(feature = "rp2040")] teleprobe_meta::target!(b"rpi-pico"); +#[cfg(feature = "rp235xb")] +teleprobe_meta::target!(b"pimoroni-pico-plus-2"); use defmt::{assert_eq, *}; use embassy_executor::Spawner; diff --git a/tests/rp/src/bin/timer.rs b/tests/rp/src/bin/timer.rs index be9242144..12a4d7daa 100644 --- a/tests/rp/src/bin/timer.rs +++ b/tests/rp/src/bin/timer.rs @@ -1,6 +1,9 @@ #![no_std] #![no_main] +#[cfg(feature = "rp2040")] teleprobe_meta::target!(b"rpi-pico"); +#[cfg(feature = "rp235xb")] +teleprobe_meta::target!(b"pimoroni-pico-plus-2"); use defmt::{assert, *}; use embassy_executor::Spawner; diff --git a/tests/rp/src/bin/uart.rs b/tests/rp/src/bin/uart.rs index 6e6e5517b..67cfa6bc8 100644 --- a/tests/rp/src/bin/uart.rs +++ b/tests/rp/src/bin/uart.rs @@ -1,6 +1,9 @@ #![no_std] #![no_main] +#[cfg(feature = "rp2040")] teleprobe_meta::target!(b"rpi-pico"); +#[cfg(feature = "rp235xb")] +teleprobe_meta::target!(b"pimoroni-pico-plus-2"); use defmt::{assert_eq, *}; use embassy_executor::Spawner; diff --git a/tests/rp/src/bin/uart_buffered.rs b/tests/rp/src/bin/uart_buffered.rs index d68c23cbd..a543320e0 100644 --- a/tests/rp/src/bin/uart_buffered.rs +++ b/tests/rp/src/bin/uart_buffered.rs @@ -1,6 +1,9 @@ #![no_std] #![no_main] +#[cfg(feature = "rp2040")] teleprobe_meta::target!(b"rpi-pico"); +#[cfg(feature = "rp235xb")] +teleprobe_meta::target!(b"pimoroni-pico-plus-2"); use defmt::{assert_eq, panic, *}; use embassy_executor::Spawner; diff --git a/tests/rp/src/bin/uart_dma.rs b/tests/rp/src/bin/uart_dma.rs index edc87175a..bdf94e78c 100644 --- a/tests/rp/src/bin/uart_dma.rs +++ b/tests/rp/src/bin/uart_dma.rs @@ -1,6 +1,9 @@ #![no_std] #![no_main] +#[cfg(feature = "rp2040")] teleprobe_meta::target!(b"rpi-pico"); +#[cfg(feature = "rp235xb")] +teleprobe_meta::target!(b"pimoroni-pico-plus-2"); use defmt::{assert_eq, *}; use embassy_executor::Spawner; diff --git a/tests/rp/src/bin/uart_upgrade.rs b/tests/rp/src/bin/uart_upgrade.rs index 603e20f2f..f658b6b8c 100644 --- a/tests/rp/src/bin/uart_upgrade.rs +++ b/tests/rp/src/bin/uart_upgrade.rs @@ -1,6 +1,9 @@ #![no_std] #![no_main] +#[cfg(feature = "rp2040")] teleprobe_meta::target!(b"rpi-pico"); +#[cfg(feature = "rp235xb")] +teleprobe_meta::target!(b"pimoroni-pico-plus-2"); use defmt::{assert_eq, *}; use embassy_executor::Spawner;