Skip to content

kern-crates/sparreal-os

 
 

Repository files navigation

雀实操作系统 Sparreal

麻雀虽小,五脏俱全的实时操作系统。

环境搭建

git clone --recurse-submodules  [email protected]:qclic/sparreal-os.git
  1. 安装 Rust
  2. 安装依赖
cargo install cargo-binutils
rustup component add llvm-tools-preview
rustup component add rust-src

Windows

安装Qemu, 并加入环境变量。

Linux

安装Qemu

Mac

安装Qemu

构建

cargo xtask build

Qemu 测试

cargo xtask qemu

Qemu + Vscode 断点调试

cargo xtask qemu -d

vscode 选择调试配置 KDebug, 点击 Run and Debug 按钮。

U-Boot 调试

需要连接开发板串口。

cargo xtask uboot

配置

首次执行 xtask 任务后,会在根目录生成默认配置文件 .project.toml

平台适配

  1. 实现平台接口
  2. 初始化页表,启动MMU。
  3. 启动内核
use sparreal_kernel::platform::Platform;
use sparreal_macros::api_impl;

pub struct PlatformImpl;

// 实现接口
#[api_impl]
impl Platform for PlatformImpl {
    unsafe fn wait_for_interrupt() {
        aarch64_cpu::asm::wfi();
    }
    ... other fn
}
pub use sparreal_kernel::*;

// 启动MMU,并进入函数
unsafe fn boot(kconfig: kernel::KernelConfig) -> ! {
    // 初始化日志和内存分配器。
    kernel::init_log_and_memory(&kconfig);
    // 注册驱动
    kernel::driver_register_append(drivers::registers());
    // 启动内核
    kernel::run()
}
``

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 97.1%
  • Assembly 2.9%