aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xci.sh12
-rw-r--r--tests/rp/.cargo/config.toml6
-rw-r--r--tests/rp/Cargo.toml31
-rw-r--r--tests/rp/readme.md8
-rw-r--r--tests/rp/src/bin/adc.rs65
-rw-r--r--tests/rp/src/bin/dma_copy_async.rs3
-rw-r--r--tests/rp/src/bin/flash.rs19
-rw-r--r--tests/rp/src/bin/gpio.rs10
-rw-r--r--tests/rp/src/bin/gpio_async.rs3
-rw-r--r--tests/rp/src/bin/gpio_multicore.rs5
-rw-r--r--tests/rp/src/bin/i2c.rs25
-rw-r--r--tests/rp/src/bin/multicore.rs3
-rw-r--r--tests/rp/src/bin/pio_irq.rs3
-rw-r--r--tests/rp/src/bin/pio_multi_load.rs3
-rw-r--r--tests/rp/src/bin/pwm.rs11
-rw-r--r--tests/rp/src/bin/spi.rs3
-rw-r--r--tests/rp/src/bin/spi_async.rs3
-rw-r--r--tests/rp/src/bin/timer.rs3
-rw-r--r--tests/rp/src/bin/uart.rs3
-rw-r--r--tests/rp/src/bin/uart_buffered.rs3
-rw-r--r--tests/rp/src/bin/uart_dma.rs3
-rw-r--r--tests/rp/src/bin/uart_upgrade.rs3
22 files changed, 164 insertions, 64 deletions
diff --git a/ci.sh b/ci.sh
index 149999d58..5e01805ef 100755
--- a/ci.sh
+++ b/ci.sh
@@ -291,7 +291,8 @@ cargo batch \
291 --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32f091rc --artifact-dir out/tests/stm32f091rc \ 291 --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32f091rc --artifact-dir out/tests/stm32f091rc \
292 --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32h503rb --artifact-dir out/tests/stm32h503rb \ 292 --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32h503rb --artifact-dir out/tests/stm32h503rb \
293 --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32u083rc --artifact-dir out/tests/stm32u083rc \ 293 --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32u083rc --artifact-dir out/tests/stm32u083rc \
294 --- build --release --manifest-path tests/rp/Cargo.toml --target thumbv6m-none-eabi --artifact-dir out/tests/rpi-pico \ 294 --- build --release --manifest-path tests/rp/Cargo.toml --target thumbv6m-none-eabi --features rp2040 --artifact-dir out/tests/rpi-pico \
295 --- build --release --manifest-path tests/rp/Cargo.toml --target thumbv8m.main-none-eabihf --features rp235xb --artifact-dir out/tests/pimoroni-pico-plus-2 \
295 --- build --release --manifest-path tests/nrf/Cargo.toml --target thumbv6m-none-eabi --features nrf51422 --artifact-dir out/tests/nrf51422-dk \ 296 --- build --release --manifest-path tests/nrf/Cargo.toml --target thumbv6m-none-eabi --features nrf51422 --artifact-dir out/tests/nrf51422-dk \
296 --- build --release --manifest-path tests/nrf/Cargo.toml --target thumbv7em-none-eabi --features nrf52832 --artifact-dir out/tests/nrf52832-dk \ 297 --- build --release --manifest-path tests/nrf/Cargo.toml --target thumbv7em-none-eabi --features nrf52832 --artifact-dir out/tests/nrf52832-dk \
297 --- build --release --manifest-path tests/nrf/Cargo.toml --target thumbv7em-none-eabi --features nrf52833 --artifact-dir out/tests/nrf52833-dk \ 298 --- 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
319# doesn't work, gives "noise error", no idea why. usart_dma does pass. 320# doesn't work, gives "noise error", no idea why. usart_dma does pass.
320rm out/tests/stm32u5a5zj/usart 321rm out/tests/stm32u5a5zj/usart
321 322
323# probe-rs error: "multi-core ram flash start not implemented yet"
324# As of 2025-02-17 these tests work when run from flash
325rm out/tests/pimoroni-pico-plus-2/multicore
326rm out/tests/pimoroni-pico-plus-2/gpio_multicore
327# Doesn't work when run from ram on the 2350
328rm out/tests/pimoroni-pico-plus-2/flash
329# This test passes locally but fails on the HIL, no idea why
330rm out/tests/pimoroni-pico-plus-2/i2c
331
322if [[ -z "${TELEPROBE_TOKEN-}" ]]; then 332if [[ -z "${TELEPROBE_TOKEN-}" ]]; then
323 echo No teleprobe token found, skipping running HIL tests 333 echo No teleprobe token found, skipping running HIL tests
324 exit 334 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 @@
5#build-std-features = ["panic_immediate_abort"] 5#build-std-features = ["panic_immediate_abort"]
6 6
7[target.'cfg(all(target_arch = "arm", target_os = "none"))'] 7[target.'cfg(all(target_arch = "arm", target_os = "none"))']
8runner = "teleprobe client run" 8#runner = "teleprobe client run"
9#runner = "teleprobe local run --chip RP2040 --elf" 9#runner = "teleprobe local run --chip RP2040 --elf"
10runner = "teleprobe local run --chip RP235X --elf"
10 11
11rustflags = [ 12rustflags = [
12 # Code-size optimizations. 13 # Code-size optimizations.
@@ -15,7 +16,8 @@ rustflags = [
15] 16]
16 17
17[build] 18[build]
18target = "thumbv6m-none-eabi" 19#target = "thumbv6m-none-eabi"
20target = "thumbv8m.main-none-eabihf"
19 21
20[env] 22[env]
21DEFMT_LOG = "trace,embassy_hal_internal=debug,embassy_net_esp_hosted=debug,cyw43=info,cyw43_pio=info,smoltcp=info" 23DEFMT_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"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6 6
7[features]
8rp2040 = ["embassy-rp/rp2040"]
9rp235xa = ["embassy-rp/rp235xa"]
10rp235xb = ["embassy-rp/rp235xb"]
11
7[dependencies] 12[dependencies]
8teleprobe-meta = "1.1" 13teleprobe-meta = "1.1"
9 14
10embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } 15embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] }
11embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "defmt"] } 16embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "defmt"] }
12embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", ] } 17embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", ] }
13embassy-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"] } 18embassy-rp = { version = "0.3.0", path = "../../embassy-rp", features = [ "defmt", "unstable-pac", "time-driver", "critical-section-impl", "intrinsics", "rom-v2-intrinsics", "run-from-ram"] }
14embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } 19embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
15embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "tcp", "udp", "dhcpv4", "medium-ethernet"] } 20embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "tcp", "udp", "dhcpv4", "medium-ethernet"] }
16embassy-net-wiznet = { version = "0.2.0", path = "../../embassy-net-wiznet", features = ["defmt"] } 21embassy-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
37pio = { git = "https://github.com/rp-rs/pio-rs", rev = "fa586448b0b223217eec8c92c19fe6823dd04cc4" } 42pio = { git = "https://github.com/rp-rs/pio-rs", rev = "fa586448b0b223217eec8c92c19fe6823dd04cc4" }
38rand = { version = "0.8.5", default-features = false } 43rand = { version = "0.8.5", default-features = false }
39 44
45# bootsel not currently supported on 2350
46[[bin]]
47name = "bootsel"
48path = "src/bin/bootsel.rs"
49required-features = [ "rp2040",]
50
51# 2350 devboard isn't a W
52[[bin]]
53name = "cyw43-perf"
54path = "src/bin/cyw43-perf.rs"
55required-features = [ "rp2040",]
56
57# Eth test only for the w5100s-evb-pico
58[[bin]]
59name = "ethernet_w5100s_perf"
60path = "src/bin/ethernet_w5100s_perf.rs"
61required-features = [ "rp2040",]
62
63# Float intrinsics are only relevant for the 2040
64[[bin]]
65name = "float"
66path = "src/bin/float.rs"
67required-features = [ "rp2040",]
68
40[profile.dev] 69[profile.dev]
41debug = 2 70debug = 2
42debug-assertions = true 71debug-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 @@
1# Pico and Pico 2 Plus connections
2
3GP0-GP1
4GP3-GP4
5GP6-GP9
6GP7-GP11
7GP18-GP20 with 10k pullup
8GP19-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 @@
1#![no_std] 1#![no_std]
2#![no_main] 2#![no_main]
3#[cfg(feature = "rp2040")]
3teleprobe_meta::target!(b"rpi-pico"); 4teleprobe_meta::target!(b"rpi-pico");
5#[cfg(feature = "rp235xb")]
6teleprobe_meta::target!(b"pimoroni-pico-plus-2");
4 7
5use defmt::*; 8use defmt::*;
6use embassy_executor::Spawner; 9use embassy_executor::Spawner;
7use embassy_rp::adc::{Adc, Channel, Config, InterruptHandler, Sample}; 10use embassy_rp::adc::Sample;
11use embassy_rp::adc::{Adc, Channel, Config, InterruptHandler};
8use embassy_rp::bind_interrupts; 12use embassy_rp::bind_interrupts;
9use embassy_rp::gpio::{Level, Output, Pull}; 13use embassy_rp::gpio::Pull;
14use embassy_rp::gpio::{Level, Output};
10use {defmt_rtt as _, panic_probe as _}; 15use {defmt_rtt as _, panic_probe as _};
11 16
12bind_interrupts!(struct Irqs { 17bind_interrupts!(struct Irqs {
@@ -20,14 +25,19 @@ async fn main(_spawner: Spawner) {
20 let _wifi_off = Output::new(p.PIN_25, Level::High); 25 let _wifi_off = Output::new(p.PIN_25, Level::High);
21 let mut adc = Adc::new(p.ADC, Irqs, Config::default()); 26 let mut adc = Adc::new(p.ADC, Irqs, Config::default());
22 27
28 #[cfg(any(feature = "rp2040", feature = "rp235xa"))]
29 let (mut a, mut b, mut c, mut d) = (p.PIN_26, p.PIN_27, p.PIN_28, p.PIN_29);
30 #[cfg(feature = "rp235xb")]
31 let (mut a, mut b, mut c, mut d) = (p.PIN_44, p.PIN_45, p.PIN_46, p.PIN_47);
32
23 { 33 {
24 { 34 {
25 let mut p = Channel::new_pin(&mut p.PIN_26, Pull::Down); 35 let mut p = Channel::new_pin(&mut a, Pull::Down);
26 defmt::assert!(adc.blocking_read(&mut p).unwrap() < 0b01_0000_0000); 36 defmt::assert!(adc.blocking_read(&mut p).unwrap() < 0b01_0000_0000);
27 defmt::assert!(adc.read(&mut p).await.unwrap() < 0b01_0000_0000); 37 defmt::assert!(adc.read(&mut p).await.unwrap() < 0b01_0000_0000);
28 } 38 }
29 { 39 {
30 let mut p = Channel::new_pin(&mut p.PIN_26, Pull::Up); 40 let mut p = Channel::new_pin(&mut a, Pull::Up);
31 defmt::assert!(adc.blocking_read(&mut p).unwrap() > 0b11_0000_0000); 41 defmt::assert!(adc.blocking_read(&mut p).unwrap() > 0b11_0000_0000);
32 defmt::assert!(adc.read(&mut p).await.unwrap() > 0b11_0000_0000); 42 defmt::assert!(adc.read(&mut p).await.unwrap() > 0b11_0000_0000);
33 } 43 }
@@ -35,21 +45,21 @@ async fn main(_spawner: Spawner) {
35 // not bothering with async reads from now on 45 // not bothering with async reads from now on
36 { 46 {
37 { 47 {
38 let mut p = Channel::new_pin(&mut p.PIN_27, Pull::Down); 48 let mut p = Channel::new_pin(&mut b, Pull::Down);
39 defmt::assert!(adc.blocking_read(&mut p).unwrap() < 0b01_0000_0000); 49 defmt::assert!(adc.blocking_read(&mut p).unwrap() < 0b01_0000_0000);
40 } 50 }
41 { 51 {
42 let mut p = Channel::new_pin(&mut p.PIN_27, Pull::Up); 52 let mut p = Channel::new_pin(&mut b, Pull::Up);
43 defmt::assert!(adc.blocking_read(&mut p).unwrap() > 0b11_0000_0000); 53 defmt::assert!(adc.blocking_read(&mut p).unwrap() > 0b11_0000_0000);
44 } 54 }
45 } 55 }
46 { 56 {
47 { 57 {
48 let mut p = Channel::new_pin(&mut p.PIN_28, Pull::Down); 58 let mut p = Channel::new_pin(&mut c, Pull::Down);
49 defmt::assert!(adc.blocking_read(&mut p).unwrap() < 0b01_0000_0000); 59 defmt::assert!(adc.blocking_read(&mut p).unwrap() < 0b01_0000_0000);
50 } 60 }
51 { 61 {
52 let mut p = Channel::new_pin(&mut p.PIN_28, Pull::Up); 62 let mut p = Channel::new_pin(&mut c, Pull::Up);
53 defmt::assert!(adc.blocking_read(&mut p).unwrap() > 0b11_0000_0000); 63 defmt::assert!(adc.blocking_read(&mut p).unwrap() > 0b11_0000_0000);
54 } 64 }
55 } 65 }
@@ -57,15 +67,15 @@ async fn main(_spawner: Spawner) {
57 // gp29 is connected to vsys through a 200k/100k divider, 67 // gp29 is connected to vsys through a 200k/100k divider,
58 // adding pulls should change the value 68 // adding pulls should change the value
59 let low = { 69 let low = {
60 let mut p = Channel::new_pin(&mut p.PIN_29, Pull::Down); 70 let mut p = Channel::new_pin(&mut d, Pull::Down);
61 adc.blocking_read(&mut p).unwrap() 71 adc.blocking_read(&mut p).unwrap()
62 }; 72 };
63 let none = { 73 let none = {
64 let mut p = Channel::new_pin(&mut p.PIN_29, Pull::None); 74 let mut p = Channel::new_pin(&mut d, Pull::None);
65 adc.blocking_read(&mut p).unwrap() 75 adc.blocking_read(&mut p).unwrap()
66 }; 76 };
67 let up = { 77 let up = {
68 let mut p = Channel::new_pin(&mut p.PIN_29, Pull::Up); 78 let mut p = Channel::new_pin(&mut d, Pull::Up);
69 adc.blocking_read(&mut p).unwrap() 79 adc.blocking_read(&mut p).unwrap()
70 }; 80 };
71 defmt::assert!(low < none); 81 defmt::assert!(low < none);
@@ -89,29 +99,14 @@ async fn main(_spawner: Spawner) {
89 let mut low = [0u16; 16]; 99 let mut low = [0u16; 16];
90 let mut none = [0u8; 16]; 100 let mut none = [0u8; 16];
91 let mut up = [Sample::default(); 16]; 101 let mut up = [Sample::default(); 16];
92 adc.read_many( 102 adc.read_many(&mut Channel::new_pin(&mut d, Pull::Down), &mut low, 1, &mut p.DMA_CH0)
93 &mut Channel::new_pin(&mut p.PIN_29, Pull::Down), 103 .await
94 &mut low, 104 .unwrap();
95 1, 105 adc.read_many(&mut Channel::new_pin(&mut d, Pull::None), &mut none, 1, &mut p.DMA_CH0)
96 &mut p.DMA_CH0, 106 .await
97 ) 107 .unwrap();
98 .await 108 adc.read_many_raw(&mut Channel::new_pin(&mut d, Pull::Up), &mut up, 1, &mut p.DMA_CH0)
99 .unwrap(); 109 .await;
100 adc.read_many(
101 &mut Channel::new_pin(&mut p.PIN_29, Pull::None),
102 &mut none,
103 1,
104 &mut p.DMA_CH0,
105 )
106 .await
107 .unwrap();
108 adc.read_many_raw(
109 &mut Channel::new_pin(&mut p.PIN_29, Pull::Up),
110 &mut up,
111 1,
112 &mut p.DMA_CH0,
113 )
114 .await;
115 defmt::assert!(low.iter().zip(none.iter()).all(|(l, n)| *l >> 4 < *n as u16)); 110 defmt::assert!(low.iter().zip(none.iter()).all(|(l, n)| *l >> 4 < *n as u16));
116 defmt::assert!(up.iter().all(|s| s.good())); 111 defmt::assert!(up.iter().all(|s| s.good()));
117 defmt::assert!(none.iter().zip(up.iter()).all(|(n, u)| (*n as u16) < u.value())); 112 defmt::assert!(none.iter().zip(up.iter()).all(|(n, u)| (*n as u16) < u.value()));
@@ -133,7 +128,7 @@ async fn main(_spawner: Spawner) {
133 { 128 {
134 let mut multi = [0u16; 2]; 129 let mut multi = [0u16; 2];
135 let mut channels = [ 130 let mut channels = [
136 Channel::new_pin(&mut p.PIN_26, Pull::Up), 131 Channel::new_pin(&mut a, Pull::Up),
137 Channel::new_temp_sensor(&mut p.ADC_TEMP_SENSOR), 132 Channel::new_temp_sensor(&mut p.ADC_TEMP_SENSOR),
138 ]; 133 ];
139 adc.read_many_multichannel(&mut channels, &mut multi, 1, &mut p.DMA_CH0) 134 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 @@
1#![no_std] 1#![no_std]
2#![no_main] 2#![no_main]
3#[cfg(feature = "rp2040")]
3teleprobe_meta::target!(b"rpi-pico"); 4teleprobe_meta::target!(b"rpi-pico");
5#[cfg(feature = "rp235xb")]
6teleprobe_meta::target!(b"pimoroni-pico-plus-2");
4 7
5use defmt::{assert_eq, *}; 8use defmt::{assert_eq, *};
6use embassy_executor::Spawner; 9use 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 @@
1#![no_std] 1#![no_std]
2#![no_main] 2#![no_main]
3#[cfg(feature = "rp2040")]
3teleprobe_meta::target!(b"rpi-pico"); 4teleprobe_meta::target!(b"rpi-pico");
5#[cfg(feature = "rp235xb")]
6teleprobe_meta::target!(b"pimoroni-pico-plus-2");
4 7
5use defmt::*; 8use defmt::*;
6use embassy_executor::Spawner; 9use embassy_executor::Spawner;
@@ -24,13 +27,19 @@ async fn main(_spawner: Spawner) {
24 let mut flash = embassy_rp::flash::Flash::<_, Async, { 2 * 1024 * 1024 }>::new(p.FLASH, p.DMA_CH0); 27 let mut flash = embassy_rp::flash::Flash::<_, Async, { 2 * 1024 * 1024 }>::new(p.FLASH, p.DMA_CH0);
25 28
26 // Get JEDEC id 29 // Get JEDEC id
27 let jedec = defmt::unwrap!(flash.blocking_jedec_id()); 30 #[cfg(feature = "rp2040")]
28 info!("jedec id: 0x{:x}", jedec); 31 {
32 let jedec = defmt::unwrap!(flash.blocking_jedec_id());
33 info!("jedec id: 0x{:x}", jedec);
34 }
29 35
30 // Get unique id 36 // Get unique id
31 let mut uid = [0; 8]; 37 #[cfg(feature = "rp2040")]
32 defmt::unwrap!(flash.blocking_unique_id(&mut uid)); 38 {
33 info!("unique id: {:?}", uid); 39 let mut uid = [0; 8];
40 defmt::unwrap!(flash.blocking_unique_id(&mut uid));
41 info!("unique id: {:?}", uid);
42 }
34 43
35 let mut buf = [0u8; ERASE_SIZE]; 44 let mut buf = [0u8; ERASE_SIZE];
36 defmt::unwrap!(flash.blocking_read(ADDR_OFFSET, &mut buf)); 45 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 @@
1#![no_std] 1#![no_std]
2#![no_main] 2#![no_main]
3#[cfg(feature = "rp2040")]
3teleprobe_meta::target!(b"rpi-pico"); 4teleprobe_meta::target!(b"rpi-pico");
5#[cfg(feature = "rp235xb")]
6teleprobe_meta::target!(b"pimoroni-pico-plus-2");
4 7
5use defmt::{assert, *}; 8use defmt::{assert, *};
6use embassy_executor::Spawner; 9use embassy_executor::Spawner;
7use embassy_rp::gpio::{Flex, Input, Level, Output, OutputOpenDrain, Pull}; 10#[cfg(feature = "rp2040")]
11use embassy_rp::gpio::OutputOpenDrain;
12use embassy_rp::gpio::{Flex, Input, Level, Output, Pull};
8use {defmt_rtt as _, panic_probe as _}; 13use {defmt_rtt as _, panic_probe as _};
9 14
10#[embassy_executor::main] 15#[embassy_executor::main]
@@ -76,6 +81,7 @@ async fn main(_spawner: Spawner) {
76 } 81 }
77 82
78 // Test input pulldown 83 // Test input pulldown
84 #[cfg(feature = "rp2040")]
79 { 85 {
80 let b = Input::new(&mut b, Pull::Down); 86 let b = Input::new(&mut b, Pull::Down);
81 delay(); 87 delay();
@@ -104,6 +110,7 @@ async fn main(_spawner: Spawner) {
104 } 110 }
105 111
106 // OUTPUT OPEN DRAIN 112 // OUTPUT OPEN DRAIN
113 #[cfg(feature = "rp2040")]
107 { 114 {
108 let mut b = OutputOpenDrain::new(&mut b, Level::High); 115 let mut b = OutputOpenDrain::new(&mut b, Level::High);
109 let mut a = Flex::new(&mut a); 116 let mut a = Flex::new(&mut a);
@@ -202,6 +209,7 @@ async fn main(_spawner: Spawner) {
202 } 209 }
203 210
204 // Test input pulldown 211 // Test input pulldown
212 #[cfg(feature = "rp2040")]
205 { 213 {
206 let mut b = Flex::new(&mut b); 214 let mut b = Flex::new(&mut b);
207 b.set_as_input(); 215 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 @@
1#![no_std] 1#![no_std]
2#![no_main] 2#![no_main]
3#[cfg(feature = "rp2040")]
3teleprobe_meta::target!(b"rpi-pico"); 4teleprobe_meta::target!(b"rpi-pico");
5#[cfg(feature = "rp235xb")]
6teleprobe_meta::target!(b"pimoroni-pico-plus-2");
4 7
5use defmt::{assert, *}; 8use defmt::{assert, *};
6use embassy_executor::Spawner; 9use 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 @@
1#![no_std] 1#![no_std]
2#![no_main] 2#![no_main]
3#[cfg(feature = "rp2040")]
3teleprobe_meta::target!(b"rpi-pico"); 4teleprobe_meta::target!(b"rpi-pico");
5#[cfg(feature = "rp235xb")]
6teleprobe_meta::target!(b"pimoroni-pico-plus-2");
4 7
5use defmt::{info, unwrap}; 8use defmt::{info, unwrap};
6use embassy_executor::Executor; 9use embassy_executor::Executor;
@@ -56,7 +59,7 @@ async fn core1_task(p: PIN_1) {
56 59
57 CHANNEL0.receive().await; 60 CHANNEL0.receive().await;
58 61
59 let mut pin = Input::new(p, Pull::Down); 62 let mut pin = Input::new(p, Pull::None);
60 let wait = pin.wait_for_rising_edge(); 63 let wait = pin.wait_for_rising_edge();
61 64
62 CHANNEL1.send(()).await; 65 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 @@
1#![no_std] 1#![no_std]
2#![no_main] 2#![no_main]
3#[cfg(feature = "rp2040")]
3teleprobe_meta::target!(b"rpi-pico"); 4teleprobe_meta::target!(b"rpi-pico");
5#[cfg(feature = "rp235xb")]
6teleprobe_meta::target!(b"pimoroni-pico-plus-2");
4 7
5use defmt::{assert_eq, info, panic, unwrap}; 8use defmt::{assert_eq, info, panic};
6use embassy_embedded_hal::SetConfig; 9use embassy_embedded_hal::SetConfig;
7use embassy_executor::{Executor, Spawner}; 10use embassy_executor::Spawner;
8use embassy_rp::clocks::{PllConfig, XoscConfig}; 11use embassy_rp::clocks::{PllConfig, XoscConfig};
9use embassy_rp::config::Config as rpConfig; 12use embassy_rp::config::Config as rpConfig;
10use embassy_rp::multicore::{spawn_core1, Stack};
11use embassy_rp::peripherals::{I2C0, I2C1}; 13use embassy_rp::peripherals::{I2C0, I2C1};
12use embassy_rp::{bind_interrupts, i2c, i2c_slave}; 14use embassy_rp::{bind_interrupts, i2c, i2c_slave};
13use embedded_hal_1::i2c::Operation; 15use embedded_hal_1::i2c::Operation;
14use embedded_hal_async::i2c::I2c; 16use embedded_hal_async::i2c::I2c;
15use static_cell::StaticCell;
16use {defmt_rtt as _, panic_probe as _, panic_probe as _, panic_probe as _}; 17use {defmt_rtt as _, panic_probe as _, panic_probe as _, panic_probe as _};
17 18
18static mut CORE1_STACK: Stack<1024> = Stack::new();
19static EXECUTOR1: StaticCell<Executor> = StaticCell::new();
20
21use crate::i2c::AbortReason; 19use crate::i2c::AbortReason;
22 20
23bind_interrupts!(struct Irqs { 21bind_interrupts!(struct Irqs {
@@ -106,7 +104,7 @@ async fn device_task(mut dev: i2c_slave::I2cSlave<'static, I2C1>) -> ! {
106} 104}
107 105
108async fn controller_task(con: &mut i2c::I2c<'static, I2C0, i2c::Async>) { 106async fn controller_task(con: &mut i2c::I2c<'static, I2C0, i2c::Async>) {
109 info!("Device start"); 107 info!("Controller start");
110 108
111 { 109 {
112 let buf = [0xCA, 0x11]; 110 let buf = [0xCA, 0x11];
@@ -180,7 +178,7 @@ async fn controller_task(con: &mut i2c::I2c<'static, I2C0, i2c::Async>) {
180 } 178 }
181 179
182 #[embassy_executor::main] 180 #[embassy_executor::main]
183 async fn main(_core0_spawner: Spawner) { 181 async fn main(spawner: Spawner) {
184 let mut config = rpConfig::default(); 182 let mut config = rpConfig::default();
185 // Configure clk_sys to 48MHz to support 1kHz scl. 183 // Configure clk_sys to 48MHz to support 1kHz scl.
186 // In theory it can go lower, but we won't bother to test below 1kHz. 184 // 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>) {
210 config.addr = DEV_ADDR as u16; 208 config.addr = DEV_ADDR as u16;
211 let device = i2c_slave::I2cSlave::new(p.I2C1, d_sda, d_scl, Irqs, config); 209 let device = i2c_slave::I2cSlave::new(p.I2C1, d_sda, d_scl, Irqs, config);
212 210
213 spawn_core1( 211 spawner.must_spawn(device_task(device));
214 p.CORE1,
215 unsafe { &mut *core::ptr::addr_of_mut!(CORE1_STACK) },
216 move || {
217 let executor1 = EXECUTOR1.init(Executor::new());
218 executor1.run(|spawner| unwrap!(spawner.spawn(device_task(device))));
219 },
220 );
221 212
222 let c_sda = p.PIN_21; 213 let c_sda = p.PIN_21;
223 let c_scl = p.PIN_20; 214 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 @@
1#![no_std] 1#![no_std]
2#![no_main] 2#![no_main]
3#[cfg(feature = "rp2040")]
3teleprobe_meta::target!(b"rpi-pico"); 4teleprobe_meta::target!(b"rpi-pico");
5#[cfg(feature = "rp235xb")]
6teleprobe_meta::target!(b"pimoroni-pico-plus-2");
4 7
5use defmt::{info, unwrap}; 8use defmt::{info, unwrap};
6use embassy_executor::Executor; 9use 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 @@
1#![no_std] 1#![no_std]
2#![no_main] 2#![no_main]
3#[cfg(feature = "rp2040")]
3teleprobe_meta::target!(b"rpi-pico"); 4teleprobe_meta::target!(b"rpi-pico");
5#[cfg(feature = "rp235xb")]
6teleprobe_meta::target!(b"pimoroni-pico-plus-2");
4 7
5use defmt::info; 8use defmt::info;
6use embassy_executor::Spawner; 9use 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 @@
1#![no_std] 1#![no_std]
2#![no_main] 2#![no_main]
3#[cfg(feature = "rp2040")]
3teleprobe_meta::target!(b"rpi-pico"); 4teleprobe_meta::target!(b"rpi-pico");
5#[cfg(feature = "rp235xb")]
6teleprobe_meta::target!(b"pimoroni-pico-plus-2");
4 7
5use defmt::info; 8use defmt::info;
6use embassy_executor::Spawner; 9use 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 @@
1#![no_std] 1#![no_std]
2#![no_main] 2#![no_main]
3#[cfg(feature = "rp2040")]
3teleprobe_meta::target!(b"rpi-pico"); 4teleprobe_meta::target!(b"rpi-pico");
5#[cfg(feature = "rp235xb")]
6teleprobe_meta::target!(b"pimoroni-pico-plus-2");
4 7
5use defmt::{assert, assert_eq, assert_ne, *}; 8use defmt::{assert, assert_eq, assert_ne, *};
6use embassy_executor::Spawner; 9use embassy_executor::Spawner;
7use embassy_rp::gpio::{Input, Level, Output, Pull}; 10use embassy_rp::gpio::{Input, Pull};
11#[cfg(feature = "rp2040")]
12use embassy_rp::gpio::{Level, Output};
8use embassy_rp::pwm::{Config, InputMode, Pwm}; 13use embassy_rp::pwm::{Config, InputMode, Pwm};
9use embassy_time::Timer; 14use embassy_time::Timer;
10use {defmt_rtt as _, panic_probe as _}; 15use {defmt_rtt as _, panic_probe as _};
@@ -92,6 +97,7 @@ async fn main(_spawner: Spawner) {
92 } 97 }
93 98
94 // Test level-gated 99 // Test level-gated
100 #[cfg(feature = "rp2040")]
95 { 101 {
96 let mut pin2 = Output::new(&mut p11, Level::Low); 102 let mut pin2 = Output::new(&mut p11, Level::Low);
97 let pwm = Pwm::new_input(&mut p.PWM_SLICE3, &mut p7, Pull::None, InputMode::Level, cfg.clone()); 103 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) {
102 Timer::after_millis(1).await; 108 Timer::after_millis(1).await;
103 pin2.set_low(); 109 pin2.set_low();
104 let ctr = pwm.counter(); 110 let ctr = pwm.counter();
111 info!("ctr: {}", ctr);
105 assert!(ctr >= 1000); 112 assert!(ctr >= 1000);
106 Timer::after_millis(1).await; 113 Timer::after_millis(1).await;
107 assert_eq!(pwm.counter(), ctr); 114 assert_eq!(pwm.counter(), ctr);
108 } 115 }
109 116
110 // Test rising-gated 117 // Test rising-gated
118 #[cfg(feature = "rp2040")]
111 { 119 {
112 let mut pin2 = Output::new(&mut p11, Level::Low); 120 let mut pin2 = Output::new(&mut p11, Level::Low);
113 let pwm = Pwm::new_input( 121 let pwm = Pwm::new_input(
@@ -129,6 +137,7 @@ async fn main(_spawner: Spawner) {
129 } 137 }
130 138
131 // Test falling-gated 139 // Test falling-gated
140 #[cfg(feature = "rp2040")]
132 { 141 {
133 let mut pin2 = Output::new(&mut p11, Level::High); 142 let mut pin2 = Output::new(&mut p11, Level::High);
134 let pwm = Pwm::new_input( 143 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 @@
1#![no_std] 1#![no_std]
2#![no_main] 2#![no_main]
3#[cfg(feature = "rp2040")]
3teleprobe_meta::target!(b"rpi-pico"); 4teleprobe_meta::target!(b"rpi-pico");
5#[cfg(feature = "rp235xb")]
6teleprobe_meta::target!(b"pimoroni-pico-plus-2");
4 7
5use defmt::{assert_eq, *}; 8use defmt::{assert_eq, *};
6use embassy_executor::Spawner; 9use 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 @@
3//! 3//!
4#![no_std] 4#![no_std]
5#![no_main] 5#![no_main]
6#[cfg(feature = "rp2040")]
6teleprobe_meta::target!(b"rpi-pico"); 7teleprobe_meta::target!(b"rpi-pico");
8#[cfg(feature = "rp235xb")]
9teleprobe_meta::target!(b"pimoroni-pico-plus-2");
7 10
8use defmt::{assert_eq, *}; 11use defmt::{assert_eq, *};
9use embassy_executor::Spawner; 12use 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 @@
1#![no_std] 1#![no_std]
2#![no_main] 2#![no_main]
3#[cfg(feature = "rp2040")]
3teleprobe_meta::target!(b"rpi-pico"); 4teleprobe_meta::target!(b"rpi-pico");
5#[cfg(feature = "rp235xb")]
6teleprobe_meta::target!(b"pimoroni-pico-plus-2");
4 7
5use defmt::{assert, *}; 8use defmt::{assert, *};
6use embassy_executor::Spawner; 9use 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 @@
1#![no_std] 1#![no_std]
2#![no_main] 2#![no_main]
3#[cfg(feature = "rp2040")]
3teleprobe_meta::target!(b"rpi-pico"); 4teleprobe_meta::target!(b"rpi-pico");
5#[cfg(feature = "rp235xb")]
6teleprobe_meta::target!(b"pimoroni-pico-plus-2");
4 7
5use defmt::{assert_eq, *}; 8use defmt::{assert_eq, *};
6use embassy_executor::Spawner; 9use 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 @@
1#![no_std] 1#![no_std]
2#![no_main] 2#![no_main]
3#[cfg(feature = "rp2040")]
3teleprobe_meta::target!(b"rpi-pico"); 4teleprobe_meta::target!(b"rpi-pico");
5#[cfg(feature = "rp235xb")]
6teleprobe_meta::target!(b"pimoroni-pico-plus-2");
4 7
5use defmt::{assert_eq, panic, *}; 8use defmt::{assert_eq, panic, *};
6use embassy_executor::Spawner; 9use 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 @@
1#![no_std] 1#![no_std]
2#![no_main] 2#![no_main]
3#[cfg(feature = "rp2040")]
3teleprobe_meta::target!(b"rpi-pico"); 4teleprobe_meta::target!(b"rpi-pico");
5#[cfg(feature = "rp235xb")]
6teleprobe_meta::target!(b"pimoroni-pico-plus-2");
4 7
5use defmt::{assert_eq, *}; 8use defmt::{assert_eq, *};
6use embassy_executor::Spawner; 9use 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 @@
1#![no_std] 1#![no_std]
2#![no_main] 2#![no_main]
3#[cfg(feature = "rp2040")]
3teleprobe_meta::target!(b"rpi-pico"); 4teleprobe_meta::target!(b"rpi-pico");
5#[cfg(feature = "rp235xb")]
6teleprobe_meta::target!(b"pimoroni-pico-plus-2");
4 7
5use defmt::{assert_eq, *}; 8use defmt::{assert_eq, *};
6use embassy_executor::Spawner; 9use embassy_executor::Spawner;