summaryrefslogtreecommitdiffstats
path: root/ble
diff options
context:
space:
mode:
Diffstat (limited to 'ble')
-rw-r--r--ble/src/main.rs16
1 files changed, 13 insertions, 3 deletions
diff --git a/ble/src/main.rs b/ble/src/main.rs
index 6f167a5..0fed859 100644
--- a/ble/src/main.rs
+++ b/ble/src/main.rs
@@ -10,7 +10,7 @@ mod rtc;
use clint::HandlerArray;
use core::mem;
use cortex_m::asm::wfi;
-use cortex_m_rt::entry;
+use cortex_m_rt::{entry, exception, ExceptionFrame};
use log::{info, trace, LevelFilter};
#[allow(unused_imports)]
@@ -47,12 +47,12 @@ fn main() -> ! {
let mut nvic = nrf52.NVIC;
let mut rtc_handler = rtc::setup(Rtc::new(nrf52.RTC0), Clocks::new(nrf52.CLOCK));
- logln_now!("logln_now?");
HANDLERS.with_overrides(|hs| {
hs.register(0, &mut rtc_handler);
nvic.enable(Interrupt::RTC0);
info!("Bootstrap complete.");
+
let mut last_tick = rtc::millis();
last_tick -= last_tick % 1024;
loop {
@@ -68,7 +68,17 @@ fn main() -> ! {
unreachable!();
}
-// TODO: RTC0/1/2 exist. See which is best, if it matters.
+#[exception]
+fn HardFault(ef: &ExceptionFrame) -> ! {
+ log::logger().flush();
+ logln_now!("!!! Hard Fault - ef: {:?} !!!", ef);
+ logln_now!("flushing log");
+ loop {
+ log::logger().flush();
+ wfi()
+ }
+}
+
#[interrupt]
fn RTC0() {
HANDLERS.call(0);