Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Alignof/carron
rv32/64imac emulator
https://github.com/Alignof/carron
emulator risc-v rust
Last synced: 4 days ago
JSON representation
rv32/64imac emulator
- Host: GitHub
- URL: https://github.com/Alignof/carron
- Owner: Alignof
- License: mit
- Created: 2021-02-09T16:25:09.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-08-26T13:09:00.000Z (3 months ago)
- Last Synced: 2024-08-26T15:27:55.917Z (3 months ago)
- Topics: emulator, risc-v, rust
- Language: Rust
- Homepage:
- Size: 2.39 MB
- Stars: 29
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# carron
[![Rust](https://github.com/Alignof/carron/actions/workflows/rust.yml/badge.svg)](https://github.com/Alignof/Carron/actions/workflows/rust.yml)
[![riscv\_tests](https://github.com/Alignof/carron/actions/workflows/riscv_tests.yml/badge.svg)](https://github.com/Alignof/carron/actions/workflows/riscv_tests.yml)
RV64IMAC emulator in rust## Feature
Carron can run **Linux** and **self-hosted binaries of [cc_sakura](https://github.com/Alignof/cc_sakura) my handmade C compiler**.
This emulator parses an ELF file that supports rv32imac/rv64imac and emulate execution environment of it.The emulator passed riscv-tests shown below.
- [x] rv32mi-p
- [x] rv32si-p
- [x] rv32ui-p
- [x] rv32ui-v
- [x] rv32um-p
- [x] rv32um-v
- [x] rv32ua-p
- [x] rv32ua-v
- [x] rv32uc-p
- [x] rv32uc-v
- [x] rv64mi-p
- [x] rv64si-p
- [x] rv64ui-p
- [x] rv64ui-v
- [x] rv64um-p
- [x] rv64um-v
- [x] rv64ua-p
- [x] rv64ua-v
- [x] rv64uc-p
- [x] rv64uc-v## Install
```zsh
git clone https://github.com/Alignof/carron.git
cd carron
cargo build --release
```## Usage
```zsh
$ ./carron --help
carron 1.1.1
n.takana
RV64IMAC emulatorUSAGE:
carron [OPTIONS] [main_args]...ARGS:
ELF file path
...OPTIONS:
Set break point as hex
-e, --elfhead Show ELF header
-p, --program Show all segments
-s, --section Show all sections
-d, --disasem Disassemble ELF
-a, --all Show all ELF data
--pk Run with proxy kernel
--pc Set entry address as hex
--break_point
--result_reg Set result register
--loglv Set log level
-h, --help Print help information
-V, --version Print version information
```### Hello World
```zsh
$ ./carron --pk $RISCV/riscv32-unknown-elf/bin/pk ./HelloWorldIn file HelloWorld
elfcheck: OKbbl loader
hello world!
```### boot Linux
```
$ git clone https://github.com/buildroot/buildroot
$ cd buildroot
$ git checkout 9b911c8
$ make spike_riscv64_defconfig
$ make menuconfig # disable F extension
$ make -j $(nproc)
$ ./carron --release -- --kernel /path/to/Image --initrd /path/to/rootfs.cpio /path/to/fw_jump.elf
In file /home/takana/riscv-toolchain/buildroot/output/images/fw_jump.elf
elfcheck: OKOpenSBI v1.2
____ _____ ____ _____
/ __ \ / ____| _ \_ _|
| | | |_ __ ___ _ __ | (___ | |_) || |
| | | | '_ \ / _ \ '_ \ \___ \| _ < | |
| |__| | |_) | __/ | | |____) | |_) || |_
\____/| .__/ \___|_| |_|_____/|____/_____|
| |
|_|......
[ 0.091080] Freeing unused kernel image (initmem) memory: 2144K
[ 0.097300] Run /init as init process
Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK
Saving 256 bits of non-creditable seed for next boot
Starting network: OKWelcome to Buildroot
buildroot login:
```