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

Move binary logging to sys crate #2183

Merged
merged 11 commits into from
Sep 19, 2024
Merged

Conversation

MabezDev
Copy link
Member

@MabezDev MabezDev commented Sep 18, 2024

Thank you for your contribution!

We appreciate the time and effort you've put into this pull request.
To help us review it efficiently, please ensure you've gone through the following checklist:

Submission Checklist 📝

  • I have updated existing examples or added new ones (if applicable).
  • I have used cargo xtask fmt-packages command to ensure that all changed code is formatted correctly.
  • My changes were added to the CHANGELOG.md in the proper section.
  • I have added necessary changes to user code to the Migration Guide.
  • My changes are in accordance to the esp-rs API guidelines

Extra:

Pull Request Details 📖

Closes #1932

Depends on esp-rs/esp-wifi-sys#477

Moves the logging methods to the sys crate to avoid duplicate definitions. ieee driver now takes RADIO_CLK by value, so that only wifi or IEEE can be enabled at once. In the future we'll want to relax this to use Peripheral.

@MabezDev
Copy link
Member Author

I'm tempted to write a test case, but the test case would be empty as I'm only going to check that the two drivers can be linked together. Do we think this is worth while?


#[no_mangle]
extern "C" fn rtc_clk_xtal_freq_get() -> i32 {
0
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was definitely wrong, I hope it wasn't breaking something 😅

@MabezDev MabezDev force-pushed the bugfix/iee-wifi branch 2 times, most recently from 4fcc1d5 to e12cc18 Compare September 18, 2024 13:03
@MabezDev MabezDev marked this pull request as draft September 18, 2024 13:51
@bjoernQ
Copy link
Contributor

bjoernQ commented Sep 18, 2024

I'm tempted to write a test case, but the test case would be empty as I'm only going to check that the two drivers can be linked together. Do we think this is worth while?

I guess a test that just gets compiled and linked is nice - flashing a huge test which doesn't do anything is probably wasteful

// libphy.a can pull this in on some chips, we provide it here in the hal
// so that either ieee or esp-wifi's get it for free without duplicating in both
#[no_mangle]
extern "C" fn rtc_clk_xtal_freq_get() -> i32 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I wanted to do this (or something similar) for quite some time but always forgot about it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weeee, finally, we have real frequencies :D

@MabezDev MabezDev force-pushed the bugfix/iee-wifi branch 3 times, most recently from a4fa6f1 to 19c430b Compare September 18, 2024 19:07
esp-wifi/Cargo.toml Outdated Show resolved Hide resolved
@MabezDev MabezDev marked this pull request as ready for review September 18, 2024 19:49
@bjoernQ
Copy link
Contributor

bjoernQ commented Sep 19, 2024

We need to activate the log/defmt features in esp-wifi-sys (depending on the features of esp-wifi/esp-ieee802154)

esp-wifi/src/ble/npl.rs Outdated Show resolved Hide resolved
@MabezDev MabezDev force-pushed the bugfix/iee-wifi branch 2 times, most recently from 29cc06b to 78f5061 Compare September 19, 2024 13:41
@bjoernQ
Copy link
Contributor

bjoernQ commented Sep 19, 2024

There is one new warning while building

warning: creating a shared reference to mutable static is discouraged
   --> C:\projects\review\mabez\esp-hal\esp-ieee802154\src\fmt.rs:114:21
    |
114 |             let _ = ($( & $x ),*);
    |                     ^^^^^^^^^^^^^ shared reference to mutable static
    |
   ::: C:\projects\review\mabez\esp-hal\esp-ieee802154\src\raw.rs:385:13
    |
385 |             trace!("Received raw {:x?}", RX_BUFFER);
    |             --------------------------------------- in this macro invocation
    |
    = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
    = note: this will be a hard error in the 2024 edition
    = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
    = note: `#[warn(static_mut_refs)]` on by default
    = note: this warning originates in the macro `trace` (in Nightly builds, run with -Z macro-backtrace for more info)
help: use `addr_of!` instead to create a raw pointer
    |
114 |             let _ = addr_of!(RX_BUFFER);
    |                     ~~~~~~~~~~~~~~~~~~~

Copy link
Contributor

@bjoernQ bjoernQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Copy link
Member

@jessebraham jessebraham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@jessebraham jessebraham added this pull request to the merge queue Sep 19, 2024
Merged via the queue into esp-rs:main with commit ba63beb Sep 19, 2024
27 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

esp_wifi does not compile with esp_ieee802154 imported at the same time
4 participants