All Projects → rustsbi → rustsbi-qemu

rustsbi / rustsbi-qemu

Licence: other
QEMU platform SBI support implementation, using RustSBI

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to rustsbi-qemu

rustsbi
RISC-V Supervisor Binary Interface (RISC-V SBI) implementation in Rust; runs on M-mode; good support for embedded Rust ecosystem
Stars: ✭ 362 (+828.21%)
Mutual labels:  sbi, rustsbi, sbi-specification
NMSIS
Nuclei Microcontroller Software Interface Standard Development Repo
Stars: ✭ 24 (-38.46%)
Mutual labels:  embedded, risc-v
Tock
A secure embedded operating system for microcontrollers
Stars: ✭ 3,258 (+8253.85%)
Mutual labels:  embedded, risc-v
bx-github-ci
This tutorial provides one example on how a CI (Continuous Integration) workflow with the IAR Build Tools for Linux can be set up on GitHub. The IAR Build Tools on Linux are available for Arm, RISC-V and Renesas (RH850, RL78 and RX).
Stars: ✭ 20 (-48.72%)
Mutual labels:  embedded, risc-v
Eclipse Plugins
The Eclipse Embedded CDT plug-ins for Arm & RISC-V C/C++ developers (formerly known as the GNU MCU Eclipse plug-ins). Includes the archive of previous plug-ins versions, as Releases.
Stars: ✭ 507 (+1200%)
Mutual labels:  embedded, risc-v
Platformio Core
PlatformIO is a professional collaborative platform for embedded development 👽 A place where Developers and Teams have true Freedom! No more vendor lock-in!
Stars: ✭ 5,539 (+14102.56%)
Mutual labels:  embedded, risc-v
mdepx
MDEPX — A BSD-style RTOS
Stars: ✭ 17 (-56.41%)
Mutual labels:  embedded, risc-v
pydevmem
Python interface to /dev/mem
Stars: ✭ 41 (+5.13%)
Mutual labels:  embedded
Sub-IoT-Stack
Sub-IoT: Open Source Stack for Dash7 Alliance Protocol
Stars: ✭ 123 (+215.38%)
Mutual labels:  embedded
CML
Fast, safe and easy to use Cortex-M HAL Library, written in C++ 17
Stars: ✭ 17 (-56.41%)
Mutual labels:  embedded
arv
ARV: Asynchronous RISC-V Go High-level Functional Model
Stars: ✭ 18 (-53.85%)
Mutual labels:  risc-v
NuttX
Official micro-ROS RTOS
Stars: ✭ 63 (+61.54%)
Mutual labels:  embedded
embLua
Lua for microcontrollers
Stars: ✭ 23 (-41.03%)
Mutual labels:  embedded
xtrix
xtrix OS repo
Stars: ✭ 23 (-41.03%)
Mutual labels:  embedded
ria-jit
Lightweight and performant dynamic binary translation for RISC–V code on x86–64
Stars: ✭ 38 (-2.56%)
Mutual labels:  risc-v
EmbeddedScrollView
Embedded UIScrollView for iOS.
Stars: ✭ 55 (+41.03%)
Mutual labels:  embedded
kocherga
Robust platform-agnostic Cyphal/DroneCAN bootloader for deeply embedded systems
Stars: ✭ 21 (-46.15%)
Mutual labels:  embedded
kalman-clib
Microcontroller targeted C library for Kalman filtering
Stars: ✭ 43 (+10.26%)
Mutual labels:  embedded
adskalman-rs
Kalman filter implementation in Rust
Stars: ✭ 22 (-43.59%)
Mutual labels:  embedded
orange-pi
Orange pi Kicad libraries and footprints.
Stars: ✭ 13 (-66.67%)
Mutual labels:  embedded

QEMU support from RustSBI

RustSBI is designed as a library to craft a bootable binary or ELF file. However, QEMU provides us a way to load ELF file and implement simple SBI directly, thus RustSBI provides a bootable ELF file for this platform.

Try it out!

Compile and run with:

cargo qemu

When running cargo qemu, the test kernel will build and run. Expected output should be:

[rustsbi] RustSBI version 0.2.2, adapting to RISC-V SBI v1.0.0
.______       __    __      _______.___________.  _______..______   __
|   _  \     |  |  |  |    /       |           | /       ||   _  \ |  |
|  |_)  |    |  |  |  |   |   (----`---|  |----`|   (----`|  |_)  ||  |
|      /     |  |  |  |    \   \       |  |      \   \    |   _  < |  |
|  |\  \----.|  `--'  |.----)   |      |  |  .----)   |   |  |_)  ||  |
| _| `._____| \______/ |_______/       |__|  |_______/    |______/ |__|

[rustsbi] Implementation: RustSBI-QEMU Version 0.1.1
[rustsbi-dtb] Hart count: cluster0 with 8 cores
[rustsbi] misa: RV64ACDFIMSU
[rustsbi] mideleg: ssoft, stimer, sext (0x222)
[rustsbi] medeleg: ima, ia, bkpt, la, sa, uecall, ipage, lpage, spage (0xb1ab)
[rustsbi] pmp0: 0x10000000 ..= 0x10001fff (rw-)
[rustsbi] pmp1: 0x2000000 ..= 0x200ffff (rw-)
[rustsbi] pmp2: 0xc000000 ..= 0xc3fffff (rw-)
[rustsbi] pmp3: 0x80000000 ..= 0x8fffffff (rwx)
[rustsbi] enter supervisor 0x80200000
<< Test-kernel: Hart id = 0, DTB physical address = 0x87000000
>> Test-kernel: Testing base extension
<< Test-kernel: Base extension version: 1
<< Test-kernel: SBI specification version: 1.0
<< Test-kernel: SBI implementation Id: 4
<< Test-kernel: SBI implementation version: 202
<< Test-kernel: Device mvendorid: 0
<< Test-kernel: Device marchid: 0
<< Test-kernel: Device mimpid: 0
>> Test-kernel: Testing SBI instruction emulation
<< Test-kernel: Current time: d78c9
<< Test-kernel: Time after operation: da00f
>> Test-kernel: Trigger illegal exception
<< Test-kernel: Value of scause: Exception(IllegalInstruction)
<< Test-kernel: Illegal exception delegate success
>> Stop hart 3, return value 0
>> Hart 0 state return value: 0
>> Hart 1 state return value: 4
>> Hart 2 state return value: 4
>> Hart 3 state return value: 1
>> Hart 4 state return value: 0
<< Test-kernel: test for hart 0 success, wake another hart
>> Wake hart 1, sbi return value 0
>> Start test for hart 1, retentive suspend return value 0
>> Wake hart 2, sbi return value 0
<< The parameter passed to hart 2 resume is: 0x4567890a
>> Start hart 3 with parameter 0x12345678
>> SBI return value: 0
<< The parameter passed to hart 3 start is: 0x12345678
<< Test-kernel: All hart SBI test SUCCESS, shutdown

Run test kernel

Requirements

You should have cargo-binutils and llvm-tools-preview installed.

cargo install cargo-binutils
rustup component add llvm-tools-preview

Run

Run with:

cargo test

It will run RustSBI-QEMU with a test kernel. The test kernel will test all SBI functions, its command emulation and other features. If it succeeds, there would be output like:

running 1 test
    Finished dev [unoptimized + debuginfo] target(s) in 0.14s
   Compiling test-kernel v0.1.0 (D:\RustProjects\rustsbi-qemu\test-kernel)
    Finished dev [unoptimized + debuginfo] target(s) in 0.61s
test run_test_kernel ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 2.31s

Notes

  1. What kind of kernel does this project support?

The rustsbi-qemu project supports raw binary kernels for educational or competition use. This project itself is only a showcase example illustrating how implementations should use RustSBI, it does not include a Linux boot support. You may visit downstream bootloader projects for a Linux capable bootloader.

  1. How to enable hypervisor H extension on QEMU?

You should use these following line of parameters:

    command.args(&["-cpu", "rv64,x-h=true"]);

... to enable H extension on QEMU software.

License

This project is licensed under Mulan PSL v2.

Copyright (c) 2021-2022 RustSBI Team
RustSBI-QEMU is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
         http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].