lights0123 / async-avr

async/await for AVR with Rust
https://lights0123.com/blog/2020/07/25/async-await-for-avr-with-rust/
Apache License 2.0
33 stars 5 forks source link

Use interrupts for Wakers #3

Open lights0123 opened 4 years ago

lights0123 commented 4 years ago

This is currently blocked waiting for an LLVM bug to be fixed, but we can work on other things to get ready. They tried to fix it, but there were some problems with the patch.

Rahix commented 4 years ago

Maybe, for the time being, one could implement a 'custom waker API' that does not use any function pointers? E.g. a global singleton "waker object" that is used unconditionally in all contexts?

lights0123 commented 4 years ago

@Rahix Yeah, that's definitely possible. However, it will still introduce problems with third-party crates—things from the futures crate that work without alloc, for example.

jeremysalwen commented 2 years ago

Looks like the LLVM bug was fixed! https://reviews.llvm.org/D87631

lights0123 commented 2 years ago

@jeremysalwen I've taken a break from this (well, because of this issue), but if you'd like to follow along, it looks like someone else is working on an executor based on my work: https://www.reddit.com/r/rust/comments/rxmy9k/comment/hrkb7il/?utm_source=share&utm_medium=web2x&context=3

mfp20 commented 1 month ago

Any update on this? Triggering on IRQ is possible ( https://github.com/matthunz/async-hal ). I'm at my first project in Rust and I'm banging my head on your code to figure out how to use irqs instead of block_on(); well, "instead of" a blocking executor. The project I linked above looks a bit too heavy for AVR; it would be much better to mod your code instead.

lights0123 commented 1 month ago

embassy is the leading async framework for embedded, so I'd take a look at ThreadPender from a sample integration with it: https://github.com/niclashoyer/embassy/blob/avr/embassy-executor/src/arch/avr.rsIt's checked in the hot loop at the end. An interrupt can change that atomic variable to wake up the loop.On Aug 23, 2024, at 9:22 AM, mfp20 @.***> wrote: Any update on this? Triggering on IRQ is possible ( https://github.com/matthunz/async-hal ). I'm at my first project in Rust and I'm banging my head on your code to figure out how to use irqs instead of block_on(); well, "instead of" a blocking executor. The project I linked above looks a bit too heavy for AVR; it would be much better to mod your code instead.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

mfp20 commented 1 month ago

from embassy:

#[cfg(feature = "executor-interrupt")]
compile_error!("`executor-interrupt` is not supported with `arch-avr`.");

And in general, avr port isn't great in embassy.