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

compile error #447

Closed goiw111 closed 8 months ago

goiw111 commented 8 months ago

hello guys can you help me to compile that for esp32 please

the code from esp-wifi repo

`#![no_std]

![no_main]

![feature(type_alias_impl_trait)]

use embassy_executor::Spawner; use embassy_net::tcp::TcpSocket; use embassy_net::{Config, Ipv4Address, Stack, StackResources}; use embassy_time::{Duration, Timer}; use espbacktrace as ; use esp_println::println; use esp_wifi::wifi::{ClientConfiguration, Configuration}; use esp_wifi::wifi::{WifiController, WifiDevice, WifiEvent, WifiStaDevice, WifiState}; use esp_wifi::{initialize, EspWifiInitFor}; use esp_hal::clock::ClockControl; use esp_hal::Rng; use esp_hal::{embassy, peripherals::Peripherals, prelude::*, timer::TimerGroup}; use static_cell::make_static;

const SSID: &str = env!("SSID"); const PASSWORD: &str = env!("PASSWORD");

[main]

async fn main(spawner: Spawner) -> ! {

[cfg(feature = "log")]

esp_println::logger::init_logger(log::LevelFilter::Info);

let peripherals = Peripherals::take();

let system = peripherals.SYSTEM.split();
let clocks = ClockControl::max(system.clock_control).freeze();

let timer = esp_hal::timer::TimerGroup::new(peripherals.TIMG1, &clocks).timer0;
let init = initialize(
    EspWifiInitFor::Wifi,
    timer,
    Rng::new(peripherals.RNG),
    system.radio_clock_control,
    &clocks,
)
.unwrap();

let wifi = peripherals.WIFI;
let (wifi_interface, controller) =
    esp_wifi::wifi::new_with_mode(&init, wifi, WifiStaDevice).unwrap();

let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks);
embassy::init(&clocks, timer_group0);

let config = Config::dhcpv4(Default::default());

let seed = 1234; // very random, very secure seed

// Init network stack
let stack = &*make_static!(Stack::new(
    wifi_interface,
    config,
    make_static!(StackResources::<3>::new()),
    seed
));

spawner.spawn(connection(controller)).ok();
spawner.spawn(net_task(&stack)).ok();

let mut rx_buffer = [0; 4096];
let mut tx_buffer = [0; 4096];

loop {
    if stack.is_link_up() {
        break;
    }
    Timer::after(Duration::from_millis(500)).await;
}

println!("Waiting to get IP address...");
loop {
    if let Some(config) = stack.config_v4() {
        println!("Got IP: {}", config.address);
        break;
    }
    Timer::after(Duration::from_millis(500)).await;
}

loop {
    Timer::after(Duration::from_millis(1_000)).await;

    let mut socket = TcpSocket::new(&stack, &mut rx_buffer, &mut tx_buffer);

    socket.set_timeout(Some(embassy_time::Duration::from_secs(10)));

    let remote_endpoint = (Ipv4Address::new(142, 250, 185, 115), 80);
    println!("connecting...");
    let r = socket.connect(remote_endpoint).await;
    if let Err(e) = r {
        println!("connect error: {:?}", e);
        continue;
    }
    println!("connected!");
    let mut buf = [0; 1024];
    loop {
        use embedded_io_async::Write;
        let r = socket
            .write_all(b"GET / HTTP/1.0\r\nHost: www.mobile-j.de\r\n\r\n")
            .await;
        if let Err(e) = r {
            println!("write error: {:?}", e);
            break;
        }
        let n = match socket.read(&mut buf).await {
            Ok(0) => {
                println!("read EOF");
                break;
            }
            Ok(n) => n,
            Err(e) => {
                println!("read error: {:?}", e);
                break;
            }
        };
        println!("{}", core::str::from_utf8(&buf[..n]).unwrap());
    }
    Timer::after(Duration::from_millis(3000)).await;
}

}

[embassy_executor::task]

async fn connection(mut controller: WifiController<'static>) { println!("start connection task"); println!("Device capabilities: {:?}", controller.get_capabilities()); loop { match esp_wifi::wifi::get_wifi_state() { WifiState::StaConnected => { // wait until we're no longer connected controller.wait_for_event(WifiEvent::StaDisconnected).await; Timer::after(Duration::frommillis(5000)).await } => {} } if !matches!(controller.is_started(), Ok(true)) { let client_config = Configuration::Client(ClientConfiguration { ssid: SSID.try_into().unwrap(), password: PASSWORD.try_into().unwrap(), ..Default::default() }); controller.set_configuration(&client_config).unwrap(); println!("Starting wifi"); controller.start().await.unwrap(); println!("Wifi started!"); } println!("About to connect...");

    match controller.connect().await {
        Ok(_) => println!("Wifi connected!"),
        Err(e) => {
            println!("Failed to connect to wifi: {e:?}");
            Timer::after(Duration::from_millis(5000)).await
        }
    }
}

}

[embassy_executor::task]

async fn net_task(stack: &'static Stack<WifiDevice<'static, WifiStaDevice>>) { stack.run().await } `

