Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ESP-IDF framework (esp32 family of hardware devices with std support) #5867

Closed
6 tasks done
jasta opened this issue Jul 14, 2023 · 3 comments
Closed
6 tasks done
Labels
A-tokio Area: The main tokio crate C-feature-request Category: A feature request.

Comments

@jasta
Copy link
Contributor

jasta commented Jul 14, 2023

Is your feature request related to a problem? Please describe.
ESP32 family of devices (e.g. ESP32C3) can work with tokio but requires patches to socket2, mio, and tokio itself.

Describe the solution you'd like
Generally, fix build errors in socket2 and tokio due to missing functionality, then merge in poll support to mio. This list tracks the dependencies:

Describe alternatives you've considered
The esp community currently is favoring smol/async-io but still has to maintain non-upstream patches. An alternative would be to continue on this path, however I prefer adding tokio support directly for two reasons:

  1. It allows libraries built against tokio features="net" to still interop (right now they theoretically can but since they don't compile it's a non-starter).
  2. tokio has more community support with great tools like tokio console.
@jasta jasta added A-tokio Area: The main tokio crate C-feature-request Category: A feature request. labels Jul 14, 2023
@jasta
Copy link
Contributor Author

jasta commented Jul 18, 2023

All PRs are submitted now. Just waiting on reviews...

@jasta
Copy link
Contributor Author

jasta commented Jul 31, 2023

Woohoo! Fully merged, latest tokio master branch should support the ESP32 family but with a quirk that you'll need to modify .cargo/config.toml:

[target.riscv32imc-esp-espidf]
rustflags = ["--cfg", "mio_unsupported_force_poll_poll"]

And to patch Cargo.toml you'll need:

[patch.crates-io]
mio = { git = "https://github.com/tokio-rs/mio", branch = "master" }
socket2 = { git = "https://github.com/rust-lang/socket2", branch = "master" }
tokio = { git = "https://github.com/tokio-rs/tokio", branch = "master" }

EDIT: I'm working on a bare bones github repo that shows this all working

@jasta jasta closed this as completed Jul 31, 2023
@jasta
Copy link
Contributor Author

jasta commented Aug 2, 2023

Added a demo repo to show it all in action: https://github.com/jasta/esp32-tokio-demo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate C-feature-request Category: A feature request.
Projects
None yet
Development

No branches or pull requests

1 participant