-
Notifications
You must be signed in to change notification settings - Fork 192
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
drop #[exception]
and #[interrupt]
syntax in favor of #[task(binds = ..)]
#207
Comments
Well-reasoned. |
Is it possible to add some attributes to help with https://github.com/japaric/cortex-m-rtfm/issues/197 ? |
This is indeed a good step forward and a simplification that helps readability. |
A great simplification. OK for me |
How would the fn DefaultHandler(irqn: i16);
fn HardFault(ef: &cortex_m_rt::ExceptionFrame) -> !; |
@jordens neither of those two handlers can be managed by RTFM; they are rejected by the DSL if you try to bind a task to them. Only interrupts / exceptions with configurable priorities can be used as tasks. (Accessing a resource ( |
🎉 This RFC has been formally approved. Implementation is in PR #205 (I'm going to keep this open until the PR lands) |
205: rtfm-syntax refactor + heterogeneous multi-core support r=japaric a=japaric this PR implements RFCs #178, #198, #199, #200, #201, #203 (only the refactor part), #204, #207, #211 and #212. most cfail tests have been removed because the test suite of `rtfm-syntax` already tests what was being tested here. The `rtfm-syntax` crate also has tests for the analysis pass which we didn't have here -- that test suite contains a regression test for #183. the remaining cfail tests have been upgraded into UI test so we can more thoroughly check / test the error message presented to the end user. the cpass tests have been converted into plain examples EDIT: I forgot, there are some examples of the multi-core API for the LPC541xx in [this repository](https://github.com/japaric/lpcxpresso54114) people that would like to try out this API but have no hardware can try out the x86_64 [Linux port] which also has multi-core support. [Linux port]: https://github.com/japaric/linux-rtfm closes #178 #198 #199 #200 #201 #203 #204 #207 #211 #212 closes #163 cc #209 (documents how to deal with errors) Co-authored-by: Jorge Aparicio <jorge@japaric.io>
205: rtfm-syntax refactor + heterogeneous multi-core support r=japaric a=japaric this PR implements RFCs #178, #198, #199, #200, #201, #203 (only the refactor part), #204, #207, #211 and #212. most cfail tests have been removed because the test suite of `rtfm-syntax` already tests what was being tested here. The `rtfm-syntax` crate also has tests for the analysis pass which we didn't have here -- that test suite contains a regression test for #183. the remaining cfail tests have been upgraded into UI test so we can more thoroughly check / test the error message presented to the end user. the cpass tests have been converted into plain examples EDIT: I forgot, there are some examples of the multi-core API for the LPC541xx in [this repository](https://github.com/japaric/lpcxpresso54114) people that would like to try out this API but have no hardware can try out the x86_64 [Linux port] which also has multi-core support. [Linux port]: https://github.com/japaric/linux-rtfm closes #178 #198 #199 #200 #201 #203 #204 #207 #211 #212 closes #163 cc #209 (documents how to deal with errors) Co-authored-by: Jorge Aparicio <jorge@japaric.io>
Done in PR #205 |
207: Rejig link.x to include more lables to help the linker lay out the ob… r=thejpster a=therealprof …jects Tested with 1.34.0 and 1.38.0 and careful inspection of the linker map generated on the previously failing https://github.com/rust-lang/rust/files/3722440/minimal-rust-lld-issue.zip Closes rtic-rs#188 (I believe) Closes rust-lang/rust#65391 Signed-off-by: Daniel Egger <daniel@eggers-club.de> Co-authored-by: Daniel Egger <daniel@eggers-club.de>
Current behavior
Two attributes are used to declare hardware tasks:
#[exception]
and#[interrupt]
. The difference between the two is subtle:#[exception]
is fordeclaring hardware tasks bound to one of the ARM Cortex-M exceptions (e.g.
SVCall
,SysTick
), whereas#[interrupt]
is for declaring hardware tasksbound to device specific interrupts.
This distinction has been inherited from
cortex-m-rt
-land where two attributesare required to implement the "does this interrupt exist?" check -- the issue
there is that the enumeration of valid exceptions / interrupts are defined in
different crates (
cortex-m
and PAC, respectively) and the#[exception]
and#[interrupt]
attributes can be used in any context (application or library) --handlers can even be defined in multiple crates.
Proposal
Drop the
#[exception]
and#[interrupt]
attributes from the syntax and usethe
#[task]
attribute to declare both software and hardware tasks.Rationale
In RTFM applications hardware tasks are defined within the contents of the
#[rtfm::app]
macro so there's no real need for the user to distinguish betweenhardware tasks bound to Cortex-M exceptions and hardware tasks bounds to
device-specific interrupts -- the framework can tell these apart without user
input (the set of Cortex-M exceptions is known at macro expansion time).
Apart from the
#[init]
-ialization function and the background#[idle]
context RTFM only has tasks: these may be software tasks issued on demand by the
software or hardware tasks started by some hardware event (interrupt signal).
It seems appropriate to use the
#[task]
attribute for both kind of tasksrather than to use two additional attributes to refer to one particular kind
of task.
Lastly, this shrinks the syntax of the RTFM meta-language which simplifies the
parser and shrinks the test suite -- there would be no need to test so many
combinations of attributes and arguments.
Detailed design
Reject uses of the the
#[exception]
and#[interrupt]
attributes within a#[rtfm::app]
specification. To declare a hardware task the programmer will usethe existing
#[task]
attribute but include thebinds
argument.Additionally, the framework will reject
#[task]
s where both thebinds
andcapacity
arguments have been specified -- a hardware task has no associatedmessage queue and thus no capacity.
Drawbacks
The
#[exception]
and#[interrupt]
attributes are well established in thewider Cortex-M ecosystem so newcomers to RTFM may find them familiar; that
familiarity would be lost with this proposal. However, I'm not sure this
familiarity is that useful because the attributes used within
#[rtfm::app]
don't have the same syntax as the
cortex_m_rt::{exception,interrupt}
attributes.
Alternatives
If it seems useful to visualize tell apart hardware tasks from software tasks we
could use a single attribute for them. For example, we could use
#[interrupt]
for all of them (instead of a mixture of#[exception]
and#[interrupt]
).The text was updated successfully, but these errors were encountered: