embedded-alloc icon indicating copy to clipboard operation
embedded-alloc copied to clipboard

Use critical-section for heap locking.

Open Dirbaio opened this issue 3 years ago • 3 comments

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

Dirbaio avatar Aug 12 '22 13:08 Dirbaio

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.

rust-highfive avatar Aug 12 '22 13:08 rust-highfive

Maybe it should be embedded-alloc in line with other crates in this org?

jonathanpallant avatar Aug 12 '22 13:08 jonathanpallant

Maybe add a critical-section feature upstream to linked_list_allocator instead?

reitermarkus avatar Sep 04 '22 14:09 reitermarkus

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).

chrysn avatar Dec 01 '22 08:12 chrysn

Discussed on today's WG meeting. chatlogs, it was decided to rename to embedded-alloc.

Dirbaio avatar Dec 06 '22 19:12 Dirbaio

bors r+

adamgreig avatar Dec 08 '22 00:12 adamgreig

I've renamed this repo and published to https://crates.io/crates/embedded-alloc :tada:

adamgreig avatar Dec 08 '22 01:12 adamgreig

@adamgreig could you add the cortex-m team as an owner on crates.io as well?

eldruin avatar Dec 19 '22 19:12 eldruin

Thanks for the reminder, done.

adamgreig avatar Dec 19 '22 19:12 adamgreig