https://github.com/systemxlabs/rust-to-riscv-asm
A bare metal program example about how to convert Rust code to RISC-V assembly.
https://github.com/systemxlabs/rust-to-riscv-asm
assembly bare-metal risc-v rust
Last synced: about 2 months ago
JSON representation
A bare metal program example about how to convert Rust code to RISC-V assembly.
- Host: GitHub
- URL: https://github.com/systemxlabs/rust-to-riscv-asm
- Owner: systemxlabs
- Created: 2024-12-06T06:47:42.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2024-12-08T06:11:41.000Z (6 months ago)
- Last Synced: 2025-03-27T14:54:59.701Z (2 months ago)
- Topics: assembly, bare-metal, risc-v, rust
- Language: Rust
- Homepage:
- Size: 241 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# rust-to-riscv-asm
A bare metal program example about how to convert rust code to RISC-V assembly.## Get started
### Generate assembly
Only need install rust toolchain
```shell
# build the project
make build
# output asm to a file
make asm > output
```
### Run example on qemu
Need install qemu
```shell
# Unbuntu
sudo apt install qemu-system-riscv64
# MacOS
brew install qemu
```Run
```shell
make run
```
output
```
Hello, world!
inited heap: [0x80c09000, 0xc0c09000)
1 + 2 = 3
```## Another way: Compiler Explorer site
1.Open site: https://rust.godbolt.org/2.Add `--target riscv64gc-unknown-linux-gnu` to compiler options
