Bounded MoonBit RTOS kernel with Cortex-M3 QEMU execution, priority inheritance and IPC.
python scripts/rtos.py --scenario 1
python scripts/rtos.py --scenario 2
python scripts/rtos.py --scenario 3
python scripts/rtos.py --scenario 4
python scripts/rtos.py --scenario 5
python scripts/rtos.py --fault stack
python scripts/rtos.py --fault allocation| 场景 | 已实现行为与检查 |
|---|---|
| 1 抢占与轮转 | 三个不主动让出的忙任务轮转;高优先级任务在 tick 5 唤醒抢占;检查 R4–R11、局部值和栈底哨兵 |
| 2 优先级反转 | 低任务继承高任务优先级越过中任务,在 tick 5 释放锁;解锁后恢复基础优先级 |
| 3 采集处理流水线 | SysTick 通知采集任务,采集→处理→消费三条 MoonBit 任务,经两队列逐项验证 20 条整数消息 |
| 4 超时竞争 | 同 tick 先超时再投递中断事件;检查令牌、满队列发送超时清理和消息保留 |
| 5 压力 | 150,010 ticks,150,012 次任务身份切换,寄存器/栈检查通过,启动后分配次数不变 |
| 故障注入 | 破坏栈底触发 PANIC 72;启动后分配触发 PANIC 81,均为预期拒绝 |
moon add btlqql/moon_deadline@0.4.0let k = @rt.Kernel::new()
ignore(k.create(1, 5))
ignore(k.semaphore(0, 0, 1))
ignore(k.take(1, 0, -1)) // 阻塞
ignore(k.give(0)) // 唤醒
let selected = k.pick() // 1moon run cmd/main --target js -- examples/config-regression.json
moon check --target all --deny-warn
moon test --target js --deny-warn
moon test --target wasm --deny-warn
moon test --target wasm-gc --deny-warn
moon test --target native --deny-warn
python scripts/verify.pypub(all) struct Response {
name : String
bound : Int64
meets_deadline : Bool
iterations : Array[Int64]
}pub(all) struct Task {
name : String
cost : Int
period : Int
deadline : Int
jitter : Int
blocking : Int
}pub(all) struct TaskChange {
name : String
before_feasible : Bool
after_feasible : Bool
before_upper : Int64?
after_upper : Int64?
slack_before : Int64?
slack_after : Int64?
}Install
Download zipBounded MoonBit RTOS kernel with Cortex-M3 QEMU execution, priority inheritance and IPC.