Merge pull request #177 from ferrous-systems/update-probe-run-output

Update probe-run output to newer versions
This commit is contained in:
Tanks Transfeld 2021-12-20 13:54:39 +01:00 committed by GitHub
commit 8b15469bd3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 33 deletions

View file

@ -321,8 +321,7 @@ fn RTC0() {
unsafe { core::mem::transmute::<_, RTC0>(()).events_ovrflw.reset() } unsafe { core::mem::transmute::<_, RTC0>(()).events_ovrflw.reset() }
} }
/// Exits the application and prints a backtrace when the program is executed through the `probe-run` /// Exits the application when the program is executed through the `probe-run` Cargo runner
/// Cargo runner
pub fn exit() -> ! { pub fn exit() -> ! {
log::info!("`dk::exit() called; exiting ...`"); log::info!("`dk::exit() called; exiting ...`");
// force any pending memory operation to complete before the BKPT instruction that follows // force any pending memory operation to complete before the BKPT instruction that follows

View file

@ -5,17 +5,25 @@
This program attempts to index an array beyond its length and this results in a panic. This program attempts to index an array beyond its length and this results in a panic.
``` console ``` console
(HOST) INFO flashing program (34.79 KiB)
(HOST) INFO success!
────────────────────────────────────────────────────────────────────────────────
ERROR:panic_log -- panicked at 'index out of bounds: the len is 3 but the index is 3', src/bin/panic.rs:29:13 ERROR:panic_log -- panicked at 'index out of bounds: the len is 3 but the index is 3', src/bin/panic.rs:29:13
────────────────────────────────────────────────────────────────────────────────
stack backtrace: stack backtrace:
0: 0x000022f0 - __bkpt 0: HardFaultTrampoline
1: 0x00002010 - rust_begin_unwind <exception entry>
2: 0x00000338 - core::panicking::panic_fmt [...]
3: 0x00000216 - core::panicking::panic_bounds_check 7: panic::bar
4: 0x0000016a - panic::bar at src/bin/panic.rs:29:13
5: 0x00000158 - panic::foo 8: panic::foo
6: 0x00000192 - panic::__cortex_m_rt_main at src/bin/panic.rs:22:5
7: 0x00000178 - main 9: panic::__cortex_m_rt_main
8: 0x0000199e - Reset at src/bin/panic.rs:12:5
10: main
at src/bin/panic.rs:8:1
[...]
(HOST) ERROR the program panicked
``` ```
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:

View file

@ -14,20 +14,13 @@ Expected output:
``` console ``` console
$ cargo run --bin hello $ cargo run --bin hello
Running `probe-run --chip nRF52840_xxAA target/thumbv7em-none-eabihf/debug/hello` Running `probe-run --chip nRF52840_xxAA target/thumbv7em-none-eabihf/debug/hello`
(HOST) INFO flashing program (30.09 KiB) (HOST) INFO flashing program (34.79 KiB)
(HOST) INFO success! (HOST) INFO success!
──────────────────────────────────────────────────────────────────────────────── ────────────────────────────────────────────────────────────────────────────────
INFO:hello -- Hello, world! INFO:hello -- Hello, world!
stack backtrace: ────────────────────────────────────────────────────────────────────────────────
0: __bkpt (HOST) INFO device halted without error
1: hello::__cortex_m_rt_main
at src/bin/hello.rs:15
2: main
at src/bin/hello.rs:8
3: ResetTrampoline
at $REGISTRY/cortex-m-rt-0.6.13/src/lib.rs:547
4: Reset
at $REGISTRY/cortex-m-rt-0.6.13/src/lib.rs:550
``` ```
`cargo run` will compile the application and then invoke the `probe-run` tool with its argument set to the path of the output ELF file. `cargo run` will compile the application and then invoke the `probe-run` tool with its argument set to the path of the output ELF file.

View file

@ -16,11 +16,10 @@ The `spam()` function allocates data on the stack until the stack boundaries are
✅ Run `stack_overflow.rs` ✅ Run `stack_overflow.rs`
You should see output similar to this: You should see output similar to this (the program output between the horizontal bars might be missing):
``` console ``` console
(...) (HOST) INFO flashing program (35.25 KiB)
(HOST) INFO flashing program (32.68 KiB)
(HOST) INFO success! (HOST) INFO success!
──────────────────────────────────────────────────────────────────────────────── ────────────────────────────────────────────────────────────────────────────────
INFO:stack_overflow -- provoking stack overflow... INFO:stack_overflow -- provoking stack overflow...
@ -28,11 +27,12 @@ INFO:stack_overflow -- address of current `use_stack` at recursion depth 0: 0x20
INFO:stack_overflow -- address of current `use_stack` at recursion depth 1: 0x20039e50 INFO:stack_overflow -- address of current `use_stack` at recursion depth 1: 0x20039e50
(...) (...)
INFO:stack_overflow -- address of current `use_stack` at recursion depth 10: 0x20030a60 INFO:stack_overflow -- address of current `use_stack` at recursion depth 10: 0x20030a60
INFO:stack_overflow -- address of current `use_stack` at recursionstack backtrace: INFO:stack_overflow -- address of current `use_stack` at recursion
────────────────────────────────────────────────────────────────────────────────
stack backtrace:
0: HardFaultTrampoline 0: HardFaultTrampoline
<exception entry> <exception entry>
1: ??? (HOST) WARN call stack was corrupted; unwinding could not be completed
error: the stack appears to be corrupted beyond this point
(HOST) ERROR the program has overflowed its stack (HOST) ERROR the program has overflowed its stack
``` ```