189: write generated code to disk for easier inspection r=japaric a=japaric
now that the generated code is actually readable let's make it easier to access
this commit also documents how to inspect the generated code via
`rtfm-expansion.rs` and `cargo-expand`
Co-authored-by: Jorge Aparicio <jorge@japaric.io>
now that the generated code is actually readable let's make it easier to access
this commit also documents how to inspect the generated code via
`rtfm-expansion.rs` and `cargo-expand`
This commit:
- Implements RFC 147: "all functions must be safe"
- Implements RFC 155: "explicit Context parameter"
- Implements the pending breaking change #141: reject assign syntax in `init`
(which was used to initialize late resources)
- Refactors code generation to make it more readable -- there are no more random
identifiers in the output -- and align it with the book description of RTFM
internals.
- Makes the framework hard depend on `core::mem::MaybeUninit` and thus will
require nightly until that API is stabilized.
- Fixes a ceiling analysis bug where the priority of the system timer was not
considered in the analysis.
- Shrinks the size of all the internal queues by turning `AtomicUsize` indices
into `AtomicU8`s.
- Removes the integration with `owned_singleton`.
170: check task priority at compile time r=TeXitoi a=japaric
before we were checking the priority at runtime. The compile time error message
when the priority is too high is kind of awful though.
Co-authored-by: Jorge Aparicio <jorge@japaric.io>
This program was being accepted:
``` rust
#[task(
capacity = 1,
capacity = 2,
priority = 1,
priority = 2,
)]
fn foo() {}
```
now it will trigger a compiler error
closes#69
this doesn't change functionality per se but improves diagnostics in some cases. Some hard errors
have becomes warnings, for example: when `resources` is empty, or when `idle.path` is set to the
default `idle` path.
task! can be re-added in a backward compatible fashion and I'd like to not have
two ways to assign a task handler to an interrupt / exception in the first
release.
rtfm::atomic now uses the `Threshold` token instead of the `CriticalSection`
token. This reduces overhead by dropping the "are interrupts enabled?" check.
- allow trailing commas in list of resources
- make task.resources optional
- add rtfm::set_pending function which can be used to force an interrupt into
the pending state. This is a replacement of the old rtfm::request.
rtfm::set_pending takes the Interrupt enum provided by the device crate as
argument. (The old rtfm::request took a task function as argument)
- the user may want to use types they imported into the root of the crate. These
types are not available in e.g. `mod idle` so `idle::Resources` *can't* be
defined in that module. To workaround this problem `idle::Resources` will be
defined in the root, with some other name, and then be re-exported in the
`idle` module.
- remove the "a resource only used by one task should be local data" check. In
some cases you do want a resource owned by a single task instead of local
data since `init` can access resources but not a task local data.