rust-embedded / rust-embedded/cortex-m
Allow setting exception return value in exceptions
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1k
- Forks
- 202
- Avg merge
- 6d 2h
- Merged PRs (30d)
- 2
Description
As far as I could tell the API does not currently allow setting the exception return value (EXC_RETURN) in exception handlers, which would be useful for implementing context switching etc.
Could we add an extra case to the #[exception] macro to also accept something like:
#[exception]
fn SysTick(exc: ExceptionReturn) -> ExceptionReturn
Where:
pub enum ExceptionReturn {
HandlerMsp,
HandlerFpuMsp,
ThreadMsp,
....
}
This enum can then be used under the hood to set the correct value for LR/PC upon exception return.
I'd be happy to further experiment with this idea and turn it into a pull request.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the #[exception] macro and its current handler forms, then review how EXC_RETURN is represented and used in Cortex-M exception return paths. Define the ExceptionReturn variants and the accepted handler signature, and verify that the macro can use the returned value to set the correct exception-return state for context switching.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- embedded-iot
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100