-
Notifications
You must be signed in to change notification settings - Fork 109
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
[WIP] Introduce a libtock-platform
crate under libtock-core
#211
Conversation
Wow! There are over 1000 lines in a single commit. Can this be split up a little more? |
I think I can split this into the following parts:
My concern is that if I send those PRs in isolation, the context in which they are written will be very unclear. I'm not really sure how to approach this. I could keep this draft around for reference while re-implementing it in a more piecewise fashion. |
Does anyone have input on how I should proceed with this? I can:
|
A single large patch is very difficult to review (making it more likely reviewers miss things) and makes bisecting future regressions more cumbersome. The PR should be split up into as small as patches as possible. It doesn't really matter if the docs for first or last, but they should also probably be split up. |
01cea54
to
a005be1
Compare
I noticed an update here, do you have an update on this PR? |
I'm using this PR to develop libtock_platform and the components it interacts with. When something in this PR stabilizes (i.e. I'm confident it is approximately correct), I'll split it out into a separate PR. That is where #220, #221, #222, #223, and #231 have come from. |
Just checking to see if you need anything else reviewed, I'll keep an eye out for future PRs |
Closing because the design has drifted away from this PR's design, as documented in #256 |
I intended to complete the
libtock-platform
crate before sending this PR for review, but I think it is growing too large to send without first discussing the design. Instead, I am sending it as a draft PR so we can discuss the design before I send a polished PR out.This PR is part of a larger reorganization of
libtock-core
that I am trying to work on. In general, I would like to do the following:libtock-core
into multiple crates that live in thecore/
directory.libtock-core
would remain as a crate that aggregates all the functionality, so that applications only need to use one crate directly. Examples and integration tests would live incore/examples
andcore/tests
, so they can depend onlibtock-core
's cumulative functionality.libtock-platform
has unit tests that run on the host system via a trivialcargo test
. These tests are easier and faster to run that on-device tests, and can be run undercargo miri
for undefined behavior detection. This is the idea discussed at [RFC] Reorganize libtock-rs for testability #132 (comment)The
libtock-platform
crate I introduce here contains the following:Syscalls
) representing raw system calls. There is no implementation of this trait inlibtock-platform
, aslibtock-platform
is OS-independent. Instead, separate crates (probablylibtock-runtime
and a testing crate) will provide implementations ofSyscalls
.Platform
struct that provides a higher-level interface over theSyscalls
trait, supporting an asynchronous execution model similar to that used by the Tock kernel.Platform
is not implemented yet. Its API is presented in the form of thePlatformApi
trait, which is currently partially written, so that otherlibtock-core
components can easily be generic over the platform type.ErrorCode
andReturnCode
types that form efficient abstractions around the kernel'sReturnCode
type.StaticCallback
,AsyncCall
, andCallback
. These should allow forlibtock-core
to provide a generic adapter for synchronous APIs and a futures-based adapter for synchronous APIs, plus prevent a recursion issue the Tock kernel has experienced.In a later PR, I will implement
libtock-runtime
, which will provide the realSyscalls
implementation and entry point forlibtock-core
. I will probably pull thepanic_handler
,start
implementation, and allocator into separate crates so that applications can switch between them.libtock-core
will pull in everything by default for clients that want the convenience.Btw, please ignore that I commented out the
-D warnings
flag in.cargo/config
, that flag was getting in the way of my development and testing. I'll remove it when I'm done implementing the major functionality.