Skip to content

Commit a6df439

Browse files
authored
Merge pull request #4924 from GuEe-GUI/master
[bsp/virt64/aarch64]添加qemu-virt64-aarch64平台
2 parents 5e277b0 + ab47a8f commit a6df439

File tree

28 files changed

+1899
-5
lines changed

28 files changed

+1899
-5
lines changed

bsp/qemu-virt64-aarch64/.config

Lines changed: 583 additions & 0 deletions
Large diffs are not rendered by default.

bsp/qemu-virt64-aarch64/Kconfig

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
mainmenu "RT-Thread Project Configuration"
2+
3+
config BSP_DIR
4+
string
5+
option env="BSP_ROOT"
6+
default "."
7+
8+
config RTT_DIR
9+
string
10+
option env="RTT_ROOT"
11+
default "../../"
12+
13+
config PKGS_DIR
14+
string
15+
option env="PKGS_ROOT"
16+
default "packages"
17+
18+
source "$RTT_DIR/Kconfig"
19+
source "$PKGS_DIR/Kconfig"
20+
21+
config SOC_VIRT64_AARCH64
22+
bool
23+
select ARCH_ARM_CORTEX_A53
24+
select ARCH_CPU_64BIT
25+
select RT_USING_COMPONENTS_INIT
26+
select RT_USING_USER_MAIN
27+
select BSP_USING_GIC
28+
select RT_USING_GIC
29+
select BSP_USING_GIC390
30+
select RT_USING_RTC
31+
default y
32+
33+
source "$BSP_DIR/driver/Kconfig"

bsp/qemu-virt64-aarch64/README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# QEMU/AArch64 VIRT BSP Introduction
2+
3+
[中文页](README_zh.md) | English
4+
5+
## 1. Introduction
6+
7+
The AArch64 execution state was introduced with the ARMv8 ISA for machines executing A64 instructions. This project ported RT-Thread on QEMU AArch64 VIRT machine.
8+
9+
## 2. Compiling
10+
11+
Usage ARM Developer GNU ToolChain, it support Linux and Windows:
12+
```
13+
https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads/
14+
```
15+
Download the `xxx-aarch64-none-elf` of x86_64 hosted platform,set the `RTT_EXEC_PATH` is system environment after decompress the binary.
16+
17+
Enter directory `rt-thread/bsp/qemu-virt64-aarch64` and input:
18+
```
19+
scons
20+
```
21+
22+
## 2. Execution
23+
24+
The project execution tool is `qemu-system-aarch64`
25+
26+
Download Windows platform from website:
27+
```
28+
https://www.qemu.org/download/
29+
```
30+
On Linux platform (Ubuntu, Deepin and so on), install QEMU by apt.
31+
```
32+
sudo apt update
33+
sudo apt install qemu-system-arm
34+
```
35+
36+
Run qemu.bat or qemu.sh in terminal:
37+
```
38+
heap: [0x40042aa0 - 0x40142aa0]
39+
40+
\ | /
41+
- RT - Thread Operating System
42+
/ | \ 4.0.4 build Aug 6 2021
43+
2006 - 2021 Copyright by rt-thread team
44+
Hi, this is RT-Thread!!
45+
msh />
46+
```
47+
48+
## 3. Condition
49+
50+
| Driver | Condition | Remark |
51+
| ------ | --------- | ------ |
52+
| UART | Support | UART0 |
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# QEMU/AArch64 VIRT板级支持包说明
2+
3+
中文页 | [English](README.md)
4+
5+
## 1. 简介
6+
7+
AArch64是一种采用ARMv8 ISA,用于执行A64指令的机器的64位执行模式。本工程是在QEMU的AArch64 VIRT版本上进行的一份移植。
8+
9+
## 2. 编译说明
10+
11+
建议使用ARM Developer GNU交叉编译工具链,目前支持Linux/Windows平台:
12+
```
13+
https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads/
14+
```
15+
下载x86_64 Hosted平台下载对应的`xxx-aarch64-none-elf`二进制包,解压后设置`RTT_EXEC_PATH`环境变量为该编译器的bin目录下即可。
16+
17+
进入到`rt-thread/bsp/qemu-virt64-aarch64`目录进行输入:
18+
```
19+
scons
20+
```
21+
可以看到正常生成`rtthread.elf``rtthread.bin`文件。
22+
23+
## 3. 执行
24+
25+
本工程执行环境为`qemu-system-aarch64`模拟器
26+
27+
Windows平台下,可以在此获取到QEMU:
28+
```
29+
https://www.qemu.org/download/
30+
```
31+
Linux平台下,以Ubuntu、Deepin系列发行版为例,可通过该命令安装QEMU:
32+
```
33+
sudo apt update
34+
sudo apt install qemu-system-arm
35+
```
36+
37+
在终端执行qemu.bat或qemu.sh可以看到程序运行:
38+
```
39+
heap: [0x40042aa0 - 0x40142aa0]
40+
41+
\ | /
42+
- RT - Thread Operating System
43+
/ | \ 4.0.4 build Aug 6 2021
44+
2006 - 2021 Copyright by rt-thread team
45+
Hi, this is RT-Thread!!
46+
msh />
47+
```
48+
49+
## 4.支持情况
50+
51+
| 驱动 | 支持情况 | 备注 |
52+
| ------ | ---- | :------: |
53+
| UART | 支持 | UART0 |

