A preemptive real-time operating system for RISC-V.
Named after the New Zealand alpine parrot known for dismantling anything poorly engineered and being an absolute menace.
Kea is a minimal RTOS targeting RV64 that runs on QEMU's virt machine. It does preemptive multitasking with round-robin scheduling, spinlocks via the RISC-V A extension, counting semaphores, and UART output. It does not do dynamic memory allocation, because dynamic memory allocation is where determinism goes to die.
The entire kernel fits in your head. If it doesn't, the kernel is too big.
RISC-V 64-bit (rv64imac). Tested on QEMU virt machine. If you want to run it on real hardware, you're braver than I am and I wrote the thing.
You need riscv64-unknown-elf-gcc and qemu-system-riscv64. On Ubuntu:
sudo apt install gcc-riscv64-unknown-elf qemu-system-riscv64
Then:
make clean && make && make run
QEMU exits with Ctrl-A then X. If you forget this, you live there now.
Kea RTOS v0.1
target: rv64imac
machine: qemu-virt
malloc: no
bloat: also no
tasks: 2 created
timer: armed
test: spinlock counter (2 x 0x2710 = 0x4e20 expected)
sched: go
Two tasks each increment a shared counter 10,000 times under a spinlock. The final count is 20,000. If it isn't, something has gone cosmically wrong and you should probably check for nearby black holes.
All identifiers follow HLASM style because mainframe naming conventions are the pinnacle of human achievement and I will not be taking questions. Types are DSECT-style (TCBLK, CTXBLK, SPNLCK, SEMBLK), fields are DS-style (SAVREGS, SAVMEPC, TSTATE), functions are entry point labels (SCHRUN, TSKCRT, TRPENT, SPNACQ). If you've worked on z/OS this will feel like home. If you haven't, it builds character. If you're asking "what's z/OS?" give yourself an uppercut.
I built this a while back when I was in the middle of adding some zCOBOL macros for the z390 project and I was interested in making my own Operating system at the time. I was also looking to mess around with some embedded stuff. Since BarraCUDA picked up some attention I figured I'd start releasing more of my projects publicly. I've got a few sitting around gathering dust and they deserve better than my hard drive.
Apache 2.0. See LICENSE for the full text.