Created
December 31, 2022 10:33
-
-
Save folknology/7515951122d43b02ce628fe05a2e2e59 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![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