/luxos

A Lua operating system.

Primary LanguageZigBSD Zero Clause License0BSD

Luxos

A toy RISC-V operating system written in Zig and Lua, that runs Lua scripts as userspace programs.

Luxos is licensed under the 0BSD (BSD 0-clause) license, see LICENSE.

The files in deps and inspiration are under their own licenses - see those directories for more information.

The name "Luxos" is just a mutation of "LuaOS".

Status

I'm using this project as an excuse to write startup and peripheral code for the FE310-G002 (the SoC on the HiFive1 Rev B) from scratch, as well as the rest of the operating system.

I am currently working on getting the Lua core running. The short-term goal is to get a Lua state successfully initialised (without any libraries/modules for now) and a REPL available over UART.

The FE310-G002 has only 16 KiB of data RAM which is almost certainly not enough to do much interesting in Lua, so I will probably end up switching to running in QEMU with a RV64GC CPU. Once I get Lua running then we will see how far I can get with it.

Building and flashing

Currently targets only the HiFive1 Rev B board.

  1. Connect board to PC.
  2. Start J-Link GDB server with ./start-gdb-server.sh.
  3. zig build debug to build kernel, start ugdb, and connect to the GDB server.
  4. To flash the kernel to the board, use load in GDB. Whenever the kernel is rebuilt, you can run !reload to reload the file from disk, then load again to flash the updated kernel.

Inspirations