I have read that the RP2040 has two cores. How can I use the second core in a Rust program?
I do not need to go all the way to generic multithreading, I just want to have two threads, each of which owns one of the cores, and they can communicate with each other.
The Rust book's section about Fearless Concurrency (suggested by Jeremy) is not much help.
thread::spawn(|| {
let mut x = 0;
x = x + 1;
});
fails to compile
error[E0433]: failed to resolve: use of undeclared crate or module `thread`
--> src/main.rs:108:5
|
108 | thread::spawn(|| {
| ^^^^^^ use of undeclared crate or module `thread`
which is hardly surprising given that thread is part of std and the RP2040 is a #![no_std] environment.
In the C API there is a function multicore_launch_core1. Is there an equivalent Rust API?