11 releases (4 breaking)

Uses new Rust 2024

0.9.3 Jun 27, 2025
0.9.0 Mar 23, 2025
0.0.5 Nov 5, 2024

#79 in #qemu

Download history 52/week @ 2025-07-20 46/week @ 2025-07-27 142/week @ 2025-08-03 60/week @ 2025-08-10 55/week @ 2025-08-17 138/week @ 2025-08-24 127/week @ 2025-08-31 41/week @ 2025-09-07 62/week @ 2025-09-14 81/week @ 2025-09-21 48/week @ 2025-09-28 35/week @ 2025-10-05 52/week @ 2025-10-12 102/week @ 2025-10-19 53/week @ 2025-10-26 43/week @ 2025-11-02

254 downloads per month
Used in 8 crates (3 directly)

MIT license

15KB
396 lines

雀实操作系统 Sparreal

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

环境搭建

git clone --recurse-submodules  git@github.com:qclic/sparreal-os.git
  1. 安装 Rust
  2. 安装依赖
cargo install ostool

Windows

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

Linux

安装Qemu

Mac

安装Qemu

构建

ostool build

Qemu 测试

ostool run qemu

Qemu + Vscode 断点调试

ostool run qemu -d

windows

msys2 安装 gdb-multiarch, 并添加到 PATH

pacman -S mingw-w64-ucrt-x86_64-toolchain

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

U-Boot 调试

需要连接开发板串口。

ostool run uboot

配置

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

平台适配

  1. 实现平台接口
  2. 启动内核
use sparreal_kernel::platform_if::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
}

Dependencies

~0.5–1MB
~21K SLoC