[cargo.toml]

[package] name = "dron-test" version = "0.1.0" authors = ["sohayl chahmot chahmot.s@gmail.com"] edition = "2021" license = "MIT OR Apache-2.0"

[dependencies] esp-backtrace = { version = "0.11.0", features = [ "esp32", "exception-handler", "panic-handler", "println", ] } esp-hal = { version = "0.16.1", features = [ "esp32","embassy","embassy-time-timg0","async","embassy-executor-thread"] } embassy-executor = { version = "0.5.0", features = ["task-arena-size-8192","nightly"] } embassy-net = { version = "0.4.0", features = ["tcp", "udp", "dhcpv4", "medium-ethernet"] } esp-wifi = { version = "0.4.0", features = [ "esp32","embassy-net","wifi"] } esp-println = { version = "0.9.0", features = ["esp32"] } embedded-hal-async = "1.0.0" static_cell = { version = "1.2.0", features = ["nightly"] } embassy-time = "0.3.0" embedded-io-async = { version = "0.6.0" } [profile.dev]

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

[the error]

sohayl@sohayl:~/projects/dron-test$ SSID= PASSWORD= cargo build Compiling dron-test v0.1.0 (/home/sohayl/projects/dron-test) error: linking withxtensa-esp32-elf-gccfailed: exit status: 1 | = note: LC_ALL="C" PATH="/home/sohayl/.rustup/toolchains/esp/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin:/home/sohayl/.local/bin:/opt/ros/iron/bin:/home/sohayl/.cargo/bin:/home/sohayl/.local/bin:/home/sohayl/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin" VSLANG="1033" "xtensa-esp32-elf-gcc" "/tmp/rustcqpT9pI/symbols.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.121k6xh2myrxopn1.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.14ez6ux453xe93a2.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.1eqcimsim9h5ikzd.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.1iymm2y6wabkzp4w.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.1neh3nuct2n6980k.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.1p8d6vmloso9hfqf.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.1z2fhs2vawznqnxn.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.21gtw5sppw8igbl5.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.2def1aoscj7nq49k.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.2fiy1nnupd72glly.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.2hw6ysc6x5twq87u.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.2lwwywcet0satbg4.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.2pjmxth131qg6vk0.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.2rtnw6bhnktbdlmm.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.2tri0npj0545qo87.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.2udo9zjci4bo94ww.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.2wvengdka5pgnizc.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.2y0w91mugzruonpn.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.31lc2w81vzfiug07.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.3476sqm7ja37yyk9.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.38igm3uq0s9tzgim.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.3f4duyeyen5ech61.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.3lol3smss7uuhyr9.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.3wves33mpkx11cps.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.40kok4cghr5w5a59.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.44ojboyzchgpvc7r.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.4c85o86b86svf69f.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.4iwts5hhm5ihgws4.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.4t26ymfrqx5k2jlm.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.4urbc76xe4qmszwg.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.57qv0jycgsvv48c.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.5dct3rh0ze766umb.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.5ea5km03tawupfnu.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.cderw6k3esxc5ub.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.cfh3dsb7ulgqha.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.euji5vamuw4dl2a.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.jwi1mdwoi39j26t.rcgu.o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5.wbli5as826tkvix.rcgu.o" "-Wl,--as-needed" "-L" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps" "-L" "/home/sohayl/projects/dron-test/target/debug/deps" "-L" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/build/esp-hal-763dedee56d535f6/out" "-L" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/build/esp32-221f67c3fea1df2f/out" "-L" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/build/xtensa-lx-77e18d112d0f7530/out" "-L" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/build/xtensa-lx-rt-572d22c5cf8e1d92/out" "-L" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/build/esp-wifi-sys-e279863c8ce60e84/out" "-L" "/home/sohayl/.rustup/toolchains/esp/lib/rustlib/xtensa-esp32-none-elf/lib" "-Wl,-Bstatic" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libstatic_cell-1c695b4a454b2a8d.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libesp_wifi-bf062f3024cedc7f.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/liblibm-fd0cbab7795dd96f.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/liblog-7f19a4e0a3e85fe1.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libportable_atomic_enum-71473ea956b1aa42.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libnum_traits-9c1016b9d5c36b5e.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libesp_wifi_sys-52443f407e725eb2.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/liblinked_list_allocator-5d2273777ee6440c.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libesp_hal-d1c50fd832963745.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/librand_core-0dd2e543fa3c0c3d.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libbitflags-3d9c91f8ef106b1e.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libbitfield-9fb4ab1ec227895d.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libesp32-4d9a5402d10bd372.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libvcell-1b5d443908f6d381.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libenumset-c2959416cd90dff1.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libembedded_can-b286ae5bd172f065.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libembedded_hal_nb-208a92447bb7c72e.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libstrum-2704801fa94abb6b.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libembedded_dma-9f456a924e147684.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libstable_deref_trait-435a7c710927c3bb.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libembassy_futures-0284c6965d26a9c3.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libcfg_if-65a98b170f14938c.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libfugit-aa8b5314975da651.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libgcd-a90599f139e266e6.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libxtensa_lx_rt-57569b3baa20e3db.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libr0-9c4350c46375c778.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libxtensa_lx-382a922b883c9644.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libspin-fd9dc71068187180.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/liblock_api-8a2dff058e0c3f1f.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libscopeguard-aaab04bf85baeb1e.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libmutex_trait-0b9522d55f644ace.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libbare_metal-941cf255c0524c38.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libesp_backtrace-f78cb32c17bd8a3a.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libesp_println-df407c9cc9707642.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libembassy_net-f63b4591d99c6097.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libfutures-6296d40e0b934891.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libembassy_sync-5883ac314e0bf94f.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libcritical_section-037974880421afe2.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libembedded_nal_async-b0f0ab77a78c5653.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libembedded_io_async-96250d017d10e5f3.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libembedded_io-f2113d647c47175c.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libembedded_nal-7769360f57e3edb5.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libno_std_net-186f5d46161a3b4d.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libembassy_time-4bd41a7f9e4811dd.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libembassy_time_queue_driver-83bfa669c50541b1.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libembedded_hal-6f15f026958ea847.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libvoid-ac2168672684b8f0.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libnb-a5de6cbd1a38d463.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libnb-83da312e4364157e.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libembedded_hal_async-2b971a04dde532bf.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libembedded_hal-b7627c63c512ed40.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libembassy_time_driver-140450941982c142.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libfutures_util-66bd8b4a0de6130a.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libpin_project_lite-73cb949774d796f3.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libfutures_sink-0b5169e6002782a7.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libfutures_task-786da91baf20dd3f.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libpin_utils-145d8269f6784379.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libfutures_core-4ea0215cad4d9246.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libsmoltcp-5a44e8ea1803082e.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libbitflags-f6b674a597c05869.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libheapless-af1395509cd00c37.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libportable_atomic-7b8cfdaab6f1c5ca.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libhash32-4d1f0e77c85622a3.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libbyteorder-98397f7eb83df805.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libmanaged-f616add89a028654.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libembassy_net_driver-c9e46cbee11fee0b.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libembassy_executor-bc2c83c6f0308b27.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/librustc_std_workspace_core-141a3b2b8ff35d0c.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libcore-9d23c98af6f709f1.rlib" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libcompiler_builtins-fc972e0252da836c.rlib" "-Wl,-Bdynamic" "-lbtdm_app" "-lcoexist" "-lcore" "-lespnow" "-lmesh" "-lnet80211" "-lphy" "-lpp" "-lrtc" "-lsmartconfig" "-lwapi" "-lwpa_supplicant" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/home/sohayl/.rustup/toolchains/esp/lib/rustlib/xtensa-esp32-none-elf/lib" "-o" "/home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/dron_test-a7f2616c21b786d5" "-Wl,--gc-sections" "-no-pie" "-nodefaultlibs" "-Tlinkall.x" "-nostartfiles" = note: /home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libesp_wifi-bf062f3024cedc7f.rlib(esp_wifi-bf062f3024cedc7f.esp_wifi.2d1bb79fc7c97ad0-cgu.01.rcgu.o):(.literal._ZN8esp_wifi4wifi10os_adapter8set_intr17hafc1d41d17cf79caE+0x8): undefined reference tointr_matrix_set' /home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libesp_wifi-bf062f3024cedc7f.rlib(esp_wifi-bf062f3024cedc7f.esp_wifi.2d1bb79fc7c97ad0-cgu.04.rcgu.o):(.literal.usleep+0x4): undefined reference to esp_rom_delay_us' /home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/deps/libembassy_time_queue_driver-83bfa669c50541b1.rlib(embassy_time_queue_driver-83bfa669c50541b1.embassy_time_queue_driver.9f4a9afc3ab8f445-cgu.0.rcgu.o):(.literal._ZN25embassy_time_queue_driver13schedule_wake17h3190abd102a5490fE+0x0): undefined reference to_embassy_time_schedule_wake' /home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/build/esp-wifi-sys-e279863c8ce60e84/out/libnet80211.a(ieee80211_ets.o):(.text.ieee80211_getmgtframe+0x0): undefined reference to roundup2' /home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/build/esp-wifi-sys-e279863c8ce60e84/out/libnet80211.a(ieee80211_ets.o): in functionieee80211_getmgtframe': (.text.ieee80211_getmgtframe+0xd): undefined reference to roundup2' /home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/build/esp-wifi-sys-e279863c8ce60e84/out/libnet80211.a(ieee80211_nvs.o):(.text.wifi_nvs_set+0x18): undefined reference tostrncpy' /home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/build/esp-wifi-sys-e279863c8ce60e84/out/libnet80211.a(ieee80211_nvs.o): in function wifi_nvs_set': (.text.wifi_nvs_set+0xf8): undefined reference tostrncpy' /home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/build/esp-wifi-sys-e279863c8ce60e84/out/libnet80211.a(ieee80211_output.o): in function ieee80211_amsdu_adjust_head': (.text.ieee80211_amsdu_adjust_head+0xd3): undefined reference toroundup2' /home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/build/esp-wifi-sys-e279863c8ce60e84/out/libnet80211.a(ieee80211_output.o): in function ieee80211_amsdu_adjust_last_length': (.text.ieee80211_amsdu_adjust_last_length+0xa): undefined reference toroundup2' /home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/build/esp-wifi-sys-e279863c8ce60e84/out/libnet80211.a(ieee80211_output.o): in function ieee80211_amsdu_length_check': (.text.ieee80211_amsdu_length_check+0xf): undefined reference toroundup2' /home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/build/esp-wifi-sys-e279863c8ce60e84/out/libnet80211.a(ieee80211_output.o):(.text.ieee80211_encap_amsdu+0x23): undefined reference to roundup2' /home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/build/esp-wifi-sys-e279863c8ce60e84/out/libnet80211.a(ieee80211_phy.o):(.text.ieee80211_phy_mode_show+0x1c): undefined reference tostrcpy' /home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/build/esp-wifi-sys-e279863c8ce60e84/out/libnet80211.a(ieee80211_phy.o): in function ieee80211_phy_mode_show': (.text.ieee80211_phy_mode_show+0x75): undefined reference tostrcpy' /home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/build/esp-wifi-sys-e279863c8ce60e84/out/libnet80211.a(ieee80211_scan.o):(.text.scan_prefer_chan+0x1c): undefined reference to strncmp' /home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/build/esp-wifi-sys-e279863c8ce60e84/out/libnet80211.a(ieee80211_scan.o):(.text.scan_prefer_chan+0x63): undefined reference tostrncmp' /home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/build/esp-wifi-sys-e279863c8ce60e84/out/libnet80211.a(ieee80211_scan.o): in function scan_prefer_chan': (.text.scan_prefer_chan+0xd9): undefined reference tostrncmp' /home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: (.text.scan_prefer_chan+0x181): undefined reference to strncmp' /home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/build/esp-wifi-sys-e279863c8ce60e84/out/libnet80211.a(ieee80211_scan.o): in functionscan_update_scan_history': (.text.scan_update_scan_history+0x7c): undefined reference to strncmp' /home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/build/esp-wifi-sys-e279863c8ce60e84/out/libnet80211.a(ieee80211_scan.o):(.text.unlikely.scan_add_ssid_do+0x6b): undefined reference tostrncpy' /home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/build/esp-wifi-sys-e279863c8ce60e84/out/libnet80211.a(ieee80211_scan.o): in function scan_parse_beacon': (.text.scan_parse_beacon+0x4fd): undefined reference tostrncmp' /home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: (.text.scan_parse_beacon+0x589): undefined reference to strncmp' /home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/build/esp-wifi-sys-e279863c8ce60e84/out/libphy.a(phy_chip_v7.o):(.text.phy_get_romfunc_addr+0xb4): undefined reference tophy_get_romfuncs' /home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/build/esp-wifi-sys-e279863c8ce60e84/out/libphy.a(phy_chip_v7.o):(.text.phy_get_romfunc_addr+0xbb): undefined reference to phy_get_romfuncs' /home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/build/esp-wifi-sys-e279863c8ce60e84/out/libpp.a(if_hwctrl.o):(.text.ic_set_vif+0x24): undefined reference topopcountsi2' /home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/build/esp-wifi-sys-e279863c8ce60e84/out/libpp.a(if_hwctrl.o): in function ic_set_vif': (.text.ic_set_vif+0xe5): undefined reference topopcountsi2' /home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: (.text.ic_set_vif+0x13b): undefined reference to __popcountsi2' /home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/build/esp-wifi-sys-e279863c8ce60e84/out/libpp.a(pp.o): in functionppCalTkipMic': (.text.ppCalTkipMic+0x2a): undefined reference to roundup2' /home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/build/esp-wifi-sys-e279863c8ce60e84/out/libpp.a(pp.o):(.wifi0iram.34+0x0): undefined reference toroundup2' /home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/build/esp-wifi-sys-e279863c8ce60e84/out/libpp.a(pp.o): in function ppCalSubFrameLength': (.wifi0iram.34+0x12): undefined reference toroundup2' /home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/build/esp-wifi-sys-e279863c8ce60e84/out/libpp.a(pp.o): in function ppCheckTxAMPDUlength': (.text.ppCheckTxAMPDUlength+0x14): undefined reference toroundup2' /home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/build/esp-wifi-sys-e279863c8ce60e84/out/libpp.a(wdev.o): in function wDev_IndicateAmpdu': (.wifirxiram.25+0x134): undefined reference toroundup2' /home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/build/esp-wifi-sys-e279863c8ce60e84/out/libpp.a(wdev.o):(.wifirxiram.25+0x207): more undefined references to roundup2' follow /home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/build/esp-wifi-sys-e279863c8ce60e84/out/libwpa_supplicant.a(common.c.obj):(.literal.wpa_get_ntp_timestamp+0x8): undefined reference tobswapsi2' /home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/sohayl/projects/dron-test/target/xtensa-esp32-none-elf/debug/build/esp-wifi-sys-e279863c8ce60e84/out/libwpa_supplicant.a(common.c.obj): in function wpa_get_ntp_timestamp': /home/bjoern/esp/esp-idf/components/wpa_supplicant/src/utils/common.c:140:(.text.wpa_get_ntp_timestamp+0x1f): undefined reference to__bswapsi2' /home/sohayl/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/bjoern/esp/esp-idf/components/wpa_supplicant/src/utils/common.c:141:(.text.wpa_get_ntp_timestamp+0x3d): undefined reference to `bswapsi2' collect2: error: ld returned 1 exit status

