embassy/tests/rp/src/bin/multicore.rs
Caleb Jamison 9e785438ee
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.
2025-02-18 10:32:20 -05:00

55 lines
1.6 KiB
Rust

#![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;
use embassy_rp::multicore::{spawn_core1, Stack};
use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
use embassy_sync::channel::Channel;
use static_cell::StaticCell;
use {defmt_rtt as _, panic_probe as _};
static mut CORE1_STACK: Stack<1024> = Stack::new();
static EXECUTOR0: StaticCell<Executor> = StaticCell::new();
static EXECUTOR1: StaticCell<Executor> = StaticCell::new();
static CHANNEL0: Channel<CriticalSectionRawMutex, bool, 1> = Channel::new();
static CHANNEL1: Channel<CriticalSectionRawMutex, bool, 1> = Channel::new();
#[cortex_m_rt::entry]
fn main() -> ! {
let p = embassy_rp::init(Default::default());
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(core1_task())));
},
);
let executor0 = EXECUTOR0.init(Executor::new());
executor0.run(|spawner| unwrap!(spawner.spawn(core0_task())));
}
#[embassy_executor::task]
async fn core0_task() {
info!("CORE0 is running");
let ping = true;
CHANNEL0.send(ping).await;
let pong = CHANNEL1.receive().await;
assert_eq!(ping, pong);
info!("Test OK");
cortex_m::asm::bkpt();
}
#[embassy_executor::task]
async fn core1_task() {
info!("CORE1 is running");
let ping = CHANNEL0.receive().await;
CHANNEL1.send(ping).await;
}