Sorry, I have a different question elsewhere, where I was writing a small novel
.
Issues are somewhat related, but what I'm doing here is spawning off one of the tasks that's going to require as much time to run as possible.
It's not at all memory or CPU intensive (I haven't actually started that one yet, but it's next on the list), I just can't risk losing a message. It's not 101% real-time, but I think the closer I get, the better for the rest of the apps..
// 5. Initialize the CAN bus. Needs to come third, so we can talk to the IC.
spawn_core1(
p.CORE1,
unsafe { &mut *core::ptr::addr_of_mut!(CORE1_STACK) },
move || {
let executor1 = EXECUTOR1.init(Executor::new());
executor1.run(|spawner| {
spawner.spawn(unwrap!(read_can()))
})
}
);
Then a few lines further down, I want another task on CORE1 - I paid £5 for the darn device, I should be able to utilize it fully!!
:
// Actuator works. Spawn off the actuator control task.
spawn_core1(
p.CORE1,
unsafe { &mut *core::ptr::addr_of_mut!(CORE1_STACK) },
move || {
let executor0 = EXECUTOR0.init(Executor::new());
executor0.run(|spawner| {
spawner.spawn(unwrap!(actuator_control(
CHANNEL_ACTUATOR.receiver(),
flash,
actuator
)))
});
},
);
That's when I hit that error. How DO you run multiple tasks on CORE1?
Is "it" (Embassy I guess, which is my framework of choice) smart enough to understand that if I spawn a "main" task/process (not main(), but a "main for CORE1") on CORE1, then spawn off more tasks from that, that those would then run on the same core as the "main" task?
For example, I spawn off a total of 12 (!) tasks in total (two of those above) from main(). So in my main(), in addition to those two above, I also use:
spawner.spawn(unwrap!(feed_watchdog(
CHANNEL_WATCHDOG.receiver(),
watchdog
)));
[...]
spawner.spawn(unwrap!(write_can(CHANNEL_CANWRITE.receiver())));
Etcetera. They all now (except read_can() which I was successful to spawn off on CORE1) run on CORE0. But it would be nice if I could split them up on the core "half-evenly" to utilize the hardware as much as possible.