jonas-schievink / rubble

(going to be a) BLE stack for embedded Rust
BSD Zero Clause License
397 stars 56 forks source link

Support thumbv6 platforms #79

Closed jonas-schievink closed 4 years ago

jonas-schievink commented 4 years ago

This PR prepares the core Rubble library to support thumbv6-based MCUs such as the nRF51 series. It does not yet contain a hardware interface for those MCUs (the intention is still to merge https://github.com/jonas-schievink/rubble/pull/59, which does contain the rest needed to use nRF51s).

The PR also makes the packet queue pluggable, which fixes #33 and allows even more platforms to be supported, since you can now implement the queue traits for hardware-based queues or other queue implementations that make use of hardware-provided vendor-specific synchronization mechanisms like monitor peripherals.

The default BBQueue-based packet queue is removed and replaced by a very simple and limited one based on heapless::spsc::Queue. This is a slight drawback, but it's now possible to implement the queue traits for custom queues, so it is still possible to use bbqueue. Eventually, once bbqueue is more mature and we don't need to use a git-dependency, we can possibly include the relevant impls in Rubble again.

A nice side effect of this change is that it reduces the RAM usage by quite a lot. The queue size is halved and is only as large as one PDU. The fixed memory overhead of the heapless queue (~2 Bytes (?)) is also much lower than the bbqueue overhead (~26 Bytes (?)).

cc @chocol4te, any thoughts on this?

fmckeogh commented 4 years ago

I've done an initial skim, LGTM, I can do a deeper look through and more thorough testing later today? Feel free to merge and I can just open issues if I find anything :)

fmckeogh commented 4 years ago

Really fantastic work though :D

fmckeogh commented 4 years ago

I'll also be happy to update #59 and try and get it done once this is merged :)