Merge pull request #5331 from recan-li/master_fix

【PR】修改bsp/qemu-vexpress-a9的若干问题
This commit is contained in:
Bernard Xiong 2021-12-05 09:58:57 +08:00 committed by GitHub
commit 0453536384
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 151 additions and 10 deletions

View File

@ -32,9 +32,26 @@ QEMU/VExpress A9是QEMU模拟器针对ARM VExpress-A9 FPGA开发板进行软件
如果在Linux下使用请自行下载[GNU GCC工具链][3]。
## 3. 执行
## 3. 执行和退出
当要执行编译好的RT-Thread时在这个bsp目录下已经提供了运行脚本文件qemu.bat和qemu.sh。可以在bsp目录下运行env在env中敲入qemu.bat即可直接运行。
### 3.1 执行脚本文件说明
在这个bsp目录下已经提供了下面几个执行脚本文件具体的说明如下表所示
| 执行脚本文件 | 运行平台 | 备注 |
| ------ | ---- | :------: |
| qemu.bat | Windows | 普通模式启动运行 |
| qemu.sh | Linux | 同上 |
| qemu-dbg.bat | Windows | 调试模式启动运行 |
| qemu-dbg.sh | Linux | 同上 |
| qemu-nographic.bat | Windows | 以不带界面的模式启动运行 |
| qemu-nographic.sh | Linux | 同上 |
### 3.2 Windows下执行RT-Thread
#### 3.2.1 启动QEMU运行
当要执行编译好的RT-Thread时可以在bsp目录下运行env在env中敲入qemu.bat即可直接运行。
这个执行脚本默认把串口输出到stdio即控制台所以直接执行脚本后就可以输出结果了。
@ -49,6 +66,126 @@ hello rt-thread
msh />
```
当然你也可以尝试使用其他两个**.bat**文件启动运行。
#### 3.2.2 退出QEMU运行
在msh提示输入的状态下按下 **CTRL+C** ,有以下提示之后,按下 **y** ,即可退出 QEMU 。
```shell
hello rt-thread
msh />
msh />
msh />Terminate batch job (Y/N)? y
```
### 3.3 Linux下执行RT-Thread
#### 3.3.1 安装QEMU工具包
在Linux下调试启动与Windows下稍微有点点区别由于Windows下安装了**env**工具就自带了**qemu-system-arm**而Linux下默认是没有这个工具的所以执行执行`./qemu.sh`会报错:
```shell
bsp/qemu-vexpress-a9$ ./qemu-nographic.sh
./qemu-nographic.sh: line 5: /usr/bin/qemu-system-arm: No such file or directory
```
这个时候需要在Linux平台安装**qemu-system-arm**工具包,以**Linux Ubuntu**平台为例,使用以下命令即可安装对应的工具包:
```shell
bsp/qemu-vexpress-a9$ sudo apt-get install qemu-system-arm
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
tinyproxy-bin
Use 'sudo apt autoremove' to remove it.
Suggested packages:
vde2
The following NEW packages will be installed:
qemu-system-arm
0 upgraded, 1 newly installed, 0 to remove and 168 not upgraded.
Need to get 0 B/7,722 kB of archives.
After this operation, 36.6 MB of additional disk space will be used.
Selecting previously unselected package qemu-system-arm.
(Reading database ... 159586 files and directories currently installed.)
Preparing to unpack .../qemu-system-arm_1%3a4.2-3ubuntu6.17_amd64.deb ...
Unpacking qemu-system-arm (1:4.2-3ubuntu6.17) ...
Setting up qemu-system-arm (1:4.2-3ubuntu6.17) ...
Processing triggers for man-db (2.9.1-1) ...
```
提示安装成功后,输入查看**qemu-system-arm**版本信息的命令,如果可以看到对应的版本信息,证明它可以正常使用。
```shell
/bsp/qemu-vexpress-a9$ qemu-system-arm --version
QEMU emulator version 4.2.1 (Debian 1:4.2-3ubuntu6.17)
Copyright (c) 2003-2019 Fabrice Bellard and the QEMU Project developers
```
#### 3.3.2 启动QEMU运行
由于Linux平台一般都是不带界面的服务器所以推荐使用`qemu-nographic.sh`脚本来启动运行,参考运行示例如下:
```shell
bsp/qemu-vexpress-a9$ ./qemu-nographic.sh
WARNING: Image format was not specified for 'sd.bin' and probing guessed raw.
Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
Specify the 'raw' format explicitly to remove the restrictions.
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5220:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM default
alsa: Could not initialize DAC
alsa: Failed to open `default':
alsa: Reason: No such file or directory
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5220:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM default
alsa: Could not initialize DAC
alsa: Failed to open `default':
alsa: Reason: No such file or directory
audio: Failed to create voice `lm4549.out'
\ | /
- RT - Thread Operating System
/ | \ 4.1.0 build Nov 24 2021 19:49:17
2006 - 2021 Copyright by rt-thread team
lwIP-2.1.2 initialized!
[I/sal.skt] Socket Abstraction Layer initialize success.
[I/SDIO] SD card capacity 65536 KB.
[I/SDIO] switching card to high speed failed!
[W/POSIX.delay] Please consider implementing rt_hw_us_delay() in another file.
[W/POSIX.delay] Please consider implementing rt_hw_us_delay() in another file.
[W/POSIX.delay] Please consider implementing rt_hw_us_delay() in another file.
hello rt-thread
msh />
msh />
msh />
```
**注意** 前面的错误信息可以忽略能看到RT-Thread的启动logo输出以及msh能正常输入输出即可进行代码调试了。
#### 3.3.3 退出QEMU运行
Linux下退出QEMU的方式与Windows下有些不一样在msh提示输入的状态下按下 **CTRL+A** ,再按下 **X** ,即可退出 QEMU 。
```shell
hello rt-thread
msh />
msh />
msh />QEMU: Terminated
```
## 4. 支持情况
| 驱动 | 支持情况 | 备注 |
@ -97,9 +234,11 @@ start qemu-system-arm -M vexpress-a9 -kernel rtthread.elf -serial stdio -sd sd.b
## 5. 联系人信息
维护人:[bernard][4]
维护人:[bernard][4] [recan-li][5]
[1]: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.subset.boards.express/index.html
[2]: https://www.rt-thread.org/page/download.html
[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
[4]: https://github.com/BernardXiong
[5]: https://github.com/recan-li

View File

@ -13,6 +13,7 @@
#include <netif/ethernetif.h>
#include <lwipopts.h>
#include <automac.h>
#include "delay.h"
#define MAX_ADDR_LEN 6
#define SMC911X_EMAC_DEVICE(eth) (struct eth_device_smc911x*)(eth)

View File

@ -295,11 +295,11 @@ help:
rt_kprintf(" eraseall <name> Erase all block on device <name>\n");
return ;
}
else if (!strcmp(argv[1], "id"))
else if (!rt_strcmp(argv[1], "id"))
{
mtd_nandid(argv[2]);
}
else if (!strcmp(argv[1], "read"))
else if (!rt_strcmp(argv[1], "read"))
{
if (argc < 5)
{
@ -308,7 +308,7 @@ help:
}
mtd_nand_read(argv[2], atoi(argv[3]), atoi(argv[4]));
}
else if (!strcmp(argv[1], "readoob"))
else if (!rt_strcmp(argv[1], "readoob"))
{
if (argc < 5)
{
@ -317,7 +317,7 @@ help:
}
mtd_nand_readoob(argv[2], atoi(argv[3]), atoi(argv[4]));
}
else if (!strcmp(argv[1], "write"))
else if (!rt_strcmp(argv[1], "write"))
{
if (argc < 5)
{
@ -326,7 +326,7 @@ help:
}
mtd_nand_write(argv[2], atoi(argv[3]), atoi(argv[4]));
}
else if (!strcmp(argv[1], "erase"))
else if (!rt_strcmp(argv[1], "erase"))
{
if (argc < 4)
{
@ -335,7 +335,7 @@ help:
}
mtd_nand_erase(argv[2], atoi(argv[3]));
}
else if (!strcmp(argv[1], "eraseall"))
else if (!rt_strcmp(argv[1], "eraseall"))
{
mtd_nand_erase_all(argv[2]);
}

View File

@ -16,6 +16,7 @@
#include <dfs_posix.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/ioctl.h>
typedef long suseconds_t; /* microseconds (signed) */
typedef uint32_t id_t; /* may contain pid, uid or gid */