bsp/qemu-virt64-aarch64/SConscript

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# for module compiling
2+
import os
3+
from building import *
4+
5+
cwd = GetCurrentDir()
6+
objs = []
7+
list = os.listdir(cwd)
8+
9+
for d in list:
10+
path = os.path.join(cwd, d)
11+
if os.path.isfile(os.path.join(path, 'SConscript')):
12+
objs = objs + SConscript(os.path.join(d, 'SConscript'))
13+
14+
Return('objs')

bsp/qemu-virt64-aarch64/SConstruct

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import os
2+
import sys
3+
import rtconfig
4+
5+
from rtconfig import RTT_ROOT
6+
7+
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
8+
from building import *
9+
10+
TARGET = 'rtthread.' + rtconfig.TARGET_EXT
11+
12+
DefaultEnvironment(tools=[])
13+
env = Environment(tools = ['mingw'],
14+
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
15+
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
16+
CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
17+
AR = rtconfig.AR, ARFLAGS = '-rc',
18+
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
19+
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
20+
21+
Export('RTT_ROOT')
22+
Export('rtconfig')
23+
24+
# prepare building environment
25+
objs = PrepareBuilding(env, RTT_ROOT)
26+
27+
# make a building
28+
DoBuilding(TARGET, objs)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from building import *
2+
3+
cwd = GetCurrentDir()
4+
src = Glob('*.c') + Glob('*.cpp')
5+
CPPPATH = [cwd]
6+
7+
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
8+
9+
Return('group')
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright (c) 2006-2021, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2017-5-30 Bernard the first version
9+
*/
10+
11+
#include <rtthread.h>
12+
13+
int main(int argc, char** argv)
14+
{
15+
rt_kprintf("Hi, this is RT-Thread!!\n");
16+
17+
return 0;
18+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
menu "AARCH64 qemu virt64 configs"
3+
menuconfig BSP_SUPPORT_FPU
4+
bool "Using Float"
5+
default y
6+
7+
menuconfig BSP_USING_UART
8+
bool "Using UART"
9+
select RT_USING_SERIAL
10+
default y
11+
12+
if BSP_USING_UART
13+
config RT_USING_UART0
14+
bool "Enabel UART 0"
15+
default y
16+
endif
17+
18+
config BSP_USING_GIC
19+
bool
20+
default y
21+
22+
config BSP_USING_GIC390
23+
bool
24+
default y
25+
endmenu
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# RT-Thread building script for component
2+
3+
from building import *
4+
5+
cwd = GetCurrentDir()
6+
src = Split('''
7+
board.c
8+
drv_uart.c
9+
''')
10+
CPPPATH = [cwd]
11+
12+
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
13+
14+
Return('group')

0 commit comments

Comments
 (0)