reflow-firmware3.0/src/main.rs

50 lines
940 B
Rust
Raw Normal View History

2020-09-09 19:25:41 +02:00
#![deny(unsafe_code)]
#![no_std]
#![no_main]
use cortex_m::asm;
use cortex_m_rt::{entry, exception};
2020-12-23 23:52:23 +01:00
2020-09-09 19:25:41 +02:00
use rtt_target::{rprintln, rtt_init_print};
2020-12-23 23:52:23 +01:00
use stm32f1xx_hal::pac;
2020-09-09 19:25:41 +02:00
mod application;
mod max6675;
2020-10-04 15:39:30 +02:00
mod profiles;
2020-09-09 19:25:41 +02:00
#[entry]
fn main() -> ! {
rtt_init_print!();
2021-03-09 22:12:05 +01:00
rprintln!("Startup!");
2020-09-09 19:25:41 +02:00
// Get access to the core peripherals from the cortex-m crate
let cp = cortex_m::Peripherals::take().unwrap();
// Get access to the device specific peripherals from the peripheral access crate
let dp = pac::Peripherals::take().unwrap();
2021-03-09 22:12:05 +01:00
rprintln!("Application Setup");
2020-12-23 23:52:23 +01:00
let app = application::setup(cp, dp);
2021-03-09 22:12:05 +01:00
rprintln!("Application Setup done");
app.run()
}
2020-09-09 21:35:04 +02:00
#[exception]
fn PendSV() {
rprintln!("PendSV");
panic!()
}
2020-09-09 21:35:04 +02:00
#[panic_handler]
fn panic(info: &core::panic::PanicInfo) -> ! {
rprintln!("{}", info);
exit()
}
2020-09-09 21:35:04 +02:00
fn exit() -> ! {
2020-09-09 19:25:41 +02:00
loop {
asm::bkpt() // halt = exit probe-run
2020-09-09 19:25:41 +02:00
}
}