{"id":16829676,"url":"https://github.com/rtfb/riscv-hobby-os","last_synced_at":"2025-03-22T04:30:33.193Z","repository":{"id":40510976,"uuid":"307828540","full_name":"rtfb/riscv-hobby-os","owner":"rtfb","description":null,"archived":false,"fork":false,"pushed_at":"2024-06-26T14:56:52.000Z","size":765,"stargazers_count":28,"open_issues_count":2,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-15T15:54:35.652Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rtfb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-10-27T21:09:35.000Z","updated_at":"2025-03-03T15:17:42.000Z","dependencies_parsed_at":"2023-09-24T11:49:42.671Z","dependency_job_id":"31de6445-81ac-4804-9d44-f7ec040a9e13","html_url":"https://github.com/rtfb/riscv-hobby-os","commit_stats":null,"previous_names":["rtfb/riscv-hobby-os"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtfb%2Friscv-hobby-os","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtfb%2Friscv-hobby-os/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtfb%2Friscv-hobby-os/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtfb%2Friscv-hobby-os/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rtfb","download_url":"https://codeload.github.com/rtfb/riscv-hobby-os/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244907420,"owners_count":20529850,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T11:35:06.773Z","updated_at":"2025-03-22T04:30:32.826Z","avatar_url":"https://github.com/rtfb.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RISC-V Hobby OS\n\n[![CI][ci-badge]](https://github.com/rtfb/riscv-hobby-os/actions/workflows/maketest.yml)\n\nThis is a small hobbyist kernel for RISC-V. It doesn't try to be compatible with\nanything, but happens to go along the old Unix ways. It does preemptive\nmultitasking, implements fork+exec system calls, and a bunch of others needed\nfor implementation of a simple shell. It also implements pipes.\n\nIt runs in qemu, as well as several physical RISC-V SBC boards:\n* [SiFive HiFive1 Rev B][hifive-url]\n* [Ox64][ox64-url]\n* [Nezha D1][d1-url]\n* [Pine64 Star64][star64-url]\n\nBuilding And Running\n====================\n\nOn Ubuntu, `make prereqs` will install the prerequisite software for building.\n\n`make build-qemu-image` will build a Docker image for running qemu. This\nsimplifies running qemu on different versions of Ubuntu and on OSX.\n\nWith that done, you should be able to `make all` to build all targets, and then\n`make run-virt` to actually run it in qemu.\n\nImplementation Details\n======================\n\nThe kernel and userland programs are built into a single binary. So the userland\nprograms are actually just functions, located in a separate memory section. The\nsection is isolated from the kernel memory, though, via RISC-V PMP mechanism.\n\nOn some targets the kernel supports virtual memory, and in such case the\nprocesses are better isolated. See [`docs/mmu.md`][docs-mmu] for details.\n\nSome other targets do not implement virtual memory. This is because the smallest\ncommon denominator of supported hardware is an extremely small HiFive\nmicrocontroller, with only 16kB of RAM and no MMU. This puts severe limitations.\nWe want to maintain an ability to run in such small environments, as we intend\nto use this kernel on a small implementation of a RISC-V core on a modestly\nsized FPGA.\n\nDebugging with gdb\n------------------\n\n#### Qemu\n\n1. Obtain gdb ([`docs/gdb.md`][docs-gdb]).\n2. Run as usual with an extra `DBG=1` argument, e.g. `make run-virt DBG=1`.\n3. In a separate terminal, run `make gdb`. Gdb will connect to the above, and\n   you can use it as usual.\n\nMore Docs\n=========\n\nThe [`docs/`][docs-folder] folder contains a few documents on specific narrow\nsubjects, like operating a specific SBC board.\n\nHandy RISC-V Quick References:\n* [RISC-V Assembly Cheat Sheet][riscv-asm-sheet]\n* [RISC-V Assembly Programmer's Manual][riscv-asm-man]\n* [SiFive U (SiFive Freedom U540-C000 SoC) Hardware Manual][sifive-u]\n* [SiFive E (SiFive Freedom U310-G002 SoC) Hardware Manual][sifive-e]\n\n[ci-badge]: https://github.com/rtfb/riscv-hobby-os/actions/workflows/maketest.yml/badge.svg\n[riscv-asm-sheet]: https://github.com/jameslzhu/riscv-card/blob/master/riscv-card.pdf\n[riscv-asm-man]: https://github.com/riscv/riscv-asm-manual/blob/master/riscv-asm.md\n[sifive-u]: https://static.dev.sifive.com/FU540-C000-v1.0.pdf\n[sifive-e]: https://sifive.cdn.prismic.io/sifive%2F59a1f74e-d918-41c5-b837-3fe01ba7eaa1_fe310-g002-manual-v19p05.pdf\n\n[d1-url]: https://d1.docs.aw-ol.com/en/d1_dev/\n[hifive-url]: https://www.sifive.com/boards/hifive1-rev-b\n[ox64-url]: https://wiki.pine64.org/wiki/Ox64\n[star64-url]: https://wiki.pine64.org/wiki/STAR64\n\n[docs-folder]: https://github.com/rtfb/riscv-hobby-os/tree/master/docs\n[docs-gdb]: https://github.com/rtfb/riscv-hobby-os/tree/master/docs/gdb.md\n[docs-mmu]: https://github.com/rtfb/riscv-hobby-os/tree/master/docs/mmu.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frtfb%2Friscv-hobby-os","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frtfb%2Friscv-hobby-os","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frtfb%2Friscv-hobby-os/lists"}