blob: aee07677711189267383364876275d2acdb5fbf5 (
plain)
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
|
#![no_std]
#![no_main]
mod led;
use core::arch::global_asm;
use gd32vf103_pac::Peripherals;
use led::LED;
global_asm!(include_str!("boot.S"));
#[no_mangle]
fn main(_hartid: usize) -> ! {
// let peripherals = Peripherals::take().unwrap();
let peripherals = unsafe { Peripherals::steal() };
let led = LED::new(&peripherals);
loop {
led.toggle();
delay();
}
}
fn delay() {
for _ in 1..100_000 {}
}
#[panic_handler]
fn panic(info: &core::panic::PanicInfo) -> ! {
if let Some(loc) = info.location() {
let _file = loc.file();
let _line = loc.line();
if let Some(_msg) = info.payload().downcast_ref::<&str>() {
loop {}
}
loop {}
}
loop {}
}
|