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

Provide critical_section implementation. #5

Closed
reitermarkus opened this issue Aug 24, 2022 · 4 comments
Closed

Provide critical_section implementation. #5

reitermarkus opened this issue Aug 24, 2022 · 4 comments

Comments

@reitermarkus
Copy link

The next version of svd2rust will depend on critical_section for Peripherals::take (see rust-embedded/svd2rust#651), so this crate should provide an implementation (see https://docs.rs/critical-section/latest/critical_section/#providing-an-implementation).

@kiffie
Copy link
Owner

kiffie commented Aug 24, 2022

Thanks for opening this issue. Is the general idea to replace the critical section provided in bare_metalwith the one define in the critical_section crate?

bors bot added a commit to rust-embedded/svd2rust that referenced this issue Aug 24, 2022
651: Use `critical_section` for `Peripherals::take`. r=therealprof a=reitermarkus

- `cortex_m` rust-embedded/cortex-m#447
- `msp430` rust-embedded/msp430#13
- `riscv` rust-embedded/riscv#110
-  `xtensa_lx` esp-rs/xtensa-lx#20, esp-rs/esp-hal#151
- `mips_mcu` kiffie/pic32-rs#5


Co-authored-by: Markus Reiter <me@reitermark.us>
@reitermarkus
Copy link
Author

Yes, critical_section 1.0 is a full replacement for bare_metal 1.0.

@kiffie
Copy link
Owner

kiffie commented Aug 24, 2022

Sounds good. I plan to add an implementation for it that is similar to critical-section-single-core in the cortex-m crate.

I think critical_section is better because the implementation is separated. So, one can provide a special implementation if needed for some applications, e. g. if disabling all IRQs is not acceptable. One could, in such special implementation, exclude the highest IRQ priority level from being disabled for NMI-like emergency tasks (go to deep sleep after power loss, emergency shutdown of power electronics, etc).

@kiffie
Copy link
Owner

kiffie commented Jun 9, 2023

The critical-section crate is now used instead of bare-metal

@kiffie kiffie closed this as completed Jun 9, 2023
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

No branches or pull requests

2 participants