Skip to content

A bare metal program example about how to convert Rust code to RISC-V assembly.

Notifications You must be signed in to change notification settings

systemxlabs/rust-to-riscv-asm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

# build the project
make build
# output asm to a file
make asm > output

Run example on qemu

Need install qemu

# Unbuntu
sudo apt install qemu-system-riscv64
# MacOS
brew install qemu

Run

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

About

A bare metal program example about how to convert Rust code to RISC-V assembly.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published