We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f3fa545 commit 5480888Copy full SHA for 5480888
cortex-m-rt/examples/pre_init.rs
@@ -0,0 +1,36 @@
1
+//! `cortex-m-rt` based program with a function run before RAM is initialized.
2
+
3
+#![deny(warnings)]
4
+#![no_main]
5
+#![no_std]
6
7
+#[macro_use(entry, exception, pre_init)]
8
+extern crate cortex_m_rt as rt;
9
+extern crate panic_semihosting;
10
11
+use rt::ExceptionFrame;
12
13
+pre_init!(disable_watchdog);
14
15
+unsafe fn disable_watchdog() {
16
+ // Do what you need to disable the watchdog.
17
+}
18
19
+// the program entry point
20
+entry!(main);
21
22
+fn main() -> ! {
23
+ loop {}
24
25
26
+// the hard fault handler
27
+exception!(HardFault, hard_fault);
28
29
+fn hard_fault(_ef: &ExceptionFrame) -> ! {
30
31
32
33
+// the default exception handler
34
+exception!(*, default_handler);
35
36
+fn default_handler(_irqn: i16) {}
0 commit comments