Building a real time OS in C++, from scratch
summary
A small real-time OS named Soros runs on a RISC‑V core beside a 6502 on an FPGA, boots to running threads in ~50 ms (under 10 ms after FPGA config) and drives USB/SD via a separate 32‑bit CPU to host Apple II disk images. The code implements preemptive context switches by saving full register state for IRQs and only callee‑saved registers for cooperative switches, uses a CSR read template for compile‑time CSR access, a fixed_string literal for thread names, and prints full register dumps on traps.
AI-written summary · about
chapters (13)
- 0:00Introduction and project overview
- 7:11Toolchain and compiler setup
- 8:57Boot sequence and startup code
- 12:33Application Binary Interface basics
- 20:56Linker scripts and memory sections
- 26:43Handling linker script errors
- 28:11Threading and context switching
- 34:33Preemptive vs cooperative scheduling
- 37:05Interrupt handling in real-time OS
- 41:07Live demo and system debugging
- 46:51Trap handler and error reporting
- 51:02CSR registers and inline assembly
- 58:03Optimization and code readability
