Skip to content

Commit 0453536

Browse files
authored
Merge pull request #5331 from recan-li/master_fix
【PR】修改bsp/qemu-vexpress-a9的若干问题
2 parents 63feef4 + 58af537 commit 0453536

File tree

4 files changed

+151
-10
lines changed

4 files changed

+151
-10
lines changed

bsp/qemu-vexpress-a9/README.md

Lines changed: 143 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,26 @@ QEMU/VExpress A9是QEMU模拟器针对ARM VExpress-A9 FPGA开发板进行软件
3232

3333
如果在Linux下使用,请自行下载[GNU GCC工具链][3]
3434

35-
## 3. 执行
35+
## 3. 执行和退出
3636

37-
当要执行编译好的RT-Thread时,在这个bsp目录下已经提供了运行脚本文件:qemu.bat和qemu.sh。可以在bsp目录下运行env,在env中敲入qemu.bat即可直接运行。
37+
### 3.1 执行脚本文件说明
38+
39+
在这个bsp目录下已经提供了下面几个执行脚本文件,具体的说明如下表所示:
40+
41+
| 执行脚本文件 | 运行平台 | 备注 |
42+
| ------ | ---- | :------: |
43+
| qemu.bat | Windows | 普通模式启动运行 |
44+
| qemu.sh | Linux | 同上 |
45+
| qemu-dbg.bat | Windows | 调试模式启动运行 |
46+
| qemu-dbg.sh | Linux | 同上 |
47+
| qemu-nographic.bat | Windows | 以不带界面的模式启动运行 |
48+
| qemu-nographic.sh | Linux | 同上 |
49+
50+
### 3.2 Windows下执行RT-Thread
51+
52+
#### 3.2.1 启动QEMU运行
53+
54+
当要执行编译好的RT-Thread时,可以在bsp目录下运行env,在env中敲入qemu.bat即可直接运行。
3855

3956
这个执行脚本默认把串口输出到stdio(即控制台)上,所以直接执行脚本后就可以输出结果了。
4057

@@ -49,6 +66,126 @@ hello rt-thread
4966
msh />
5067
```
5168

69+
当然你也可以尝试使用其他两个**.bat**文件启动运行。
70+
71+
#### 3.2.2 退出QEMU运行
72+
73+
在msh提示输入的状态下,按下 **CTRL+C** ,有以下提示之后,按下 **y** ,即可退出 QEMU 。
74+
75+
```shell
76+
hello rt-thread
77+
msh />
78+
msh />
79+
msh />Terminate batch job (Y/N)? y
80+
```
81+
82+
### 3.3 Linux下执行RT-Thread
83+
84+
#### 3.3.1 安装QEMU工具包
85+
86+
在Linux下调试启动与Windows下稍微有点点区别,由于Windows下安装了**env**工具就自带了**qemu-system-arm**,而Linux下默认是没有这个工具的,所以执行执行`./qemu.sh`会报错:
87+
88+
```shell
89+
bsp/qemu-vexpress-a9$ ./qemu-nographic.sh
90+
./qemu-nographic.sh: line 5: /usr/bin/qemu-system-arm: No such file or directory
91+
```
92+
93+
这个时候需要在Linux平台安装**qemu-system-arm**工具包,以**Linux Ubuntu**平台为例,使用以下命令即可安装对应的工具包:
94+
95+
```shell
96+
bsp/qemu-vexpress-a9$ sudo apt-get install qemu-system-arm
97+
Reading package lists... Done
98+
Building dependency tree
99+
Reading state information... Done
100+
The following package was automatically installed and is no longer required:
101+
tinyproxy-bin
102+
Use 'sudo apt autoremove' to remove it.
103+
Suggested packages:
104+
vde2
105+
The following NEW packages will be installed:
106+
qemu-system-arm
107+
0 upgraded, 1 newly installed, 0 to remove and 168 not upgraded.
108+
Need to get 0 B/7,722 kB of archives.
109+
After this operation, 36.6 MB of additional disk space will be used.
110+
Selecting previously unselected package qemu-system-arm.
111+
(Reading database ... 159586 files and directories currently installed.)
112+
Preparing to unpack .../qemu-system-arm_1%3a4.2-3ubuntu6.17_amd64.deb ...
113+
Unpacking qemu-system-arm (1:4.2-3ubuntu6.17) ...
114+
Setting up qemu-system-arm (1:4.2-3ubuntu6.17) ...
115+
Processing triggers for man-db (2.9.1-1) ...
116+
```
117+
118+
提示安装成功后,输入查看**qemu-system-arm**版本信息的命令,如果可以看到对应的版本信息,证明它可以正常使用。
119+
120+
```shell
121+
/bsp/qemu-vexpress-a9$ qemu-system-arm --version
122+
QEMU emulator version 4.2.1 (Debian 1:4.2-3ubuntu6.17)
123+
Copyright (c) 2003-2019 Fabrice Bellard and the QEMU Project developers
124+
```
125+
126+
#### 3.3.2 启动QEMU运行
127+
128+
由于Linux平台一般都是不带界面的服务器,所以推荐使用`qemu-nographic.sh`脚本来启动运行,参考运行示例如下:
129+
130+
```shell
131+
bsp/qemu-vexpress-a9$ ./qemu-nographic.sh
132+
WARNING: Image format was not specified for 'sd.bin' and probing guessed raw.
133+
Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
134+
Specify the 'raw' format explicitly to remove the restrictions.
135+
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
136+
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
137+
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
138+
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
139+
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
140+
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
141+
ALSA lib conf.c:5220:(snd_config_expand) Evaluate error: No such file or directory
142+
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM default
143+
alsa: Could not initialize DAC
144+
alsa: Failed to open `default':
145+
alsa: Reason: No such file or directory
146+
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
147+
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
148+
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
149+
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
150+
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
151+
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
152+
ALSA lib conf.c:5220:(snd_config_expand) Evaluate error: No such file or directory
153+
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM default
154+
alsa: Could not initialize DAC
155+
alsa: Failed to open `default':
156+
alsa: Reason: No such file or directory
157+
audio: Failed to create voice `lm4549.out'
158+
159+
\ | /
160+
- RT - Thread Operating System
161+
/ | \ 4.1.0 build Nov 24 2021 19:49:17
162+
2006 - 2021 Copyright by rt-thread team
163+
lwIP-2.1.2 initialized!
164+
[I/sal.skt] Socket Abstraction Layer initialize success.
165+
[I/SDIO] SD card capacity 65536 KB.
166+
[I/SDIO] switching card to high speed failed!
167+
[W/POSIX.delay] Please consider implementing rt_hw_us_delay() in another file.
168+
[W/POSIX.delay] Please consider implementing rt_hw_us_delay() in another file.
169+
[W/POSIX.delay] Please consider implementing rt_hw_us_delay() in another file.
170+
hello rt-thread
171+
msh />
172+
msh />
173+
msh />
174+
```
175+
176+
**注意**: 前面的错误信息可以忽略,能看到RT-Thread的启动logo输出,以及msh能正常输入输出,即可进行代码调试了。
177+
178+
#### 3.3.3 退出QEMU运行
179+
180+
Linux下退出QEMU的方式与Windows下有些不一样;在msh提示输入的状态下,按下 **CTRL+A** ,再按下 **X** ,即可退出 QEMU 。
181+
182+
```shell
183+
hello rt-thread
184+
msh />
185+
msh />
186+
msh />QEMU: Terminated
187+
```
188+
52189
## 4. 支持情况
53190
54191
| 驱动 | 支持情况 | 备注 |
@@ -97,9 +234,11 @@ start qemu-system-arm -M vexpress-a9 -kernel rtthread.elf -serial stdio -sd sd.b
97234
98235
## 5. 联系人信息
99236
100-
维护人:[bernard][4]
237+
维护人:[bernard][4] [recan-li][5]
101238
102239
[1]: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.subset.boards.express/index.html
103240
[2]: https://www.rt-thread.org/page/download.html
104241
[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
105-
[4]: https://github.com/BernardXiong
242+
[4]: https://github.com/BernardXiong
243+
[5]: https://github.com/recan-li
244+

bsp/qemu-vexpress-a9/drivers/drv_smc911x.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <netif/ethernetif.h>
1414
#include <lwipopts.h>
1515
#include <automac.h>
16+
#include "delay.h"
1617

1718
#define MAX_ADDR_LEN 6
1819
#define SMC911X_EMAC_DEVICE(eth) (struct eth_device_smc911x*)(eth)

components/drivers/mtd/mtd_nand.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -295,11 +295,11 @@ static void mtd_nand(int argc, char **argv)
295295
rt_kprintf(" eraseall <name> Erase all block on device <name>\n");
296296
return ;
297297
}
298-
else if (!strcmp(argv[1], "id"))
298+
else if (!rt_strcmp(argv[1], "id"))
299299
{
300300
mtd_nandid(argv[2]);
301301
}
302-
else if (!strcmp(argv[1], "read"))
302+
else if (!rt_strcmp(argv[1], "read"))
303303
{
304304
if (argc < 5)
305305
{
@@ -308,7 +308,7 @@ static void mtd_nand(int argc, char **argv)
308308
}
309309
mtd_nand_read(argv[2], atoi(argv[3]), atoi(argv[4]));
310310
}
311-
else if (!strcmp(argv[1], "readoob"))
311+
else if (!rt_strcmp(argv[1], "readoob"))
312312
{
313313
if (argc < 5)
314314
{
@@ -317,7 +317,7 @@ static void mtd_nand(int argc, char **argv)
317317
}
318318
mtd_nand_readoob(argv[2], atoi(argv[3]), atoi(argv[4]));
319319
}
320-
else if (!strcmp(argv[1], "write"))
320+
else if (!rt_strcmp(argv[1], "write"))
321321
{
322322
if (argc < 5)
323323
{
@@ -326,7 +326,7 @@ static void mtd_nand(int argc, char **argv)
326326
}
327327
mtd_nand_write(argv[2], atoi(argv[3]), atoi(argv[4]));
328328
}
329-
else if (!strcmp(argv[1], "erase"))
329+
else if (!rt_strcmp(argv[1], "erase"))
330330
{
331331
if (argc < 4)
332332
{
@@ -335,7 +335,7 @@ static void mtd_nand(int argc, char **argv)
335335
}
336336
mtd_nand_erase(argv[2], atoi(argv[3]));
337337
}
338-
else if (!strcmp(argv[1], "eraseall"))
338+
else if (!rt_strcmp(argv[1], "eraseall"))
339339
{
340340
mtd_nand_erase_all(argv[2]);
341341
}

components/lwp/lwp_syscall.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <dfs_posix.h>
1717
#include <sys/time.h>
1818
#include <sys/types.h>
19+
#include <sys/ioctl.h>
1920

2021
typedef long suseconds_t; /* microseconds (signed) */
2122
typedef uint32_t id_t; /* may contain pid, uid or gid */

0 commit comments

Comments
 (0)