Search code examples
esp8266arduino-esp8266

Is there a esp8266 simulator for testing code written on Arduino IDE?


Is there a good esp8266 simulator software that can be used to automate testing? Is it possible to get code written on Arduino IDE to run on these simulators?


Solution

  • As of Jan 2023...

    The docs for the RIOT OS (an IoT OS) explain how to compile and use an ESP8266 version of QEMU for Xtensa. The docs contain the compile instructions:

    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
    

    Actually, the gschorcht/qemu-xtensa repo (last updated 2018) is a fork of the original OSLL/qemu-xtensa project, so you could use the original repo:

    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
    

    Unfortunately, that branch hasn't been updated since 2019 so it may not compile on very recent OS versions. For instance, I got an error: expected unqualified-id error while trying to compile on macOS 12.14. So, someone probably needs to fix those compile errors.