Module rp2040_hal::multicore
source · Expand description
Multicore support
This module handles setup of the 2nd cpu core on the rp2040, which we refer to as core1. It provides functionality for setting up the stack, and starting core1.
The entrypoint for core1 can be any function that never returns, including closures.
§Usage
use rp2040_hal::{pac, gpio::Pins, sio::Sio, multicore::{Multicore, Stack}};
static mut CORE1_STACK: Stack<4096> = Stack::new();
fn core1_task() {
loop {}
}
fn main() -> ! {
let mut pac = pac::Peripherals::take().unwrap();
let mut sio = Sio::new(pac.SIO);
// Other init code above this line
let mut mc = Multicore::new(&mut pac.PSM, &mut pac.PPB, &mut sio.fifo);
let cores = mc.cores();
let core1 = &mut cores[1];
let _test = core1.spawn(unsafe { &mut CORE1_STACK.mem }, core1_task);
// The rest of your application below this line
}
For inter-processor communications, see crate::sio::SioFifo
and crate::sio::Spinlock0
For a detailed example, see examples/multicore_fifo_blink.rs
Structs§
- A handle for controlling a logical core.
- Multicore execution management.
- Data type for a properly aligned stack of N 32-bit (usize) words
Enums§
- Errors for multicore operations.