esp-rs / esp-wifi-sys

Wi-Fi and BT drivers packaged for integration into bare-metal esp-wifi.
Apache License 2.0
401 stars 94 forks source link

esp-wifi 0.3.0 does not compile for ESP32-C3, it depends on portable-atomic, and that doesnt build for RiscV #426

Closed makepaddev closed 10 months ago

makepaddev commented 10 months ago

I can only build esp-wifi 0.1.1 for the ESP32-C3 (riscV), so this means i can't try the newer releases. The 0.1.1 version has significant problems on ESP32-C3 with wifi connectivity, UDP packets arrive super slowly or not at all. A quick check with the C++ stack on arduino IDE show its not a hardware issue as it works perfectly there.

Trying to compile with 0.3.0 gives this error:

error: cfg(portable_atomic_unsafe_assume_single_core) does not compatible with this target; if you need cfg(portable_atomic_unsafe_assume_single_core) support for this target, please submit an issue at https://github.com/taiki-e/portable-atomic --> /Users/admin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/portable-atomic-1.6.0/src/lib.rs:362:1 | 362 | / compile_error!( 363 | | "cfg(portable_atomic_unsafe_assume_single_core) does not compatible with this target;\n\ 364 | | if you need cfg(portable_atomic_unsafe_assume_singlecore) support for this target,\n\ 365 | | please submit an issue at https://github.com/taiki-e/portable-atomic" 366 | | ); | |^

makepaddev commented 10 months ago

I was able to fix the atomic error thanks to https://github.com/taiki-e/portable-atomic/issues/148, however no i get this when compiling esp-wifi 0.3.0

error[E0432]: unresolved import crate::hal::interrupt --> /Users/admin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/esp-wifi-0.3.0/src/preempt/preempt_riscv.rs:3:17 | 3 | use crate::hal::interrupt::TrapFrame; | ^^^^^^^^^ could not find interrupt in hal

error[E0432]: unresolved imports crate::hal::interrupt, crate::hal::macros::interrupt --> /Users/admin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/esp-wifi-0.3.0/src/timer/timer_esp32c3.rs:5:11 5 hal::{interrupt, macros::interrupt, peripherals::Interrupt}, ^^^^^^^^^ ^^^^^^^^^^^^^^^^^ no interrupt in the root
no interrupt in the root
bjoernQ commented 10 months ago

esp-wifi releases are tied to esp-hal releases - they need to match! e.g. for 0.3.0 the C3 hal is 0.15.0: https://crates.io/crates/esp-wifi/0.3.0/dependencies

additionally the way how atomics are handled in esp-hal changed at some point in time - for later HAL versions atomic emulation was removed so you need to remove this: https://github.com/makepaddev/rc_radio/blob/a04fd8eec7278f7d924d11488b25bf384c249050/.cargo/config.toml#L13-L27

MabezDev commented 10 months ago

That message about the esp32s3 is coming from ROM code, which is burned into flash at the factory - this means you have an esp32s3 board, not a esp32c3 board. Try flashing the example targetting the esp32s3.

makepaddev commented 10 months ago

Sorry im mistaken, i had an S3 board plugged in, nevermind.

makepaddev commented 10 months ago

Alright it works! I have a working example. Thanks. Closing.