Skip to content

euphoric-hardware/baremetal-rust-riscv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

riscv-rust-baremetal

Rust example that compiles to baremetal riscv. Supports HTIF to communicate with host and perform proxy syscalls.

Quick start

Edit the configuration at .cargo/config.toml.

rustup target add riscv64gc-unknown-none-elf
cargo build

To run a specific benchmark (Requires Spike):

cargo run --bin bin-name

You can also run cargo with specific configuration with the --config flag. Example:

rustup target add riscv32imac-unknown-none-elf
cargo --config 'build.target="riscv32imac-unknown-none-elf"' \
    --config 'target.riscv32imac-unknown-none-elf.linker="riscv32-unknown-elf-ld"' \
    r --bin median --release

TODO

Ideas

  • Share rust code/interface with fesvr for syscalls
  • Would be cool to debug with gdb using openocd: https://docs.rust-embedded.org/book/start/hardware.html
  • Better cargo commands (cargo run with spike -d, build options, specify targets...)
  • Improve organization, HTIF as its own package?
  • HAL / board config? IDK how hardware works
  • What should be the init assembly and linker scripts? Copy from other projects? minimal? HW dependent?
    • Not sure what zeroing registers and other magic does

Benchmarks

  • Port benchmarks from riscv tests
  • Cycles should be similar?

Resources

HTIF implementations:

Rust:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published