Skip to content

Commit

Permalink
Merge pull request #31 from tweedegolf/fix-example
Browse files Browse the repository at this point in the history
Fix example
  • Loading branch information
diondokter authored Aug 1, 2023
2 parents 9c8f08a + a630a48 commit 77ba6d7
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions capture/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ let mut stack_capture = ArrayMemoryRegion::default();
let mut core_registers = ArrayRegisterData::default();
let mut fpu_registers = ArrayRegisterData::default();
cortex_m::interrupt::free(|cs| {
stackdump_capture::cortex_m::capture(&mut stack_capture, &mut core_registers, &mut fpu_registers, &cs)
});
stackdump_capture::cortex_m::capture(&mut stack_capture, &mut core_registers, &mut fpu_registers);
```

## For use when crashing (using cortex m as example target)
Expand Down Expand Up @@ -102,19 +101,16 @@ Now we can capture a everything in e.g. a panic.
```rust,ignore
#[panic_handler]
fn panic(_info: &core::panic::PanicInfo) -> ! {
cortex_m::interrupt::free(|cs| {
unsafe {
stackdump_capture::cortex_m::capture(
&mut *STACK_CAPTURE.as_mut_ptr(),
&mut *CORE_REGISTERS_CAPTURE.as_mut_ptr(),
&mut *FPU_REGISTERS_CAPTURE.as_mut_ptr(),
&cs
);
// If you want to capture the heap or the static data, then do that here too yourself
}
unsafe {
stackdump_capture::cortex_m::capture(
&mut *STACK_CAPTURE.as_mut_ptr(),
&mut *CORE_REGISTERS_CAPTURE.as_mut_ptr(),
&mut *FPU_REGISTERS_CAPTURE.as_mut_ptr(),
);
// If you want to capture the heap or the static data, then do that here too yourself
}
set_capture_made();
});
set_capture_made();
cortex_m::peripheral::SCB::sys_reset()
}
```
Expand Down

0 comments on commit 77ba6d7

Please sign in to comment.