1
0
Fork 0
This repository has been archived on 2022-12-02. You can view files and clone it, but cannot push or open issues or pull requests.
riscv-opensbi-hello/README.md

21 lines
990 B
Markdown
Raw Permalink Normal View History

2021-07-25 19:11:23 +00:00
# example-os
2021-07-26 12:54:14 +00:00
An example bare bones OS template for RISC-V.
2021-07-25 19:50:05 +00:00
2021-07-25 20:05:44 +00:00
## Build instructions
2021-07-26 12:54:14 +00:00
Install [the Newlib GNU RISC-V toolchain](https://github.com/riscv/riscv-gnu-toolchain#installation-newlib) and do `make` to build. Do `make run` to run. It should print out a bunch of debug information related to OpenSBI and then a single `a`.
Alternatively, you can install Clang and use `make CC=clang`.
2021-07-25 20:05:44 +00:00
2021-07-25 20:07:02 +00:00
## Exiting QEMU
This is the new "how to exit Vi" I guess. To exit, press <kbd>Ctrl</kbd>+<kbd>a</kbd>, unpress those keys, and then press <kbd>x</kbd>.
2021-07-25 20:07:02 +00:00
2021-07-25 20:05:44 +00:00
## Debugging
2021-07-25 20:26:52 +00:00
Execute `make gdb` and then `make run`.
2021-07-25 20:05:44 +00:00
2021-07-26 12:54:14 +00:00
If you'd like to trace the execution since the beginning, use `make run WAIT_GDB=1`. This halts the emulator until a gdb connection is established.
2021-07-25 20:05:44 +00:00
2021-07-25 19:50:05 +00:00
## Resources
- [OpenSBI docs](https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.adoc)
- [RISC-V specs](https://riscv.org/technical/specifications/)
- [RISC-V assembly tutorial](https://riscv-programming.org/book/riscv-book.html)