Closed korken89 closed 4 years ago
An alternative would be to panic when #[cfg(debug_assertions)]
is on, and use infinite loops otherwise. That way users won't have to go through the hassle of overriding handlers to get small executables.
Could do, but honestly I'd prefer exceptions to reset if I've selected panic-reset
or panic-persist
as my panic handler, even in release mode.
If you have a panic handler that disregards the panicinfo, it should still be largely optimized out (branch to panic handler/SCB::sys_reset()
, instead of infinite branch loop)
This should probably have been closed by #257, but that has since been reverted, with the decision to make overriding non-maskable interrupt handlers unsafe
(https://github.com/rust-embedded/cortex-m-rt/pull/289), so closing as wontfix instead.
@jamesmunns and I had a discussion on Matrix about the current defaults that leave
HardFault_
andDefaultHander_
implemented as infinite loops. This should most likely be replaced withpanic
in the default case to help the implementors detect issues and if nothing is done the panic crate takes care of the default course of action. This might increase code size a bit, but for those that do not want this can override it and provide their own implementation.From an API standpoint it is not a breaking change, however the documentation states that we use infinite loops as the default, so it is a breaking change.