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

Compilation failed, with the keyword ‘AtomicUsize‘. #1046

Closed
khsdfyd opened this issue Dec 20, 2023 · 5 comments
Closed

Compilation failed, with the keyword ‘AtomicUsize‘. #1046

khsdfyd opened this issue Dec 20, 2023 · 5 comments

Comments

@khsdfyd
Copy link

khsdfyd commented Dec 20, 2023

I set up a project and enabled the following features, but it cannot be compiled.
Cargo.toml

[dependencies]
hal = { git = "https://github.com/esp-rs/esp-hal.git", package = "esp32c3-hal", version = "0.14.0"}
esp-backtrace = { version = "0.9.0", features = ["esp32c3", "panic-handler", "exception-handler", "print-uart"] }
esp-println = { version = "0.7.0", features = ["esp32c3","log"] }
log = { version = "0.4.18" }
esp-alloc = { version = "0.3.0" }
esp-wifi  = { version = "0.1.1", features = ["esp32c3", "wifi", "ble", "esp-now"] }
smoltcp = { version = "0.10.0", default-features=false, features = ["proto-igmp", "proto-ipv4", "socket-tcp", "socket-icmp", "socket-udp", "medium-ethernet", "proto-dhcpv4", "socket-raw", "socket-dhcpv4"] }
embedded-svc = { version = "0.25.0", default-features = false, features = [] }
embedded-io = "0.4.0"
heapless = { version = "0.7.14", default-features = false }

embassy-executor = { version = "0.4.0", features = ["nightly", "integrated-timers", "arch-riscv32", "executor-thread"] }
embassy-time   = { version = "0.2.0", optional = true }
critical-section   = "1.1.2"
embassy-sync       = "0.4.0"
static_cell        = { version = "2.0.0", features = ["nightly"] }

[profile.dev.package.esp-wifi]
opt-level = 3

.cargo/config.toml

[target.riscv32imc-unknown-none-elf]
runner = "espflash flash --monitor"
rustflags = [
  "-C", "link-arg=-Tlinkall.x",
  "-C", "force-frame-pointers",
]
[env]
ESP_LOGLEVEL="INFO"
[build]
target = "riscv32imc-unknown-none-elf"
[unstable]
build-std = ["alloc", "core"]

src/main.rs

#![no_std]
#![no_main]

extern crate alloc;
use core::mem::MaybeUninit;
use esp_backtrace as _;
use esp_println::println;
use hal::{clock::ClockControl, peripherals::Peripherals, prelude::*, Delay};

use esp_wifi::{initialize, EspWifiInitFor, current_millis};
use esp_wifi::esp_now::{PeerInfo, BROADCAST_ADDRESS};

use hal::{systimer::SystemTimer, Rng};
#[global_allocator]
static ALLOCATOR: esp_alloc::EspHeap = esp_alloc::EspHeap::empty();

fn init_heap() {
    const HEAP_SIZE: usize = 32 * 1024;
    static mut HEAP: MaybeUninit<[u8; HEAP_SIZE]> = MaybeUninit::uninit();

    unsafe {
        ALLOCATOR.init(HEAP.as_mut_ptr() as *mut u8, HEAP_SIZE);
    }
}

