Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • dsi_debug
  • home-exam
  • main.rs
  • master
  • rtic6
  • rtt_timing
  • timing_resources
  • timing_task
  • v1.0
9 results

Target

Select target project
  • pln/rtic_f4xx_nucleo
  • ironedde/rtic_f4xx_nucleo
  • inaule-6/rtic_f4xx_nucleo
  • rubenasplund/rtic_f4xx_nucleo
4 results
Select Git revision
  • master
  • rtic6
2 results
Show changes
Commits on Source (3)
......@@ -16,8 +16,8 @@ rtt-target = { version = "0.3.0", features = ["cortex-m"] }
# panic handlers
panic-halt = "0.2.0"
panic-semihosting = "0.5.6"
panic-rtt-target = { version = "0.1.1", features = ["cortex-m"] }
#panic-semihosting = "0.5.6"
#panic-rtt-target = { version = "0.1.1", features = ["cortex-m"] }
[dependencies.stm32f4]
version = "0.12.1"
......
......@@ -5,8 +5,8 @@
#![no_main]
#![no_std]
// use panic_halt as _;
use panic_rtt_target as _;
use panic_halt as _;
//use panic_rtt_target as _;
use rtt_target::{rprintln, rtt_init_print};
use stm32f4;
......@@ -21,10 +21,12 @@ const APP: () = {
#[idle]
fn idle(_cx: idle::Context) -> ! {
rprintln!("idle");
// panic!("panic");
panic!("panic");
/*
loop {
continue;
}
*/
}
};
......@@ -64,6 +66,16 @@ const APP: () = {
// What is the output?
//
// [Your answer here]
/*
Finished dev [unoptimized + debuginfo] target(s) in 0.03s
Running `probe-run --chip STM32F411RETx target/thumbv7em-none-eabi/debug/app`
(HOST) INFO flashing program (18.18 KiB)
(HOST) INFO success!
────────────────────────────────────────────────────────────────────────────────
init
idle
panicked at 'panic', src/main.rs:24:9
*/
//
// D) Panic halt
// Tracing is nice during development, but requires a debugger attached
......@@ -77,12 +89,38 @@ const APP: () = {
// What is the output?
//
// [Your answer here]
/*
Finished dev [unoptimized + debuginfo] target(s) in 0.03s
Running `probe-run --chip STM32F411RETx target/thumbv7em-none-eabi/debug/app`
(HOST) INFO flashing program (10.54 KiB)
(HOST) INFO success!
────────────────────────────────────────────────────────────────────────────────
init
idle
*/
//
// Now press Ctrl-C
//
// What is the output?
//
// [Your answer here]
/*
^Cstack backtrace:
0: core::sync::atomic::compiler_fence
at /home/ironedde/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/sync/atomic.rs:2640
1: rust_begin_unwind
at /home/ironedde/.cargo/registry/src/github.com-1ecc6299db9ec823/panic-halt-0.2.0/src/lib.rs:33
2: core::panicking::panic_fmt
at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/panicking.rs:85
3: core::panicking::panic
at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/panicking.rs:50
4: app::idle
at src/main.rs:24
5: main
at src/main.rs:13
6: Reset
at /home/ironedde/.cargo/registry/src/github.com-1ecc6299db9ec823/cortex-m-rt-0.6.13/src/lib.rs:526
*/
//
// E) Find the source
// Figure out how to find the source of `panic_halt`, and look at the implementation.
......@@ -92,3 +130,15 @@ const APP: () = {
//
// Paste the implementation here
// [Your answer here]
/*
The implementation for our panic is found to be an infinite loop with a no reordering compiler fence.
This means that it is impossible for the program to leave this point in the code. This is a halt.
#[inline(never)]
#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
loop {
atomic::compiler_fence(Ordering::SeqCst);
}
}
*/