#![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 {} }