-
Notifications
You must be signed in to change notification settings - Fork 85
compile on stable #69
Conversation
src/lib.rs
Outdated
#[doc(hidden)] | ||
pub enum Exception { | ||
NMI, | ||
MenManage, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be MemManage?
Tried it out and it works for me. |
Changes from cortex-m-rt v0.4.x and stable-embedded-rust that warrant some discussion:
Unresolved questions:
// You can pick
exception!(BusFault, bf);
fn bf() -> ! {
// ..
}
// OR this
exception!(unsafe BusFault, bf);
fn bf() {
// ..
return;
}
Bikeshedding:
TODO:
cc @thejpster |
Bikeshedding: should |
Future improvements: Macros 1.2 is planned for the 1.28 release and will allow custom attributes (i.e. // Today
#[macro_use(exception)]
extern crate cortex_m_rt;
exception!(SysTick, sys_tick);
fn sys_tick() { .. }
// Macros 1.2
extern crate cortex_m_rt;
use cortex_m_rt::exception;
#[exception(SysTick)]
fn sys_tick() { .. }
// or even
#[exception]
fn SysTick() { .. } We could do the same with |
In my use case, I want all interrupts to optionally go to a shared handler, but I'd prefer to have individual exception handlers as well as a DefaultHandler for everything else. Is it possible to have the interrupts! macro bind to a specific handler rather than DefaultHandler? |
It could but most applications are not going to use the So, I guess my question actually is: should If you are using something other than svd2rust you can do whatever you want; you don't need to use |
…` .. - remove some variants from `Exception` when targeting ARMv6-M - future proof the ABI of `__EXCEPTIONS` by using a `union` instead of `Option<fn()>` (the `None` variant is not guaranteed to always be represented as the value `0`) - tweak exception names to match CMSIS and the names used in cortex-m v0.5.0 - add an opt-in "device" feature to opt into a device specific build (interrupts must be supplied by a different crate, or manually by the user). - drop the `interrupts!` macro. If you don't enable the "device" feature `cortex-m-rt` will bind all possible interrupts to the default exception handler.
- document the `main` symbol as an alternative to `entry!` - document `ResetTrampoline` - fix: `PendSV` is available on ARMv6-M - document that `entry!` and `exception!` must be called from accessible modules. - add a deny lint to `entry!` and `exception!` to prevent them from being invoked from inaccessible modules.
bors try |
tryBuild succeeded |
bors r+ |
69: compile on stable r=japaric a=japaric with these changes this crate compiles on stable Co-authored-by: Jorge Aparicio <[email protected]>
Build succeeded |
29: use less unstable dependencies r=japaric a=japaric This PR and the ones at the bottom reduce the number of unstable features needed for Cortex-M development to a single one: `lang = "panic_fmt"`, which already has a path towards stabilization and which we hope to get on stable by 1.28. [Check out the temporary documentation](https://japaric.github.io/cortex-m-quickstart/cortex_m_quickstart/index.html) (we still need more docs) to try out this preview. We would love your input on [these unresolved questions](rust-embedded/cortex-m-rt#69 (comment)) This PR depends on: - rust-embedded/cortex-m-rt#69 - rust-embedded/cortex-m#88 - rust-embedded/panic-semihosting#2 - rust-embedded/svd2rust#203 - japaric/stm32f103xx#24 Co-authored-by: Jorge Aparicio <[email protected]>
with these changes this crate compiles on stable