You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, I was confused when I realized that I was able to use the embassy timer even without calling the init method. To further my confusion, I found this in the hal code:
I am not knowledgeable on the safety of this, but from my inexperienced perspective, this implies that esp-hal is lying to me about the peripherals its using. Instead of passing the alarm peripherals explicitly into the embassy::init() method, they are being manufactured into existance via the dark arts of unsafe.
My question is: Is the current implementation unsound? Can I use alarm0 in esp-wifi or something else that needs the alarm? Is this leaving me vulnerable to race conditions (not just data races!) in the state of the peripheral?
The text was updated successfully, but these errors were encountered:
TheButlah
changed the title
embassy feature appears to be unsound
embassy time driver appears to be unsound
Nov 20, 2022
- Rename timg feature to timg0 to better refect which TG is being used
- Use the time_driver::TimerType in the signature of init to fix#268
- Update examples
- Fix CI features
- Add timg0 cfg to build.rs
- Rename timg feature to timg0 to better refect which TG is being used
- Use the time_driver::TimerType in the signature of init to fix#268
- Update examples
- Fix CI features
- Add timg0 cfg to build.rs
I was attempting to use
esp-wifi
along withesp32c3-hal
and was worried that esp wifi might need peripherals used by the embassy time driver.To my pleasant surprise, I saw that initializing embassy appears to not need any ownership over the peripheral:
esp-hal/esp32c3-hal/examples/embassy_hello_world.rs
Line 41 in 096ff34
However, I was confused when I realized that I was able to use the embassy timer even without calling the init method. To further my confusion, I found this in the hal code:
esp-hal/esp-hal-common/src/embassy/time_driver_systimer.rs
Lines 21 to 26 in 096ff34
I am not knowledgeable on the safety of this, but from my inexperienced perspective, this implies that
esp-hal
is lying to me about the peripherals its using. Instead of passing the alarm peripherals explicitly into theembassy::init()
method, they are being manufactured into existance via the dark arts of unsafe.My question is: Is the current implementation unsound? Can I use
alarm0
inesp-wifi
or something else that needs the alarm? Is this leaving me vulnerable to race conditions (not just data races!) in the state of the peripheral?The text was updated successfully, but these errors were encountered: