Skip to content

Commit f70f3f5

Browse files
committed
import bsp code
1 parent eb92e13 commit f70f3f5

File tree

142 files changed

+15866
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+15866
-0
lines changed

machines/qemu-vexpress-a9/.config

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

machines/qemu-vexpress-a9/.cproject

Lines changed: 175 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
*.pyc
2+
*.map
3+
*.dblite
4+
*.elf
5+
*.bin
6+
*.hex
7+
*.axf
8+
*.exe
9+
*.pdb
10+
*.idb
11+
*.ilk
12+
*.old
13+
build
14+
Debug
15+
documentation/html
16+
packages/
17+
*~
18+
*.o
19+
*.obj
20+
*.out
21+
*.bak
22+
*.dep
23+
*.lib
24+
*.i
25+
*.d
26+
.DS_Stor*
27+
.config 3
28+
.config 4
29+
.config 5
30+
Midea-X1
31+
*.uimg
32+
GPATH
33+
GRTAGS
34+
GTAGS
35+
.vscode
36+
JLinkLog.txt
37+
JLinkSettings.ini
38+
DebugConfig/
39+
RTE/
40+
settings/
41+
*.uvguix*
42+
cconfig.h
43+
.settings
44+
drivers/automac.h

machines/qemu-vexpress-a9/.project

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>qemu-vexpress-a9</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
10+
<triggers>clean,full,incremental,</triggers>
11+
<arguments>
12+
</arguments>
13+
</buildCommand>
14+
<buildCommand>
15+
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
16+
<triggers>full,incremental,</triggers>
17+
<arguments>
18+
</arguments>
19+
</buildCommand>
20+
</buildSpec>
21+
<natures>
22+
<nature>org.eclipse.cdt.core.cnature</nature>
23+
<nature>org.eclipse.cdt.core.rttnature</nature>
24+
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
25+
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
26+
</natures>
27+
<linkedResources>
28+
<link>
29+
<name>rt-thread</name>
30+
<type>2</type>
31+
<locationURI>virtual:/virtual</locationURI>
32+
</link>
33+
<link>
34+
<name>rt-thread/components</name>
35+
<type>2</type>
36+
<locationURI>$%7BPARENT-2-PROJECT_LOC%7D/components</locationURI>
37+
</link>
38+
<link>
39+
<name>rt-thread/include</name>
40+
<type>2</type>
41+
<locationURI>$%7BPARENT-2-PROJECT_LOC%7D/include</locationURI>
42+
</link>
43+
<link>
44+
<name>rt-thread/libcpu</name>
45+
<type>2</type>
46+
<locationURI>$%7BPARENT-2-PROJECT_LOC%7D/libcpu</locationURI>
47+
</link>
48+
<link>
49+
<name>rt-thread/src</name>
50+
<type>2</type>
51+
<locationURI>$%7BPARENT-2-PROJECT_LOC%7D/src</locationURI>
52+
</link>
53+
</linkedResources>
54+
</projectDescription>

machines/qemu-vexpress-a9/Kconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
mainmenu "RT-Thread Project Configuration"
2+
3+
BSP_DIR := .
4+
5+
RTT_DIR := ../../rt-thread
6+
7+
PKGS_DIR := packages
8+
9+
source "$(RTT_DIR)/Kconfig"
10+
osource "$PKGS_DIR/Kconfig"
11+
source "$(BSP_DIR)/drivers/Kconfig"
Lines changed: 249 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,249 @@
1+
# QEMU VExpress A9板级支持包说明
2+
3+
## 1 简介
4+
5+
- Versatile Express系统由ARM Ltd提供,作为CortexA9四核处理器的开发环境,硬件由uATX主板和CoreTile Express A9x4子板组成。有关该系统的详细信息,可以访问 [ARM官方页面][1]
6+
7+
- Versatile Express的核心是一套FPGA的开发环境,Cortex-A芯片基于FPGA上的硬件逻辑,所以本身是不存在这么一款真实芯片。
8+
9+
- QEMU/VExpress A9是QEMU模拟器针对ARM VExpress-A9 FPGA开发板进行软件模拟的指令级虚拟机。QEMU/VExpress因为是软件仿真模式,可以配置成多种模式,例如单核Cortex-A9,多核Cortex-A9,以及多核Cortex-A15等。同时也能够模拟出VExpress FPGA开发板上大多数的外设。
10+
11+
- 这份RT-Thread BSP是针对QEMU/VExpress-A9的一份移植,也并未在真实的VExpress FPGA开发板上运行过,主要是提供给开发者一定的便利,能够使用、验证一定的功能。对于真实FPGA开发板的执行情况,不做任何假设。
12+
13+
当前QEMU/VExpress-A9对应的硬件特性:
14+
15+
| 硬件 | 描述 |
16+
| -- | -- |
17+
| CPU | ARM Cortex-A9(单核) |
18+
| 主频 | NA |
19+
| Memory | 128MB(0x60000000 - 0x68000000) |
20+
21+
## 2 编译说明
22+
23+
- 推荐使用[env工具][2]编译工程,在`bsp/qemu-vexpress-a9`目录中打开env环境,运行命令`scons -j4`
24+
25+
![image-20220626114422344](figures/image-20220626114422344.png)
26+
27+
28+
29+
- 如果编译正确无误,会产生rtthread.elf、rtthread.bin文件。在QEMU中一般使用elf方式来运行,所以只需要使用rtthread.elf文件即可。
30+
31+
![image-20220626114611158](figures/image-20220626114611158.png)
32+
33+
34+
35+
- 当前测试使用的RT-Thread Env版本
36+
37+
![image-20220626113747893](figures/image-20220626113747893.png)
38+
39+
- 当前测试使用的GCC 交叉编译工具链版本
40+
41+
![image-20220626114020634](figures/image-20220626114020634.png)
42+
43+
- 如果在Linux下使用,请自行下载[GNU GCC工具链][3]
44+
45+
## 3 执行和退出
46+
47+
### 3.1 执行脚本文件说明
48+
49+
在这个bsp目录下已经提供了下面几个执行脚本文件,具体的说明如下表所示:
50+
51+
| 执行脚本文件 | 运行平台 | 备注 |
52+
| ------ | ---- | :------: |
53+
| qemu.bat | Windows | 普通模式启动运行 |
54+
| qemu.sh | Linux | 同上 |
55+
| qemu-dbg.bat | Windows | 调试模式启动运行 |
56+
| qemu-dbg.sh | Linux | 同上 |
57+
| qemu-nographic.bat | Windows | 以不带界面的模式启动运行 |
58+
| qemu-nographic.sh | Linux | 同上 |
59+
60+
### 3.2 RT-Studio IDE下运行RT-Thread
61+
62+
推荐使用该方式进行学习,简单易用
63+
64+
- 创建QEMU工程,创建RT-Thread项目,选择基于开发板,选择QEMU-VEXPRESS-A9
65+
66+
![image-20220626125511399](figures/image-20220626125511399.png)
67+
68+
- 创建好工程后,点击完成,选中qemu-a9工程,编译工程
69+
70+
![image-20220626125644099](figures/image-20220626125644099.png)
71+
72+
- 调试工程,发现程序停在了main函数开头处
73+
74+
![image-20220626125717698](figures/image-20220626125717698.png)
75+
76+
- 点击全速运行,发现程序正常运行起来
77+
78+
![image-20220626125837849](figures/image-20220626125837849.png)
79+
80+
81+
82+
### 3.3 Windows ENV下运行RT-Thread
83+
84+
#### 3.3.1 启动QEMU运行
85+
86+
- 当要运行编译好的RT-Thread时,可以在bsp目录下运行env,在env中敲入qemu.bat即可直接运行。这个执行脚本默认把串口输出到stdio(即控制台)上,所以直接执行脚本后就可以输出结果了。
87+
88+
- 默认情况下,我们发现已经成功挂载SD卡
89+
90+
> 注意一下,默认情况下,由于SD中没有文件系统存在,因此挂载失败,程序中检测到文件系统挂载失败后,会自动执行mkfs对文件系统进行格式化操作,格式化完后,再次执行mount操作,文件系统挂载成功
91+
92+
![image-20220626115233881](figures/image-20220626115233881.png)
93+
94+
![image-20220626115854706](figures/image-20220626115854706.png)
95+
96+
- 文件系统操作,测试文件系统是否可以正常读写
97+
98+
![image-20220626115504981](figures/image-20220626115504981.png)
99+
100+
- 当然你也可以尝试使用其他两个**.bat**文件启动运行。
101+
102+
#### 3.3.2 退出QEMU运行
103+
104+
在msh提示输入的状态下,按下 **CTRL+C** ,有以下提示之后,按下 **y** ,即可退出 QEMU 。
105+
106+
```shell
107+
hello rt-thread
108+
msh />
109+
msh />
110+
msh />Terminate batch job (Y/N)? y
111+
```
112+
113+
### 3.4 Windows VSCode 中运行RT-Thread
114+
115+
参考文档:[使用VS Code开发RT-Thread](https://www.rt-thread.org/document/site/#/rt-thread-version/rt-thread-standard/application-note/setup/qemu/vscode/an0021-qemu-vscode?id=%e4%bd%bf%e7%94%a8-vs-code-%e5%bc%80%e5%8f%91-rt-thread)
116+
117+
118+
119+
### 3.5 Linux下执行RT-Thread
120+
121+
#### 3.5.1 安装QEMU工具包
122+
123+
在Linux下调试启动与Windows下稍微有点点区别,由于Windows下安装了**env**工具就自带了**qemu-system-arm**,而Linux下默认是没有这个工具的,所以执行执行`./qemu.sh`会报错:
124+
125+
```shell
126+
bsp/qemu-vexpress-a9$ ./qemu-nographic.sh
127+
./qemu-nographic.sh: line 5: /usr/bin/qemu-system-arm: No such file or directory
128+
```
129+
130+
这个时候需要在Linux平台安装**qemu-system-arm**工具包,以**Linux Ubuntu**平台为例,使用以下命令即可安装对应的工具包:
131+
132+
```shell
133+
bsp/qemu-vexpress-a9$ sudo apt-get install qemu-system-arm
134+
Reading package lists... Done
135+
Building dependency tree
136+
Reading state information... Done
137+
The following package was automatically installed and is no longer required:
138+
tinyproxy-bin
139+
Use 'sudo apt autoremove' to remove it.
140+
Suggested packages:
141+
vde2
142+
The following NEW packages will be installed:
143+
qemu-system-arm
144+
0 upgraded, 1 newly installed, 0 to remove and 168 not upgraded.
145+
Need to get 0 B/7,722 kB of archives.
146+
After this operation, 36.6 MB of additional disk space will be used.
147+
Selecting previously unselected package qemu-system-arm.
148+
(Reading database ... 159586 files and directories currently installed.)
149+
Preparing to unpack .../qemu-system-arm_1%3a4.2-3ubuntu6.17_amd64.deb ...
150+
Unpacking qemu-system-arm (1:4.2-3ubuntu6.17) ...
151+
Setting up qemu-system-arm (1:4.2-3ubuntu6.17) ...
152+
Processing triggers for man-db (2.9.1-1) ...
153+
```
154+
155+
提示安装成功后,输入查看**qemu-system-arm**版本信息的命令,如果可以看到对应的版本信息,证明它可以正常使用。
156+
157+
```shell
158+
/bsp/qemu-vexpress-a9$ qemu-system-arm --version
159+
QEMU emulator version 4.2.1 (Debian 1:4.2-3ubuntu6.17)
160+
Copyright (c) 2003-2019 Fabrice Bellard and the QEMU Project developers
161+
```
162+
163+
#### 3.5.2 启动QEMU运行
164+
165+
由于Linux平台一般都是不带界面的服务器,所以推荐使用`qemu-nographic.sh`脚本来启动运行,参考运行示例如下:
166+
167+
```shell
168+
bsp/qemu-vexpress-a9$ ./qemu-nographic.sh
169+
WARNING: Image format was not specified for 'sd.bin' and probing guessed raw.
170+
Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
171+
Specify the 'raw' format explicitly to remove the restrictions.
172+
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
173+
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
174+
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
175+
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
176+
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
177+
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
178+
ALSA lib conf.c:5220:(snd_config_expand) Evaluate error: No such file or directory
179+
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM default
180+
alsa: Could not initialize DAC
181+
alsa: Failed to open `default':
182+
alsa: Reason: No such file or directory
183+
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
184+
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
185+
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
186+
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
187+
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
188+
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
189+
ALSA lib conf.c:5220:(snd_config_expand) Evaluate error: No such file or directory
190+
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM default
191+
alsa: Could not initialize DAC
192+
alsa: Failed to open `default':
193+
alsa: Reason: No such file or directory
194+
audio: Failed to create voice `lm4549.out'
195+
196+
\ | /
197+
- RT - Thread Operating System
198+
/ | \ 4.1.0 build Nov 24 2021 19:49:17
199+
2006 - 2021 Copyright by rt-thread team
200+
lwIP-2.1.2 initialized!
201+
[I/sal.skt] Socket Abstraction Layer initialize success.
202+
[I/SDIO] SD card capacity 65536 KB.
203+
[I/SDIO] switching card to high speed failed!
204+
[W/POSIX.delay] Please consider implementing rt_hw_us_delay() in another file.
205+
[W/POSIX.delay] Please consider implementing rt_hw_us_delay() in another file.
206+
[W/POSIX.delay] Please consider implementing rt_hw_us_delay() in another file.
207+
hello rt-thread
208+
msh />
209+
msh />
210+
msh />
211+
```
212+
213+
**注意**: 前面的错误信息可以忽略,能看到RT-Thread的启动logo输出,以及msh能正常输入输出,即可进行代码调试了。
214+
215+
#### 3.5.3 退出QEMU运行
216+
217+
Linux下退出QEMU的方式与Windows下有些不一样;在msh提示输入的状态下,按下 **CTRL+A** ,再按下 **X** ,即可退出 QEMU 。
218+
219+
```shell
220+
hello rt-thread
221+
msh />
222+
msh />
223+
msh />QEMU: Terminated
224+
```
225+
226+
227+
228+
## 4 支持情况
229+
230+
| 驱动 | 支持情况 | 备注 |
231+
| ------ | ---- | :------: |
232+
| UART | 支持 | UART0/1 |
233+
| SD/MMC | 支持 | |
234+
| CLCD | 支持 | |
235+
| Key | 支持 | |
236+
| Mouse | 支持 | |
237+
| EMAC | 支持 | |
238+
239+
240+
241+
## 5 联系人信息
242+
243+
维护人:[bernard][4] [recan-li][5]
244+
245+
[1]: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.subset.boards.express/index.html
246+
[2]: https://www.rt-thread.org/download.html#download-rt-thread-env-tool
247+
[3]: https://launchpad.net/gcc-arm-embedded/5.0/5-2016-q3-update/+download/gcc-arm-none-eabi-5_4-2016q3-20160926-linux.tar.bz2
248+
[4]: https://github.com/BernardXiong
249+
[5]: https://github.com/recan-li
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# RT-Thread building script for bridge
2+
3+
import os
4+
from building import *
5+
6+
cwd = GetCurrentDir()
7+
objs = []
8+
list = os.listdir(cwd)
9+
10+
for d in list:
11+
path = os.path.join(cwd, d)
12+
if os.path.isfile(os.path.join(path, 'SConscript')):
13+
objs = objs + SConscript(os.path.join(d, 'SConscript'))
14+
15+
Return('objs')

0 commit comments

Comments
 (0)