= note: some extern functions couldn't be found; some native libraries may need to be installed or have their path specified = note: use the -l flag to specify native libraries to link = note: use the cargo:rustc-link-lib directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)

error: could not compile dron-test (bin "dron-test") due to 1 previous error `

bjoernQ commented 8 months ago

Most likely you forgot to add the ROM functions linker script: https://github.com/esp-rs/esp-wifi/blob/main/esp-wifi/README.md#link-configuration

goiw111 commented 8 months ago

Most likely you forgot to add the ROM functions linker script: https://github.com/esp-rs/esp-wifi/blob/main/esp-wifi/README.md#link-configuration

thank you it's works

raulqtech commented 2 months ago

I'm having the same issue, but the provided link gives me a 404 response :/

Edit 1: I've found the link configuration at https://docs.rs/esp-wifi/latest/esp_wifi/

But I already had the link config. My config.toml looks like this:

[target.xtensa-esp32-none-elf]
runner = "espflash flash --monitor"

[env]
ESP_LOGLEVEL="INFO"

[build]
rustflags = [
  "-C", "link-arg=-nostartfiles",
  "-C", "link-arg=-Tlinkall.x",
  "-C", "link-arg=-Trom_functions.x",
]

target = "xtensa-esp32-none-elf"

[unstable]
build-std = ["core"]

Edit 2/ Solution: Ironically I already had it configured at my config.toml, and that's why it wasn't working. Because as it is said in the documentation: At the time of writing, you will already have the linkall flag if you used cargo generate.

Since I've used cargo generate, I got the error due to duplication of linkall. I had to erase the linker and it worked fine.

My rustflags ended up like this:

[build]
rustflags = [
  "-C", "link-arg=-nostartfiles",
]