Move ringbuffer to core

Ringbuffer is needed by many platforms and also by my newmsg branch.

This PR moves it into it's own core module and adapts dependencies.
`lib` depends on `ringbuffer`?