有没有好的esp8266模拟器软件可以用来自动化测试?是否可以让在 Arduino IDE 上编写的代码在这些模拟器上运行?
我认为你可以使用OSLL/qemu-xtensa的xtensa-esp8266分支来模拟esp8266,你必须自己编译它。
可以使用以下命令调用编译后的二进制文件:
qemu-system-xtensa -machine esp8266 -nographic -kernel <your-project>/sketch/app.out -S -s
截至 2023 年 1 月...
RIOT操作系统(物联网操作系统)的文档解释了如何为 Xtensa编译和使用 ESP8266 版本的 QEMU。该文档包含编译说明:
cd /my/source/dir
git clone https://github.com/gschorcht/qemu-xtensa
cd qemu-xtensa/
git checkout xtensa-esp8266
export QEMU=/path/to/esp/qemu
./configure --prefix=$QEMU --target-list=xtensa-softmmu --disable-werror
make
make install
实际上,
gschorcht/qemu-xtensa
存储库(最后更新于 2018 年)是原始 OSLL/qemu-xtensa
项目的分支,因此您可以使用原始存储库:
cd /my/source/dir
git clone https://github.com/OSLL/qemu-xtensa
cd qemu-xtensa/
git checkout xtensa-esp8266
export QEMU=/path/to/esp/qemu
./configure --prefix=$QEMU --target-list=xtensa-softmmu --disable-werror
make
make install
不幸的是,该分支自 2019 年以来尚未更新,因此它可能无法在最新的操作系统版本上编译。例如,我在 macOS 12.14 上尝试编译时遇到了
error: expected unqualified-id
错误。因此,有人可能需要修复这些编译错误。
对于那些像我一样来到这里并未能在 MacOS 上安装适用于 ESP2866 的 QEMU 的人...我找到了
error: expected unqualified-id
的原因并将其修复在我的 OSLL/qemu-xtensa
存储库的分支中。只需按照以下步骤操作:
# IMPORTANT:
# Make sure you have Python2.7 for Mac OS installed, downloadable from here:
# https://www.python.org/downloads/release/python-2718/
git clone http://github.com/weese/qemu-xtensa -b xtensa-esp8266 --depth 1
cd qemu-xtensa
export QEMU=/usr/local/qemu-esp8266
git submodule init dtc
git submodule update dtc
./configure --prefix=$QEMU --target-list=xtensa-softmmu --disable-werror --python=python2.7
make -j 8
sudo make install
然后你应该能够运行:
/usr/local/qemu-esp8266/bin/qemu-system-xtensa