Skip to content
This repository was archived by the owner on Jan 30, 2024. It is now read-only.

Commit 14596e2

Browse files
committedSep 7, 2020
document hard fault behavior
1 parent e6027e6 commit 14596e2

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
 

‎README.md

+32
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,38 @@ stack backtrace:
149149
3: 0x000005ee - Reset
150150
```
151151

152+
## Non-zero exit code
153+
154+
When the device raises a hard fault exception `probe-run` will print a backtrace
155+
and exit with non-zero exit code.
156+
157+
You can trigger a hard fault exception with the UDF instruction.
158+
159+
``` rust
160+
use cortex_m::asm;
161+
#[entry]
162+
fn main() -> ! {
163+
asm::udf()
164+
}
165+
```
166+
167+
``` console
168+
$ cargo run --bin hard-fault
169+
stack backtrace:
170+
0: 0x000003e0 - HardFaultTrampoline
171+
<exception entry>
172+
1: 0x00000140 - __udf
173+
2: 0x00000118 - cortex_m::asm::udf
174+
3: 0x0000012c - hard_fault::__cortex_m_rt_main
175+
4: 0x00000122 - main
176+
5: 0x000000fa - Reset
177+
178+
$ echo $?
179+
134
180+
```
181+
182+
**NOTE** when you run your application with `probe-run` the `HardFault` handler,
183+
default or user-defined one, will *NOT* be executed.
152184

153185
## Support
154186

0 commit comments

Comments
 (0)