43 lines
670 B
Rust
43 lines
670 B
Rust
#![no_std]
|
|
#![no_main]
|
|
|
|
use core::arch::asm;
|
|
|
|
use embedded_alloc::LlffHeap as Heap;
|
|
use log::info;
|
|
|
|
use crate::{
|
|
io::init_log,
|
|
vga::{Color, Vga},
|
|
};
|
|
|
|
extern crate alloc;
|
|
|
|
mod boot;
|
|
mod critical_section;
|
|
mod io;
|
|
mod panic_handler;
|
|
mod riscv;
|
|
mod uart;
|
|
mod vga;
|
|
|
|
pub const HEAP_SIZE: usize = 40960;
|
|
#[global_allocator]
|
|
static HEAP: Heap = Heap::empty();
|
|
|
|
#[unsafe(no_mangle)]
|
|
pub extern "C" fn main() {
|
|
unsafe {
|
|
embedded_alloc::init!(HEAP, HEAP_SIZE);
|
|
}
|
|
init_log().unwrap();
|
|
Vga::init();
|
|
|
|
info!("Hello World !");
|
|
unsafe { Vga::draw_string(10, 10, "Hello World !", Color::WHITE) };
|
|
|
|
loop {
|
|
unsafe { asm!("wfi") }
|
|
}
|
|
}
|