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 implementation for esp-lp-hal #3035

Open
DivineGod opened this issue Jan 26, 2025 · 1 comment
Open

critical-section implementation for esp-lp-hal #3035

DivineGod opened this issue Jan 26, 2025 · 1 comment

Comments

@DivineGod
Copy link

Motivations

There's no critical-section implementation for esp-lp-hal besides the default implementation that comes from not specifying an implementation.

This currently causes an issue that a project with both esp-hal and esp-lp-hal cannot be in the same crate. And it might means that, since HP and LP memory is shared the LP core could access memory used by the HP core during a critical section of code.

Solution

Implement a multi-core safe critical-section for esp-lp-hal.

Alternatives

The alternative to not having a critical section is to somehow ensure that the cores won't ever have any resource conflicts, but we cannot rely on Rust to give us these guarantees.

@DivineGod DivineGod added the status:needs-attention This should be prioritized label Jan 26, 2025
@bugadani
Copy link
Contributor

bugadani commented Jan 27, 2025

This currently causes an issue that a project with both esp-hal and esp-lp-hal cannot be in the same crate.

Defining a critical section may not be a solution anyway. The ESP32-S3 and the C6 use different restore state types (I don't really know why, but that's besides the point), and so if the lp-hal ends up matches one of them, the other one would have the same problem you have now.

Also note that esp-lp-hal does have a critical-section implementation via the riscv crate.

@MabezDev MabezDev removed the status:needs-attention This should be prioritized label Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

3 participants