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

esp_wifi does not compile with esp_ieee802154 imported at the same time #1932

Closed
turulix opened this issue Aug 13, 2024 · 5 comments · Fixed by #2183
Closed

esp_wifi does not compile with esp_ieee802154 imported at the same time #1932

turulix opened this issue Aug 13, 2024 · 5 comments · Fixed by #2183
Assignees
Labels
chip:esp32c6 Issue related to ESP32-C6 chip package:esp-ieee802154 Issues related to the esp-ieee802154 package package:esp-wifi Issues related to the esp-wifi package
Milestone

Comments

@turulix
Copy link

turulix commented Aug 13, 2024

Hey im trying to use both WIFI and IEEE802154 at the same time on my ESP32C6.

#[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() -> ! {
    let mut peripherals = Peripherals::take();
    let system = SystemControl::new(peripherals.SYSTEM);
    init_heap();
    esp_println::logger::init_logger_from_env();

    let clocks = ClockControl::max(system.clock_control).freeze();
    let rng = Rng::new(peripherals.RNG);
    let timer = TimerGroup::new(peripherals.TIMG0, &clocks, None);
    let timer: ErasedTimer = timer.timer0.into();
    let timer = PeriodicTimer::new(timer);

    let mut ieee802154 = esp_ieee802154::Ieee802154::new(peripherals.IEEE802154, &mut peripherals.RADIO_CLK);
    let init = esp_wifi::initialize(
        EspWifiInitFor::Wifi,
        timer,
        rng.clone(),
        peripherals.RADIO_CLK,
        &clocks,
    ).unwrap();

    loop {}
}

Commenting out either the esp_wifi part or ieee802154 part and removing all imports associated with them works fine. But compiling with both in place results in an error: failed to load bitcode of module "esp_wifi-715e490f8c6e0fb1.esp_wifi.abe10e676f975f83-cgu.0.rcgu.o": error

@bjoernQ
Copy link
Contributor

bjoernQ commented Aug 13, 2024

WiFi and 802.15.4 co-existence is not supported - while it is on esp-idf even there it's not recommended (e.g. that's why the ESP Thread Border Router is ESP32-S3 plus ESP32-H2)

However, both should be useable (but not at the same time) - e.g. for Matter commissioning via BLE and then using Thread

@bjoernQ bjoernQ added package:esp-ieee802154 Issues related to the esp-ieee802154 package package:esp-wifi Issues related to the esp-wifi package labels Aug 13, 2024
@tom-borcin tom-borcin added the chip:esp32c6 Issue related to ESP32-C6 chip label Aug 14, 2024
@MabezDev
Copy link
Member

@bjoernQ should the 802154 driver take RADIO_CLK too/instead to ensure this then?

@bjoernQ
Copy link
Contributor

bjoernQ commented Sep 16, 2024

@bjoernQ should the 802154 driver take RADIO_CLK too/instead to ensure this then?

That's probably a good idea 👍

@MabezDev MabezDev added this to the 0.21.0 milestone Sep 17, 2024
@MabezDev MabezDev self-assigned this Sep 17, 2024
@MabezDev
Copy link
Member

So the linker problem here is that both esp-wifi and IEEE, define things like rtc_printf etc. @bjoernQ I think we can just move these to esp-wifi-sys which both crates depend on?

@bjoernQ
Copy link
Contributor

bjoernQ commented Sep 18, 2024

Mhhh both drivers take RADIO_CLK already so it shouldn't be possible to even get to the linking stage

So the linker problem here is that both esp-wifi and IEEE, define things like rtc_printf etc. @bjoernQ I think we can just move these to esp-wifi-sys which both crates depend on?

Independently of this issue that is probably fine since we already provide implementations of printf and friends there - maybe also the syslog function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chip:esp32c6 Issue related to ESP32-C6 chip package:esp-ieee802154 Issues related to the esp-ieee802154 package package:esp-wifi Issues related to the esp-wifi package
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants