Noob: rp2040 PAC- multicore and safety

Hello!
I'm new to rust, and have been trying to learn by doing a few little RP2040 projects, specifically PICO but want to expand eventually to my first (self made) PCB running a 2040.

In one of the rp-hal examples Multicore_fifo_blink.rs, I see that the PAC does not "support" multicore use. Is this something that can be fixed by creating a custom or new PAC that allocates memory to each core directly? Or is that function of dividing the given MCU ROM inherently unsafe within a PAC, or inherently unsafe on certain MCU?

I know my knowledge is limited but I would like to understand this aspect of the PAC a bit better. I have been looking through examples and the bookshelf, but I can't see anything that talks about multicore embedded use. So I was starting to wonder if dividing memory allocations just is a hard no no, or if that was specific to the rp2040.

Or I'm totally wrong about why it's unsafe... Please tell me!

Thanks

An excerpt from multicore fifo:

//! # Multicore FIFO + GPIO 'Blinky' Example
//! This application demonstrates FIFO communication between the CPU cores on the RP2040.
//! Core 0 will calculate and send a delay value to Core 1, which will then wait that long
//! before toggling the LED.
//! Core 0 will wait for Core 1 to complete this task and send an acknowledgement value.
//......................
fn core1_task() -> ! {

let mut pac = unsafe { pac::Peripherals::steal() };
let core = unsafe { pac::CorePeripherals::steal() };
let mut sio = Sio::new(pac.SIO);
let pins = hal::gpio::Pins::new(
pac.IO_BANK0,
pac.PADS_BANK0,
sio.gpio_bank0,
&mut pac.RESETS,

);

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.