mirror of
https://github.com/ferrous-systems/embedded-trainings-2020.git
synced 2024-05-04 17:49:00 +00:00
fix panic handler exercise
This commit is contained in:
parent
74bdeb3665
commit
514bcf68d3
|
@ -37,12 +37,13 @@ stack backtrace:
|
||||||
|
|
||||||
In `no_std` programs the behavior of panic is defined using the `#[panic_handler]` attribute. In the example, the *panic handler* is defined in the `panic_log` crate but we can also implement it manually:
|
In `no_std` programs the behavior of panic is defined using the `#[panic_handler]` attribute. In the example, the *panic handler* is defined in the `panic_log` crate but we can also implement it manually:
|
||||||
|
|
||||||
✅ Comment out the `panic_probe` import and add the following function to the example:
|
✅ Comment out the `use apps as _;` import and add the following function to the example:
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
#[panic_handler]
|
#[panic_handler]
|
||||||
fn panic(info: &core::panic::PanicInfo) -> ! {
|
fn panic(info: &core::panic::PanicInfo) -> ! {
|
||||||
defmt::panic!("{}", info);
|
defmt::error!("{}", defmt::Debug2Format(info));
|
||||||
|
asm::udf();
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue