Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ringtailsoftware/zig-minirv32
Zig RISC-V32 emulator with Linux and baremetal examples
https://github.com/ringtailsoftware/zig-minirv32
emulator linux risc-v zig
Last synced: 19 days ago
JSON representation
Zig RISC-V32 emulator with Linux and baremetal examples
- Host: GitHub
- URL: https://github.com/ringtailsoftware/zig-minirv32
- Owner: ringtailsoftware
- Created: 2023-02-15T12:03:08.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-12-14T14:11:22.000Z (28 days ago)
- Last Synced: 2024-12-18T09:09:55.660Z (24 days ago)
- Topics: emulator, linux, risc-v, zig
- Language: Zig
- Homepage:
- Size: 6.6 MB
- Stars: 32
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-zig - ringtailsoftware/zig-minirv32 - V emulator with Linux and baremetal examples (Emulators / Zigged Project)
README
# zig-minirv32ima
Toby Jaffey https://mastodon.me.uk/@tobyjaffey
A pure zig port of https://github.com/cnlohr/mini-rv32ima
Blog posts documenting some of this:
- https://www.ringtailsoftware.co.uk/zig-rv32/
- https://www.ringtailsoftware.co.uk/zig-baremetal/Tested with `zig 0.13.0`
![](demo.gif)
# Build emulator
zig build && ./zig-out/bin/zigrv32ima linux.bin
Type ctrl-`a` then `x` to exit.
# Samples
## `samples/hello`
Minimal "Hello world" in zig
cd samples/hello
zig build
../../zig-out/bin/zigrv32ima zig-out/bin/hello.bin## `samples/shell`
Interactive shell (https://github.com/ringtailsoftware/zig-embshell/)
cd samples/shell
zig build
../../zig-out/bin/zigrv32ima zig-out/bin/shell.bin## `samples/mandelbrot`
ASCII mandelbrot set
cd samples/mandelbrot
zig build
../../zig-out/bin/zigrv32ima zig-out/bin/mandelbrot.bin# Notes
## Testing with qemu
qemu-system-riscv32 -machine virt -nographic -bios foo.bin
## Libc usage
libc is linked for access to the raw terminal. To remove, comment out `lib.linkSystemLibraryName("c");` in `build.zig`.
The `term` struct could be replaced by this minimal stub:const term = struct {
pub fn init() void {
}
pub fn getch() ?u8 {
return null;
}
};