Skip to content

Instantly share code, notes, and snippets.

@folknology
Created December 31, 2022 10:33
Show Gist options
  • Save folknology/7515951122d43b02ce628fe05a2e2e59 to your computer and use it in GitHub Desktop.
Save folknology/7515951122d43b02ce628fe05a2e2e59 to your computer and use it in GitHub Desktop.
#![no_std]
#![no_main]
extern crate panic_halt;
extern crate riscv_rt;
use core::arch::asm;
use riscv_rt::entry;
// simple delay look using inline asm so it doesn't get optimized away
fn delay(cycles: u32) {
for _ in 0..cycles {
unsafe {
asm!("nop");
}
}
}
#[entry]
fn main() -> ! {
//let mut mask = 0x00;
unsafe {
*(0xb1000004 as *mut u32) = 1;
*(0xb1000000 as *mut u32) = 0;
}
loop {
unsafe {
*(0xb1000000 as *mut u32) += 1;
}
// set_leds(mask);
delay(300000);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment