rt-thread/bsp/qemu-riscv-virt64
Tangyuxin d724eed9fc
分离内存分配接口与内存分配算法 (#5175)
* [kernel][mem] Multiple instances of small memory allocation algorithm

* [kernel][mem] Change small memory management algorithm memory header flag

* [kernel][mem] Fix assertion problem

* [kernel][slab] Multiple instances of slab memory management algorithm

* [kernel][memheap] Remove rt_malloc/rt_free/rt_realloc and other related memory interfaces

* [kernel][mem] Clean up memory space of small memory management objects

* [kernel][kservice] Add memory application interface and thread protection interface

* [kernel][kservice] Fix function return value problem

* [kernel][memheap] Optimize memheaptrace print

* [kernel][memheap] Support best mode

* [kernel][memory] Remove semaphore lock

* [kernel][memheap] Add locked flag

* [kernel][memory] Support malloc memory in interrupt

* [kernel][memheap] Add 'memheapcheck' cmd

* [kernel][mem] Fix failure to request full memory

* [kernel][memheap] Fix compilation warning

* [kernel][mem] Fix mem realloc ASSERT

* [examples][testcases] Add small mem testcase

* [examples][mem_tc] Modify test memory size

* [examples][testcases] Add slab memory management algorithm test case

* [examples][testcases] fix small memory management algorithm test case

* [kernel][memory] Adjusting memory allocation algorithm object definition and interface

* [kernel][memory] Fix compilation warning

* [examples][utest] Fix mem test case

* [examples][utest] fix slab test case

* [utest][testcases] Shorten test time

* [kernel][memory] Formatting code

* [examples][utest] Adjust test run time

* [examples][utest] Formatting code

* [bsp] update all rtconfig.h
2021-12-16 16:23:58 +08:00
..
applications Support for running with M-Mode 2021-05-21 17:10:07 +08:00
driver [BSP] fix the compiling issue for qemu-riscv64 2021-10-19 15:00:46 +08:00
.config 分离内存分配接口与内存分配算法 (#5175) 2021-12-16 16:23:58 +08:00
Kconfig add qemu-riscv-virt64 bsp 2021-05-18 09:57:25 +08:00
README.md [bsp][qemu-riscv-virt64]add English README.md 2021-05-25 11:58:02 +08:00
README_ZH.md [bsp][qemu-riscv-virt64]add English README.md 2021-05-25 11:58:02 +08:00
SConscript add qemu-riscv-virt64 bsp 2021-05-18 09:57:25 +08:00
SConstruct Revert "Fix compiler flags issue" 2021-10-14 14:36:18 +08:00
link.lds Support for running with M-Mode 2021-05-21 17:10:07 +08:00
link_stacksize.lds Support for running with M-Mode 2021-05-21 17:10:07 +08:00
qemu-dbg.sh add qemu-riscv-virt64 bsp 2021-05-18 09:57:25 +08:00
qemu-dumpdtb.sh add qemu-riscv-virt64 bsp 2021-05-18 09:57:25 +08:00
qemu-nographic-smode.sh Support for running with M-Mode 2021-05-21 17:10:07 +08:00
qemu-nographic.sh Support for running with M-Mode 2021-05-21 17:10:07 +08:00
rtconfig.h 分离内存分配接口与内存分配算法 (#5175) 2021-12-16 16:23:58 +08:00
rtconfig.py add qemu-riscv-virt64 bsp 2021-05-18 09:57:25 +08:00

README.md

QEMU/RISCV64 VIRT BSP Introduction

中文页 | English

RISC-V is a free and open ISA enabling a new era of processor innovation through open standard collaboration. This project ported RT-Thread on QEMU RISCV64 VIRT machine.

1. Compiling

Download the cross compiler tool chain, it is recommended to use the sifive tool chain.

https://www.sifive.com/software

Select the fitting platform, we recommend Ubuntu.

Unzip the tool chain to the specified directory.

export RTT_EXEC_PATH=~/gcc/bin

Enter rt-thread/bsp/qemu-riscv-virt64 directory and input

scons

rtthread.elf and rtthread .bin files are generated.

2. Execution

The project provides two configurable operating modes for riscv64, defaults to run under M-Mode.

M-Mode

Firstly, install the qemu-system-riscv64.

sudo apt install qemu-system-misc

Then enter

./qemu-nographic.sh

You'll see Project start running

heap: [0x80035804 - 0x86435804]

 \ | /
- RT -     Thread Operating System
 / | \     4.0.4 build May 21 2021
 2006 - 2021 Copyright by rt-thread team
Hello RISC-V!
msh />

S-Mode

When running in S-Mode, configuration is via menuconfig

scons --menuconfig

Select:

RISCV qemu virt64 configs  ---> 
    [*] RT-Thread run in riscv smode

Save it and compile scons.

To get RT-Thread running in S-Mode, enable the opensbi, and then start up the RT-Thread through opensbi.

Compile qemu or downloaded premiere-version qemu that built-in opensbi, then executing ./qemu-nographic-smode.sh can get it successfully running.

The qemu installed with sudo apt install qemu-system-misc is an ordinary-version and may compile the opensbi on its own.

git clone git@github.com:riscv/opensbi.git
cd opensbi
make PLATFORM=generic CROSS_COMPILE=~/gcc/bin/riscv64-unknown-elf-

/build/platform/generic/firmware/fw_jump.elf file is generated.

Enter the following command to run:

qemu-system-riscv64 -nographic -machine virt -m 256M -kernel rtthread.bin -bios ~/opensbi/build/platform/generic/firmware/fw_jump.elf

Result is shown as follows:

OpenSBI v0.9
   ____                    _____ ____ _____
  / __ \                  / ____|  _ \_   _|
 | |  | |_ __   ___ _ __ | (___ | |_) || |
 | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | |
 | |__| | |_) |  __/ | | |____) | |_) || |_
  \____/| .__/ \___|_| |_|_____/|____/_____|
        | |
        |_|

Platform Name             : riscv-virtio,qemu
Platform Features         : timer,mfdeleg
.
.
.
Boot HART ISA             : rv64imafdcsu
Boot HART Features        : scounteren,mcounteren
Boot HART PMP Count       : 16
Boot HART PMP Granularity : 4
Boot HART PMP Address Bits: 54
Boot HART MHPM Count      : 0
Boot HART MHPM Count      : 0
Boot HART MIDELEG         : 0x0000000000000222
Boot HART MEDELEG         : 0x000000000000b109
heap: [0x80235a58 - 0x86635a58]

 \ | /
- RT -     Thread Operating System
 / | \     4.0.4 build May 21 2021
 2006 - 2021 Copyright by rt-thread team
Hello RISC-V!
msh />

3. Condition

Driver Condition Remark
UART Support UART0
PLIC Support -
CLIC Support -