diff --git a/ableos/Cargo.toml b/ableos/Cargo.toml index 077645a..08c1b40 100644 --- a/ableos/Cargo.toml +++ b/ableos/Cargo.toml @@ -15,12 +15,15 @@ run-args=["-serial", "stdio"] [dependencies] spin = "0.5.2" -# linked_list_allocator = "0.9.0" [dependencies.lazy_static] features = ["spin_no_std"] version = "1.0" +# [dependencies.rhai] +# version = "*" +# features = ["no_std"] + # alloc required # [dependencies.wasmi] # version = "*" diff --git a/ableos/src/arch/aarch64/drivers/mod.rs b/ableos/src/arch/aarch64/drivers/mod.rs index ae69ade..5111e65 100644 --- a/ableos/src/arch/aarch64/drivers/mod.rs +++ b/ableos/src/arch/aarch64/drivers/mod.rs @@ -1,2 +1,3 @@ pub mod graphics; pub mod nrf52; +pub mod serial; diff --git a/ableos/src/arch/aarch64/serial.rs b/ableos/src/arch/aarch64/drivers/serial.rs similarity index 83% rename from ableos/src/arch/aarch64/serial.rs rename to ableos/src/arch/aarch64/drivers/serial.rs index 98a22e4..0b3aa25 100644 --- a/ableos/src/arch/aarch64/serial.rs +++ b/ableos/src/arch/aarch64/drivers/serial.rs @@ -1,3 +1,4 @@ +/// Prints to the host through the serial interface. #[macro_export] macro_rules! serial_print { ($($arg:tt)*) => {}; diff --git a/ableos/src/arch/aarch64/mod.rs b/ableos/src/arch/aarch64/mod.rs index 40f5a8f..46d9ae5 100644 --- a/ableos/src/arch/aarch64/mod.rs +++ b/ableos/src/arch/aarch64/mod.rs @@ -4,7 +4,6 @@ use core::ptr; pub mod drivers; pub mod init; -pub mod serial; use crate::arch::drivers::nrf52::{Level, Pins}; use core::ptr::write_volatile; global_asm!(include_str!("boot.s")); diff --git a/ableos/src/arch/riscv/drivers/serial.rs b/ableos/src/arch/riscv/drivers/serial.rs index fb27464..fad37ed 100644 --- a/ableos/src/arch/riscv/drivers/serial.rs +++ b/ableos/src/arch/riscv/drivers/serial.rs @@ -33,6 +33,7 @@ use lazy_static::lazy_static; lazy_static! { pub static ref SERIAL: Mutex = { let serial_port = Serial123 { + /// UART port for the serial bus uart_data: 0x10000000, }; Mutex::new(serial_port) diff --git a/ableos/src/lib.rs b/ableos/src/lib.rs index 6ca5156..5459521 100644 --- a/ableos/src/lib.rs +++ b/ableos/src/lib.rs @@ -1,3 +1,5 @@ +//! hi + #![no_std] // #![deny(warnings)] #![feature(asm)] diff --git a/ableos/src/print.rs b/ableos/src/print.rs index f47c61a..9d3a4e1 100644 --- a/ableos/src/print.rs +++ b/ableos/src/print.rs @@ -9,20 +9,12 @@ impl Stdout { } } impl core::fmt::Write for Stdout { - #[cfg(target_arch = "arm")] - fn write_str(&mut self, s: &str) -> Result<(), Error> { - use crate::arch::write; - write(s); - Ok(()) - } - #[cfg(target_arch = "aarch64")] fn write_str(&mut self, s: &str) -> Result<(), Error> { // Don't actually print anything yet lmao Ok(()) } - #[cfg(target_arch = "x86_64")] fn write_str(&mut self, s: &str) -> Result<(), Error> { use crate::kprint; @@ -34,12 +26,6 @@ impl core::fmt::Write for Stdout { fn write_str(&mut self, s: &str) -> Result<(), Error> { Ok(()) } - #[cfg(target_arch = "mips")] - fn write_str(&mut self, s: &str) -> Result<(), Error> { - use psp::dprint; - dprint!("{}", s); - Ok(()) - } } #[macro_export] macro_rules! print { diff --git a/ableos/src/serial.rs b/ableos/src/serial.rs new file mode 100644 index 0000000..e69de29 diff --git a/repbuild/src/main.rs b/repbuild/src/main.rs index a7b3507..a16ed57 100644 --- a/repbuild/src/main.rs +++ b/repbuild/src/main.rs @@ -11,6 +11,11 @@ enum Command { #[clap(long, short, arg_enum)] machine: Option, }, + + Doc { + #[clap(long, short, arg_enum)] + machine: Option, + }, } #[derive(clap::ArgEnum, Debug, Clone)] @@ -34,7 +39,6 @@ fn main() -> anyhow::Result<()> { }; match machine.unwrap_or(MachineType::X86) { MachineType::X86 => { - // Used for the x86-64 variant only xshell::cmd!("cargo run --release").run()?; } MachineType::ARM => { @@ -67,6 +71,23 @@ fn main() -> anyhow::Result<()> { } } } + + Command::Doc { machine } => { + let _dir = xshell::pushd("./ableos"); + + match machine.unwrap_or(MachineType::X86) { + MachineType::X86 => { + xshell::cmd!("cargo doc --open").run()?; + } + MachineType::ARM => { + xshell::cmd!("cargo doc --open --target=json_targets/aarch64-ableos.json") + .run()?; + } + MachineType::RISCV => { + xshell::cmd!("cargo doc --open --target=riscv64gc-unknown-none-elf").run()?; + } + } + } } Ok(())