embedded-alloc
embedded-alloc copied to clipboard
Use critical-section for heap locking.
This uses critical_section::with instead of cortex_m::interrupt::free to acquire a critical section. This allows customizing the critical section implementation, to make it sound for multicore chips for example.
This is a breaking change, so it'll require a 0.5 release.
Interestingly this makes the crate not cortex-m specific anymore. Perhaps it could be renamed to something more general?
TODO
- [x] Wait for cortex-m 0.7.6 release https://github.com/rust-embedded/cortex-m/pull/449
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @thalesfragoso (or someone else) soon.
Please see the contribution instructions for more information.
Maybe it should be embedded-alloc in line with other crates in this org?
Maybe add a critical-section feature upstream to linked_list_allocator instead?
Having customizable critical sections also benefits the use case of the nRF softdevice (which requires users never to turn off interrupts completely).
If this requires an API change, it might be worth considering whether that change could also be used for non-critical-section exclusitivness. A concrete setup I have in mind is always failing attempts to allocate from interrupts (which in setups without context switching would mean that little to no is needed; of course, if critical_section also allows such a null-implementation, all the better).
Discussed on today's WG meeting. chatlogs, it was decided to rename to embedded-alloc.
bors r+
I've renamed this repo and published to https://crates.io/crates/embedded-alloc :tada:
@adamgreig could you add the cortex-m team as an owner on crates.io as well?
Thanks for the reminder, done.