Hi All,
I am configuring a project so that it can be compiled for different targets (e.g. ESP32 or ESP32C3) and encountering compile error. Please help! Thank you.
The Cargo.toml
file is:
[dependencies]
esp-backtrace = { version = "0.13.0", features = ["exception-handler", "panic-handler", "println"] }
esp-hal = { version = "0.19.0", features=["embedded-hal-02"] }
esp-println = { version = "0.10.0", features = ["log"] }
log = { version = "0.4.21" }
[features]
esp32 = ["esp-backtrace/esp32", "esp-hal/esp32", "esp-println/esp32"]
esp32c3 = ["esp-backtrace/esp32c3", "esp-hal/esp32c3", "esp-println/esp32c3"]
[profile.dev]
# Rust debug is too slow.
# For debug builds always builds with some optimization
opt-level = "s"
[profile.release]
codegen-units = 1 # LLVM can perform better optimizations using a single thread
debug = 2
debug-assertions = false
incremental = false
lto = 'fat'
opt-level = 's'
overflow-checks = false
Unfortunately, I while I can build successfully with ESP32 with:
cargo build --release --features=esp32
But can't build for ESP32C3 with:
cargo build --release --features=esp32c3
There error log is lengthy likes below although I just compile a Helloworld bin:
Compiling syn v2.0.77
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>
--> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/portable-atomic-1.7.0/src/lib.rs:352:1
|
352 | / compile_error!(
353 | | "cfg(portable_atomic_unsafe_assume_single_core) does not compatible with this target;\n\
354 | | if you need cfg(portable_atomic_unsafe_assume_single_core) support for this target,\n\
355 | | please submit an issue at <https://github.com/taiki-e/portable-atomic>"
356 | | );
| |_^
error[E0432]: unresolved import `super::core_atomic`
--> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/portable-atomic-1.7.0/src/imp/x86.rs:19:12
|
19 | use super::core_atomic::{
| ^^^^^^^^^^^ could not find `core_atomic` in `super`
|
note: found an item that was configured out
--> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/portable-atomic-1.7.0/src/imp/mod.rs:29:5
|
29 | mod core_atomic;
| ^^^^^^^^^^^
error[E0433]: failed to resolve: could not find `AtomicU8` in `imp`
--> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/portable-atomic-1.7.0/src/lib.rs:640:14
|
640 | imp::AtomicU8::is_lock_free()
| ^^^^^^^^ could not find `AtomicU8` in `imp`
...