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

critical_section implementations #87

Closed
3 tasks done
MabezDev opened this issue Jun 20, 2022 · 5 comments · Fixed by #151
Closed
3 tasks done

critical_section implementations #87

MabezDev opened this issue Jun 20, 2022 · 5 comments · Fixed by #151
Assignees

Comments

@MabezDev
Copy link
Member

MabezDev commented Jun 20, 2022

With the upcoming release of critical-section, default implementations for each arch are being removed. Instead, they should be implemented by the HALs/PAC on a per chip basis. This allows critical sections to be correctly implemented for dual-core chips, and or take advantage of hardware semaphores instead of spin locking.

A note on Xtensa implementations, we should not be disabling interrupts for our critical sections, this means the waiti instruction will never return. Instead, we should be raising the PS.INTLEVEL accordingly. See esp-rs/xtensa-lx#20.

The new release isn't out yet, but we should track the implementations we'll need here.

  • Multicore aware Xtensa cs - esp32, esp32s3
  • RISCV32 single core cs - esp32c3
  • Xtensa single core cs - esp32s2
@jrmoulton
Copy link
Contributor

I'm working on the SpiDevice trait but it seems like before anything is workable there is work that needs to be done for the 1.0 release of critical-section and its implementation here, correct?

@MabezDev
Copy link
Member Author

You can use the Mutex's inside https://github.com/esp-rs/xtensa-lx/blob/master/src/mutex.rs for now, we can swap them out with critical_section implementations if that makes sense later down the line :).

@MabezDev
Copy link
Member Author

I've just abandoned #90. We are semi-blocked on both critical_section 1.0 for configurable token sizes & and bare_metal minor release with Refcell convenience functions. Without either of these, we are probably better off using the xtensa_lx::mutex stuff for now, unless we really need it for something.

@jessebraham
Copy link
Member

critical-section 1.0.0 has been released, so I suppose the only remaining blocker on this is a new bare-metal release.

@MabezDev
Copy link
Member Author

I believe critical-section is now a full replacement for bare_metal (at least the parts we need (the Mutex)), I'll work on an implementation soon :).

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

Successfully merging a pull request may close this issue.

3 participants