#[entry]
fn main() -> ! {
    init_heap();
    let peripherals = Peripherals::take();
    let system = peripherals.SYSTEM.split();
    let clocks = ClockControl::max(system.clock_control).freeze();
    let mut delay = Delay::new(&clocks);
    
    // esp_println
    // setup logger
    // To change the log_level change the env section in .cargo/config.toml
    // or remove it and set ESP_LOGLEVEL manually before running cargo run
    // this requires a clean rebuild because of https://github.com/rust-lang/cargo/issues/10358
    esp_println::logger::init_logger(log::LevelFilter::Info);

    // esp_println::logger::init_logger_from_env();
    log::info!("Logger is setup");
    println!("Hello world!");
    let timer = SystemTimer::new(peripherals.SYSTIMER).alarm0;
    let init = initialize(
        EspWifiInitFor::Wifi,
        timer,
        Rng::new(peripherals.RNG),
        system.radio_clock_control,
        &clocks,
    )
    .unwrap();
    // esp_wifi::

    let wifi = peripherals.WIFI;
    let mut esp_now = esp_wifi::esp_now::EspNow::new(&init, wifi).unwrap();
    println!("esp-now version {}", esp_now.get_version().unwrap());

    let mut next_send_time = current_millis() + 5 * 1000;
    loop {
        let r = esp_now.receive();
        if let Some(r) = r {
            println!("Received {:?}", r);

            if r.info.dst_address == BROADCAST_ADDRESS {
                if !esp_now.peer_exists(&r.info.src_address) {
                    esp_now
                        .add_peer(PeerInfo {
                            peer_address: r.info.src_address,
                            lmk: None,
                            channel: None,
                            encrypt: false,
                        })
                        .unwrap();
                }
                let status = esp_now
                    .send(&r.info.src_address, b"Hello Peer")
                    .unwrap()
                    .wait();
                println!("Send hello to peer status: {:?}", status);
            }
        }

        if current_millis() >= next_send_time {
            next_send_time = current_millis() + 5 * 1000;
            println!("Send");
            let status = esp_now
                .send(&BROADCAST_ADDRESS, b"0123456789")
                .unwrap()
                .wait();
            println!("Send broadcast status: {:?}", status)
        }
    }
}

I tried this, but it was not successful.

@khsdfyd
Copy link
Author

khsdfyd commented Dec 20, 2023

This is the output

   Compiling futures-task v0.3.29
   Compiling futures-core v0.3.29
   Compiling embassy-time v0.2.0
   Compiling embedded-hal-async v1.0.0-rc.2
   Compiling darling v0.20.3
   Compiling basic-toml v0.1.7
   Compiling toml v0.5.11
   Compiling futures-util v0.3.29
   Compiling atomic-waker v1.1.2
   Compiling embedded-hal-nb v1.0.0-rc.2
   Compiling esp-wifi-sys v0.1.0
   Compiling num-traits v0.2.17
   Compiling esp-println v0.7.1
   Compiling libm v0.2.8
   Compiling num-derive v0.3.3
   Compiling atomic_enum v0.2.0
   Compiling embedded-io v0.4.0
   Compiling esp-alloc v0.3.0
error[E0599]: no method named `compare_exchange` found for struct `AtomicUsize` in the current scope
   --> C:\Users\khsdfyd\.cargo\registry\src\rsproxy.cn-0dccff568467c15b\atomic-waker-1.1.2\src\lib.rs:288:14
    |
286 |           match self
    |  _______________-
287 | |             .state
288 | |             .compare_exchange(WAITING, REGISTERING, Acquire, Acquire)
    | |             -^^^^^^^^^^^^^^^^ method not found in `AtomicUsize`
    | |_____________|
    |

error[E0599]: no method named `compare_exchange` found for struct `AtomicUsize` in the current scope
   --> C:\Users\khsdfyd\.cargo\registry\src\rsproxy.cn-0dccff568467c15b\atomic-waker-1.1.2\src\lib.rs:313:26
    |
311 |                       let res = self
    |  _______________________________-
312 | |                         .state
313 | |                         .compare_exchange(REGISTERING, WAITING, AcqRel, Acquire);
    | |                         -^^^^^^^^^^^^^^^^ method not found in `AtomicUsize`
    | |_________________________|
    |

error[E0599]: no method named `swap` found for struct `AtomicUsize` in the current scope
   --> C:\Users\khsdfyd\.cargo\registry\src\rsproxy.cn-0dccff568467c15b\atomic-waker-1.1.2\src\lib.rs:338:40
    |
338 | ...                   self.state.swap(WAITING, AcqRel);
    |                                  ^^^^ method not found in `AtomicUsize`

error[E0599]: no method named `fetch_or` found for struct `AtomicUsize` in the current scope
   --> C:\Users\khsdfyd\.cargo\registry\src\rsproxy.cn-0dccff568467c15b\atomic-waker-1.1.2\src\lib.rs:403:26
    |
403 |         match self.state.fetch_or(WAKING, AcqRel) {
    |                          ^^^^^^^^ method not found in `AtomicUsize`

error[E0599]: no method named `fetch_and` found for struct `AtomicUsize` in the current scope
   --> C:\Users\khsdfyd\.cargo\registry\src\rsproxy.cn-0dccff568467c15b\atomic-waker-1.1.2\src\lib.rs:409:28
    |
409 |                 self.state.fetch_and(!WAKING, Release);
    |                            ^^^^^^^^^ method not found in `AtomicUsize`

   Compiling enumset_derive v0.8.1
For more information about this error, try `rustc --explain E0599`.
error: could not compile `atomic-waker` (lib) due to 5 previous errors
warning: build failed, waiting for other jobs to finish...

@khsdfyd khsdfyd closed this as not planned Won't fix, can't repro, duplicate, stale Dec 20, 2023
@github-project-automation github-project-automation bot moved this from Todo to Done in esp-rs Dec 20, 2023
@khsdfyd khsdfyd reopened this Dec 20, 2023
@github-project-automation github-project-automation bot moved this from Done to In Progress in esp-rs Dec 20, 2023
@bjoernQ
Copy link
Contributor

bjoernQ commented Dec 20, 2023

Most probably your problems are caused by the fact that you are using esp-wifi 0.1.1 from crates.io and HAL 0.14 from git
Because there is a tight coupling between them you need to use matching versions of esp-wifi and esp-hal

In this case it's a bit of a problem since we haven't release esp-wifi 0.2.0 yet because some of our dependencies need to get published first ( esp-rs/esp-wifi-sys#388 )

You either need to use the current main of esp-wifi or use esp32c3-hal version 0.13.0

@khsdfyd
Copy link
Author

khsdfyd commented Dec 21, 2023

yes,I modified src/Cargo.toml and .cargo/config.toml, and updated the versions of esp-wifi and hal, but new issues have arisen. Please provide more specific information about the new problems, such as error messages or descriptions of abnormal behavior, so that I can better assist you in resolving them.
src/main.rs

[target.riscv32imc-unknown-none-elf]
runner = "espflash flash --monitor"
linker = "rust-lld.exe"
[env]
ESP_LOGLEVEL="INFO"
[build]
rustflags = [
  "-C", "link-arg=-Tlinkall.x",
  "-C", "link-arg=-Trom_functions.x",
  "-C", "force-frame-pointers",
  "-C", "target-feature=+a",
  "--cfg", "target_has_atomic_load_store",
  "--cfg", 'target_has_atomic_load_store="8"',
  "--cfg", 'target_has_atomic_load_store="16"',
  "--cfg", 'target_has_atomic_load_store="32"',
  "--cfg", 'target_has_atomic_load_store="ptr"',
  "--cfg", "target_has_atomic",
  "--cfg", 'target_has_atomic="8"',
  "--cfg", 'target_has_atomic="16"',
  "--cfg", 'target_has_atomic="32"',
  "--cfg", 'target_has_atomic="ptr"',
]
target = "riscv32imc-unknown-none-elf"
[unstable]
build-std = ["alloc", "core"]

src/Cargo.toml

[dependencies]
embassy-executor = { version = "0.3.0", features = ["nightly", "integrated-timers", "arch-riscv32", "executor-thread"] }
embassy-time   = { version = "0.1.3", optional = true , features = ["tick-hz-16_000_000", "nightly"]}
hal = { package = "esp32c3-hal", version = "0.13.0", features = ["embassy", "embassy-time-timg0", "async", "rt"]}
esp-backtrace = { version = "0.9.0", features = ["esp32c3", "panic-handler", "exception-handler", "print-uart"] }
esp-println = { version = "0.7.0", features = ["esp32c3","log"] }
log = { version = "0.4.18" }
esp-alloc = { version = "0.3.0" }
esp-wifi  = { version = "0.1.1", features = ["esp32c3", "wifi", "ble", "esp-now"] }
smoltcp = { version = "0.10.0", default-features=false, features = ["proto-igmp", "proto-ipv4", "socket-tcp", "socket-icmp", "socket-udp", "medium-ethernet", "proto-dhcpv4", "socket-raw", "socket-dhcpv4"] }
embedded-svc = { version = "0.25.0", default-features = false, features = [] }
embedded-io = "0.4.0"
heapless = { version = "0.7.14", default-features = false }
critical-section   = "1.1.2"
embassy-sync       = "0.4.0"
static_cell        = { version = "2.0.0", features = ["nightly"] }
embedded-io-async = { version = "0.6.1", features = ["alloc"] }

this is output

   Compiling core v0.0.0 (C:\Users\khsdfyd\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core)
   Compiling rustc-std-workspace-core v1.99.0 (C:\Users\khsdfyd\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\rustc-std-workspace-core)
   Compiling compiler_builtins v0.1.103
   Compiling alloc v0.0.0 (C:\Users\khsdfyd\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\alloc)
   Compiling critical-section v1.1.2
   Compiling byteorder v1.5.0
   Compiling stable_deref_trait v1.2.0
   Compiling nb v1.1.0
   Compiling futures-core v0.3.29
   Compiling cfg-if v1.0.0
   Compiling futures-task v0.3.29
   Compiling pin-utils v0.1.0
   Compiling void v1.0.2
   Compiling pin-project-lite v0.2.13
   Compiling embedded-hal v1.0.0-rc.1
   Compiling embedded-io v0.6.1
   Compiling bit_field v0.10.2
   Compiling log v0.4.20
   Compiling gcd v2.3.0
   Compiling atomic-polyfill v1.0.3
   Compiling nb v0.1.3
   Compiling vcell v0.1.3
   Compiling embedded-can v0.4.1
   Compiling embedded-dma v0.2.0
   Compiling atomic-waker v1.1.2
   Compiling strum v0.25.0
   Compiling embedded-hal v0.2.7
   Compiling futures-util v0.3.29
   Compiling embedded-io-async v0.6.1
   Compiling hash32 v0.2.1
   Compiling embedded-hal-async v1.0.0-rc.1
error[E0599]: no method named `compare_exchange` found for struct `AtomicUsize` in the current scope
   --> C:\Users\khsdfyd\.cargo\registry\src\rsproxy.cn-0dccff568467c15b\atomic-waker-1.1.2\src\lib.rs:288:14
    |
286 |           match self
    |  _______________-
287 | |             .state
288 | |             .compare_exchange(WAITING, REGISTERING, Acquire, Acquire)
    | |             -^^^^^^^^^^^^^^^^ method not found in `AtomicUsize`
    | |_____________|
    |

error[E0599]: no method named `compare_exchange` found for struct `AtomicUsize` in the current scope
   --> C:\Users\khsdfyd\.cargo\registry\src\rsproxy.cn-0dccff568467c15b\atomic-waker-1.1.2\src\lib.rs:313:26
    |
311 |                       let res = self
    |  _______________________________-
312 | |                         .state
313 | |                         .compare_exchange(REGISTERING, WAITING, AcqRel, Acquire);
    | |                         -^^^^^^^^^^^^^^^^ method not found in `AtomicUsize`
    | |_________________________|
    |

error[E0599]: no method named `swap` found for struct `AtomicUsize` in the current scope
   --> C:\Users\khsdfyd\.cargo\registry\src\rsproxy.cn-0dccff568467c15b\atomic-waker-1.1.2\src\lib.rs:338:40
    |
338 | ...                   self.state.swap(WAITING, AcqRel);
    |                                  ^^^^ method not found in `AtomicUsize`

error[E0599]: no method named `fetch_or` found for struct `AtomicUsize` in the current scope
   --> C:\Users\khsdfyd\.cargo\registry\src\rsproxy.cn-0dccff568467c15b\atomic-waker-1.1.2\src\lib.rs:403:26
    |
403 |         match self.state.fetch_or(WAKING, AcqRel) {
    |                          ^^^^^^^^ method not found in `AtomicUsize`

error[E0599]: no method named `fetch_and` found for struct `AtomicUsize` in the current scope
   --> C:\Users\khsdfyd\.cargo\registry\src\rsproxy.cn-0dccff568467c15b\atomic-waker-1.1.2\src\lib.rs:409:28
    |
409 |                 self.state.fetch_and(!WAKING, Release);
    |                            ^^^^^^^^^ method not found in `AtomicUsize`

For more information about this error, try `rustc --explain E0599`.
   Compiling embedded-hal-nb v1.0.0-rc.1
   Compiling esp32c3 v0.18.0
error: could not compile `atomic-waker` (lib) due to 5 previous errors
warning: build failed, waiting for other jobs to finish...
PS D:\Project\Rust\reyids> cargo build --release
   Compiling core v0.0.0 (C:\Users\khsdfyd\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core)
   Compiling rustc-std-workspace-core v1.99.0 (C:\Users\khsdfyd\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\rustc-std-workspace-core)
   Compiling compiler_builtins v0.1.103
   Compiling alloc v0.0.0 (C:\Users\khsdfyd\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\alloc)
   Compiling critical-section v1.1.2
   Compiling stable_deref_trait v1.2.0
   Compiling byteorder v1.5.0
   Compiling nb v1.1.0
   Compiling pin-utils v0.1.0
   Compiling void v1.0.2
   Compiling futures-task v0.3.29
   Compiling futures-core v0.3.29
   Compiling pin-project-lite v0.2.13
   Compiling cfg-if v1.0.0
   Compiling embedded-hal v1.0.0-rc.1
   Compiling bit_field v0.10.2
   Compiling log v0.4.20
   Compiling embedded-io v0.6.1
   Compiling vcell v0.1.3
   Compiling atomic-polyfill v1.0.3
   Compiling gcd v2.3.0
   Compiling nb v0.1.3
   Compiling embedded-can v0.4.1
   Compiling esp32c3 v0.18.0
   Compiling futures-util v0.3.29
   Compiling embedded-dma v0.2.0
   Compiling no-std-net v0.5.0
   Compiling embassy-futures v0.1.1
   Compiling embedded-hal v0.2.7
   Compiling embedded-io-async v0.6.1
   Compiling embedded-hal-async v1.0.0-rc.1
   Compiling embedded-hal-nb v1.0.0-rc.1
   Compiling fugit v0.3.7
   Compiling hash32 v0.2.1
   Compiling enumset v1.1.3
   Compiling strum v0.25.0
   Compiling riscv v0.10.1
   Compiling bitfield v0.14.0
   Compiling serde v1.0.193
   Compiling riscv-atomic-emulation-trap v0.4.1
   Compiling bitflags v2.4.1
   Compiling atomic-waker v1.1.2
   Compiling bitflags v1.3.2
   Compiling portable-atomic v1.6.0
   Compiling heapless v0.7.17
   Compiling linked_list_allocator v0.10.5
   Compiling managed v0.8.0
   Compiling esp-println v0.7.1
   Compiling esp-wifi-sys v0.1.0
   Compiling embedded-io v0.4.0
   Compiling num-traits v0.2.17
   Compiling libm v0.2.8
   Compiling esp-backtrace v0.9.0
   Compiling esp-alloc v0.3.0
   Compiling esp-riscv-rt v0.5.0
   Compiling static_cell v2.0.0
   Compiling smoltcp v0.10.0
   Compiling embassy-time v0.1.5
   Compiling embassy-sync v0.3.0
   Compiling embassy-sync v0.4.0
   Compiling embassy-executor v0.3.3
   Compiling embedded-svc v0.26.4
   Compiling embedded-svc v0.25.3
   Compiling esp-hal-common v0.13.1
   Compiling esp32c3-hal v0.13.0
   Compiling esp-wifi v0.1.1
   Compiling reyids v0.1.0 (D:\Project\Rust\reyids)
error: linking with `rust-lld.exe` failed: exit code: 1
  |
  = note: "rust-lld.exe" "-flavor" "gnu" "C:\\Users\\khsdfyd\\AppData\\Local\\Temp\\rustcep6hAM\\symbols.o" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\reyids-aad288976adc10f1.reyids.7010bf9253459859-cgu.0.rcgu.o" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\reyids-aad288976adc10f1.reyids.7010bf9253459859-cgu.1.rcgu.o" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\reyids-aad288976adc10f1.reyids.7010bf9253459859-cgu.2.rcgu.o" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\reyids-aad288976adc10f1.reyids.7010bf9253459859-cgu.3.rcgu.o" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\reyids-aad288976adc10f1.3cy8bvf6mnxwr98b.rcgu.o" "--as-needed" "-L" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps" "-L" "D:\\Project\\Rust\\reyids\\target\\release\\deps" "-L" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\build\\esp-wifi-sys-6077ae6e3630a230\\out" "-L" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\build\\esp32c3-hal-99ea65cda3aa3264\\out" "-L" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\build\\esp-hal-common-a02d1e4dde344a19\\out" "-L" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\build\\esp-riscv-rt-e8e06ef0ce84e508\\out" "-L" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\build\\esp32c3-29086c8b78f1a040\\out" "-L" "C:\\Users\\khsdfyd\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\riscv32imc-unknown-none-elf\\lib" "-Bstatic" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libesp_alloc-3d334fd836693af8.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\liblinked_list_allocator-ee3bb62853664a85.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libstatic_cell-ea67120710d93fe3.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libesp_backtrace-ffd77f9dede969bf.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libesp_println-782a8433f0cf4d55.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libesp32c3_hal-767a39b60a95a952.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libesp_hal_common-08256dbc8997fe0c.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libembedded_io_async-44a937de283e4315.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libembedded_io-9989af616b72c7f3.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libriscv_atomic_emulation_trap-2eb6a9b97cead5ac.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\liblog-57be0e73a03bd535.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libbitfield-b41b6f0d8cec9131.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libbitflags-33abdec665522018.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libesp32c3-2fe759b2f3162df1.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libvcell-b888ef0175ceb39a.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libembedded_can-fade9e61db560a80.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libembedded_hal_nb-769cbaf27e0bec27.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libstrum-99d1efc437912a52.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libembassy_futures-aeabd0ca37a549fb.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libcfg_if-a974a9f39f6540d6.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libembedded_hal_async-7b347ee26f0acd36.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libembassy_sync-58b78943a1526ac5.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libembedded_hal-95ef361acd97f236.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libfugit-058084d0522be3d1.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libgcd-e2f162b98c6a679b.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libembedded_dma-2172950f520446cd.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libesp_riscv_rt-b3603f2c34511b6b.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libriscv-9e466e6f17defdd9.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libbit_field-5511642420f855f7.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libembassy_sync-30d790612cec9e15.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libheapless-d3d397de49952217.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libstable_deref_trait-60c3f01213d9448b.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libatomic_polyfill-48b5b9223ca334d4.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libhash32-e645ba7228d92f3c.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libbyteorder-5eed7dfa477bdc34.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libembassy_executor-8c4d1ef5c87f7974.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libcritical_section-d29dd94844e2d1e7.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libembassy_time-0a42bc11ca4129ca.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libfutures_util-2635ed66142ab0aa.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libpin_project_lite-deb4b0cee9f5c782.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libfutures_task-890b1826e3cb3a36.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libpin_utils-f8157935e7ab9494.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libfutures_core-d709b870a0066428.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libembedded_hal-de80d6e065a9d17e.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libvoid-9cee23cab169217d.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libnb-d9493f944047abeb.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libnb-83720740a55a76b5.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libportable_atomic-d4589b360b985879.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\liballoc-79af9022e73a024a.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\librustc_std_workspace_core-bcc4db04ceb4d878.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libcore-066ffdf62623f1e1.rlib" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\libcompiler_builtins-367ee9ccca547a99.rlib" "-Bdynamic" "-z" "noexecstack" "-L" "C:\\Users\\khsdfyd\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\riscv32imc-unknown-none-elf\\lib" "-o" "D:\\Project\\Rust\\reyids\\target\\riscv32imc-unknown-none-elf\\release\\deps\\reyids-aad288976adc10f1" "--gc-sections" "-O1" "-Tlinkall.x" "-Trom_functions.x"
  = note: rust-lld: error: undefined symbol: __sync_val_compare_and_swap_4
          >>> referenced by reyids.7010bf9253459859-cgu.1
          >>>               D:\Project\Rust\reyids\target\riscv32imc-unknown-none-elf\release\deps\reyids-aad288976adc10f1.reyids.7010bf9253459859-cgu.1.rcgu.o:(embassy_executor::arch::thread::Executor::run::h31ee078ff859f9df)
          >>> referenced by embassy_executor.a5f14002e5b1c4cb-cgu.0
          >>>               embassy_executor-8c4d1ef5c87f7974.embassy_executor.a5f14002e5b1c4cb-cgu.0.rcgu.o:(embassy_executor::raw::waker::wake::h5e8f752086472ceb) in archive D:\Project\Rust\reyids\target\riscv32imc-unknown-none-elf\release\deps\libembassy_executor-8c4d1ef5c87f7974.rlib
          >>> referenced by embassy_executor.a5f14002e5b1c4cb-cgu.0
          >>>               embassy_executor-8c4d1ef5c87f7974.embassy_executor.a5f14002e5b1c4cb-cgu.0.rcgu.o:(embassy_executor::raw::waker::wake::h5e8f752086472ceb) in archive D:\Project\Rust\reyids\target\riscv32imc-unknown-none-elf\release\deps\libembassy_executor-8c4d1ef5c87f7974.rlib
          >>> referenced 5 more times

          rust-lld: error: undefined symbol: __sync_fetch_and_and_4
          >>> referenced by embassy_executor.a5f14002e5b1c4cb-cgu.0
          >>>               embassy_executor-8c4d1ef5c87f7974.embassy_executor.a5f14002e5b1c4cb-cgu.0.rcgu.o:(embassy_executor::raw::Executor::poll::h2eb74bc93813d107) in archive D:\Project\Rust\reyids\target\riscv32imc-unknown-none-elf\release\deps\libembassy_executor-8c4d1ef5c87f7974.rlib
          >>> referenced by embassy_executor.a5f14002e5b1c4cb-cgu.0
          >>>               embassy_executor-8c4d1ef5c87f7974.embassy_executor.a5f14002e5b1c4cb-cgu.0.rcgu.o:(embassy_executor::raw::Executor::poll::h2eb74bc93813d107) in archive D:\Project\Rust\reyids\target\riscv32imc-unknown-none-elf\release\deps\libembassy_executor-8c4d1ef5c87f7974.rlib
          >>> referenced by embassy_executor.a5f14002e5b1c4cb-cgu.0
          >>>               embassy_executor-8c4d1ef5c87f7974.embassy_executor.a5f14002e5b1c4cb-cgu.0.rcgu.o:(embassy_executor::raw::Executor::poll::h2eb74bc93813d107) in archive D:\Project\Rust\reyids\target\riscv32imc-unknown-none-elf\release\deps\libembassy_executor-8c4d1ef5c87f7974.rlib
          >>> referenced 1 more times

          rust-lld: error: undefined symbol: __sync_lock_test_and_set_4
          >>> referenced by embassy_executor.a5f14002e5b1c4cb-cgu.0
          >>>               embassy_executor-8c4d1ef5c87f7974.embassy_executor.a5f14002e5b1c4cb-cgu.0.rcgu.o:(embassy_executor::raw::Executor::poll::h2eb74bc93813d107) in archive D:\Project\Rust\reyids\target\riscv32imc-unknown-none-elf\release\deps\libembassy_executor-8c4d1ef5c87f7974.rlib

          rust-lld: error: undefined symbol: __sync_fetch_and_or_4
          >>> referenced by embassy_executor.a5f14002e5b1c4cb-cgu.0
          >>>               embassy_executor-8c4d1ef5c87f7974.embassy_executor.a5f14002e5b1c4cb-cgu.0.rcgu.o:(embassy_executor::raw::Executor::poll::h2eb74bc93813d107) in archive D:\Project\Rust\reyids\target\riscv32imc-unknown-none-elf\release\deps\libembassy_executor-8c4d1ef5c87f7974.rlib
          >>> referenced by reyids.7010bf9253459859-cgu.0
          >>>               D:\Project\Rust\reyids\target\riscv32imc-unknown-none-elf\release\deps\reyids-aad288976adc10f1.reyids.7010bf9253459859-cgu.0.rcgu.o:(embassy_executor::raw::TaskStorage$LT$F$GT$::poll::h764ee98ba7227e52 (.llvm.17310760701440962987))


error: could not compile `reyids` (bin "reyids") due to 1 previous error

@khsdfyd khsdfyd closed this as completed Dec 21, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in esp-rs Dec 21, 2023
@khsdfyd khsdfyd reopened this Dec 21, 2023
@github-project-automation github-project-automation bot moved this from Done to In Progress in esp-rs Dec 21, 2023
@bjoernQ
Copy link
Contributor

bjoernQ commented Dec 21, 2023

There are still a few dependencies which don't match

Have a look here: https://github.com/bjoernQ/esp32c3-ble-hid/blob/main/Cargo.toml

e.g. static_cell need to be pinned to "=1.2.0"

Also make sure to do a cargo clean,cargo update after changing the dependencies

@khsdfyd
Copy link
Author

khsdfyd commented Dec 22, 2023

Thanks to your invaluable assistance and guidance, I have been able to successfully resolve the issues I was facing.
This my config
src/.cargo/config.toml

[target.riscv32imc-unknown-none-elf]
runner = "espflash flash --monitor"
[env]
ESP_LOGLEVEL="INFO"
[build]
rustflags = [
  "-C", "link-arg=-Tlinkall.x",
  "-C", "link-arg=-Trom_functions.x",
  "-C", "force-frame-pointers",
  "-C", "target-feature=+a",
  "--cfg", "target_has_atomic_load_store",
  "--cfg", 'target_has_atomic_load_store="8"',
  "--cfg", 'target_has_atomic_load_store="16"',
  "--cfg", 'target_has_atomic_load_store="32"',
  "--cfg", 'target_has_atomic_load_store="ptr"',
  "--cfg", "target_has_atomic",
  "--cfg", 'target_has_atomic="8"',
  "--cfg", 'target_has_atomic="16"',
  "--cfg", 'target_has_atomic="32"',
  "--cfg", 'target_has_atomic="ptr"',
]
target = "riscv32imc-unknown-none-elf"
[unstable]
build-std = ["alloc", "core"]

src/Cargo.toml

[dependencies]
embassy-executor = { version = "=0.3.2", features = [
    "nightly",
    "executor-thread",
    "integrated-timers",
    "arch-riscv32",
] }
embassy-time   = { version = "0.1.3", optional = true , features = ["tick-hz-16_000_000", "nightly"]}
hal = { package = "esp32c3-hal", version = "0.13.0", features = ["embassy", "embassy-time-timg0", "async", "rt"]}
esp-backtrace = { version = "0.9.0", features = ["esp32c3", "panic-handler", "exception-handler", "print-uart"] }
esp-println = { version = "0.7.0", features = ["esp32c3","log"] }
log = { version = "0.4.18" }
esp-alloc = { version = "0.3.0" }
esp-wifi  = { version = "0.1.1", features = ["esp32c3", "wifi", "ble", "esp-now"] }
smoltcp = { version = "0.10.0", default-features=false, features = ["proto-igmp", "proto-ipv4", "socket-tcp", "socket-icmp", "socket-udp", "medium-ethernet", "proto-dhcpv4", "socket-raw", "socket-dhcpv4"] }
embedded-svc = { version = "0.25.0", default-features = false, features = [] }
embedded-io = "0.4.0"
heapless = { version = "0.7.14", default-features = false }
critical-section   = "1.1.2"
embassy-sync       = "0.4.0"
static_cell = { version = "=1.2.0", features = ["nightly"] }
embedded-io-async = { version = "0.6.1", features = ["alloc"] }
[profile.dev.package.esp-wifi]
opt-level = 3

@khsdfyd khsdfyd closed this as completed Dec 22, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in esp-rs Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants