arch/riscv/qemu-rv: replace M-mode init code with SBI in kernel build

The qemu-rv use a small init code for M mode in kernel build.
It is hard-coding and is difficult to change. Due to the fact,
introduce a already mature SBI implement (e.g OpenSBI) to
replace existing code is a better choice.

This patch introduce some change for qemu-rv:
1. use SSTC to provide time interrupt in kernel build
2. remove uncessary M mode trap.

For simplicity, this patch does not add support for booting
nuttx for any core, but force boot core to start core 0 and
let core 0 do the initialization.

Signed-off-by: Inochi Amaoto <inochiama@outlook.com>
This commit is contained in:
Inochi Amaoto
2024-04-18 19:13:27 +08:00
committed by Alan Carvalho de Assis
parent 3cabc92427
commit 49b3f52db1
19 changed files with 102 additions and 370 deletions
@@ -65,6 +65,8 @@ And, for 64-bit configurations::
$ qemu-system-riscv64 -semihosting -M virt,aclint=on -cpu rv64 -smp 8 -bios none -kernel nuttx -nographic
If testing with kernel build, remove the ``-bios none`` option. Kernel build
requires SBI to function properly.
citest
------
@@ -135,7 +137,7 @@ To run it with QEMU, use the following command::
-device virtio-net-device,netdev=u1,bus=virtio-mmio-bus.2 \
-drive file=./mydisk-1gb.img,if=none,format=raw,id=hd \
-device virtio-blk-device,bus=virtio-mmio-bus.3,drive=hd \
-bios none -kernel ./nuttx/nuttx -nographic
-kernel ./nuttx/nuttx -nographic
knetnsh64_smp
-------------
@@ -198,7 +200,7 @@ A ROMFS image is generated and linked to the kernel. This requires re-running ``
To run it, use the following command::
$ qemu-system-riscv32 -M virt,aclint=on -cpu rv32 -smp 8 -bios none -kernel nuttx -nographic
$ qemu-system-riscv32 -M virt,aclint=on -cpu rv32 -smp 8 -kernel nuttx -nographic
In `nsh`, applications can be run from the `/system/bin` directory::