cortex-m
cortex-m copied to clipboard
Allow setting exception return value in exceptions
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.