-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.rs
52 lines (42 loc) · 1.08 KB
/
main.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#![no_std]
#![no_main]
extern crate panic_halt;
use cortex_m_rt::exception;
pub struct Container<TypeName> {
object: TypeName,
}
pub struct Object<'d> {
object: &'d str,
}
#[rtic::app(device = stm32h7xx_hal::stm32)]
const APP: () = {
struct Resources {
// Note: It appears that rustfmt may generate a format that GDB cannot recognize, which
// results in GDB breakpoints being set improperly. To debug, redefine the following
// definition to:
//
// ```rust
// test_object: Container<Object<'static>>,
// ```
test_object: Container<Object<'static>,>,
}
#[init]
fn init(_c: init::Context) -> init::LateResources {
let test_object = {
Container {
object: Object { object: "test_d" },
}
};
init::LateResources {
test_object
}
}
#[idle(resources=[])]
fn idle(_c: idle::Context) -> ! {
loop {}
}
};
#[exception]
fn HardFault(ef: &cortex_m_rt::ExceptionFrame) -> ! {
panic!("HardFault at {:#?}", ef);
}