Compare commits

...

3 Commits

@ -2,7 +2,7 @@
use core::ptr::{read_volatile, write_volatile};
const BASE_POINTER: u32 = 0x2000_0000;
const BASE_POINTER: u32 = 0x1000_0000;
const NUMBER_DISPLAY_OFFSET: u32 = 0x00;
const RANDOM_NUMBER_OFFSET: u32 = 0x04;

@ -17,4 +17,4 @@ disassemble: extract
clean:
cargo clean
rm text.bin
rm /tmp/text.bin /tmp/rodata.bin

@ -0,0 +1,14 @@
// build.rs
use std::env;
use std::fs;
use std::path::PathBuf;
fn main() {
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
// Put the linker script somewhere the linker can find it.
fs::write(out_dir.join("memory.x"), include_bytes!("memory.x")).unwrap();
println!("cargo:rustc-link-search={}", out_dir.display());
println!("cargo:rerun-if-changed=memory.x");
println!("cargo:rerun-if-changed=build.rs");
}

@ -1,9 +1,9 @@
MEMORY
{
INST : ORIGIN = 0x00000000, LENGTH = 256K
IO : ORIGIN = 0x20000000, LENGTH = 1K
CONST : ORIGIN = 0x40000000, LENGTH = 16K
RAM : ORIGIN = 0x80000000, LENGTH = 16K
IO : ORIGIN = 0x10000000, LENGTH = 1K
CONST : ORIGIN = 0x20000000, LENGTH = 16K
RAM : ORIGIN = 0x40000000, LENGTH = 16K
}
REGION_ALIAS("REGION_TEXT", INST);

@ -1,8 +1,9 @@
#![no_std]
#![no_main]
use core::{fmt::Write, panic::PanicInfo};
use lwcpu::{NumberDisplay, Screen, TextDisplay};
use core::fmt::Write;
use core::panic::PanicInfo;
use lwcpu::{NumberDisplay, TextDisplay};
use riscv_rt::entry;
#[panic_handler]
@ -11,15 +12,9 @@ fn panic_handler(_info: &PanicInfo) -> ! {
loop {}
}
const HELLO_WORLD: &str = " Hello world!";
#[entry]
fn main() -> ! {
let mut text = TextDisplay{};
for i in 0..31 {
Screen::set_line(i, 1 << i);
}
loop {
let _ = text.write_str(HELLO_WORLD);
}
let _ = write!(text, "LMAO: {}", 47);
loop {}
}

Loading…
Cancel
Save