First commit
This commit is contained in:
42
src/main.rs
Normal file
42
src/main.rs
Normal file
@@ -0,0 +1,42 @@
|
||||
#![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") }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user