A minimal RTOS for Raspberry Pi written in C and ARM assembly.
Runs tasks with basic context switching. Built for learning and fun.
- Bare-metal kernel that runs on
qemu(to be tested on hardware) - Basic cross-platform architecture: ARCHITECTURE.md
- Basic scheduling, context switching
makeFor now the user can modify user/main.c to run their code.
Example snippet:
#include "smvrt.h"
int count = 0;
void producer() {
if (count < 2) {
smvrt_print("producing...\n");
for (volatile int i = 0; i < 100000; i++)
;
count++;
}
}
void consumer() {
if (count > 0) {
smvrt_print("consuming...\n");
for (volatile int i = 0; i < 100000000; i++)
;
count--;
}
}
void main() {
smvrt_scheduler_add(producer);
smvrt_scheduler_add(consumer);
smvrt_scheduler_run();
}Currently, the Makefile doesn't have any customization. This is a TODO.
Copy smvrt.img onto your SD card's boot partition.Boot into your Raspberry Pi.
Note: Currently, code has only been tested in a hypervisor.
sudo pacman -S qemu-arch-extra # if not installed
make # build smvrt.img
make runCurrently, the interface is only tested on a hypervisor.
