Git Product home page Git Product logo

qemu_esp32's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qemu_esp32's Issues

Debugging with VS Code

In the debugging part, i do not understand how is it done.
Can you explain me with more details?

Stuck on step 3

This is a log of issues I came across while following the README.md instructions (and my workarounds to those).

My environment is:

  • Linux distro: Fedora 35;
  • ESP-IDF version: 5.0.0;
  • My starting directory is $HOME/esp (I runned the first git clone inside this directory);
  • My ESP-IDF's directory is $HOME/esp/esp-idf;
  • I've set IDF's environment variables (. ./export.sh) before all steps (ESP-IDF: Set up the environment variables);

1. Build qemu


Error: Git no more supports protocol git://

When running git clone I got this error...

$ git clone git://github.com/Ebiroll/qemu-xtensa-esp32

Cloning into 'qemu-xtensa-esp32'...
fatal: remote error: 
  The unauthenticated git protocol on port 9418 is no longer supported.
Please see https://github.blog/2021-09-01-improving-git-protocol-security-github/ for more information.

With HTTPS protocol it worked:

git clone https://github.com/Ebiroll/qemu-xtensa-esp32

Error: qemu-xtensa-esp32/configure needs Python 2

When running configure command I got this error...

$ ../qemu-xtensa-esp32/configure --disable-werror --prefix=`pwd`/root --target-list=xtensa-softmmu,xtensaeb-softmmu

ERROR: Cannot use 'python', Python 2.6 or later is required.
       Note that Python 3 or later is not yet supported.
       Use --python=/path/to/python to specify a supported Python.

As it says, I just added --python=/bin/python2.7 and it worked. (yes, Python 2.7)

../qemu-xtensa-esp32/configure --disable-werror --prefix=`pwd`/root --target-list=xtensa-softmmu,xtensaeb-softmmu --python=/bin/python2.7

TIP: To get any program's path, you can use the command whereis <program>. Ex: whereis python2.7

2. Dump rom1 and rom.bin

espressif removed esp32-r0-rom.bin from the pc-bios repository.

From where I'll dump these files? If I'm trying to emulate an ESP32, it's probably because I don't have an ESP32...

3. Build an esp32 application

# Open a new window to build example app, and set env variables
export PATH=$PATH:$HOME/esp/xtensa-esp32-elf/bin  # --- What is "xtensa-esp32-elf"? I've never downloaded it
export IDF_PATH=~/esp/esp-idf
cd esp  # --- I assume I was supposed to be in the home directory.
git clone git://github.com/Ebiroll/qemu_esp32  # --- Again, git: -> https:
cd qemu_esp32

I've already created the directory "qemu_esp32" in this folder (from step 1), so I'll call this clone "qemu_esp32_Ebiroll".

$ git clone https://github.com/Ebiroll/qemu_esp32 qemu_esp32_Ebiroll
$ cd qemu_esp32_Ebiroll
$ make menuconfig

Makefile:8: /home/diego/esp/esp-idf/make/project.mk: No such file or directory
make: *** No rule to make target '/home/diego/esp/esp-idf/make/project.mk'.  Stop.


$ idf.py menuconfig  # Maybe?

Executing action: menuconfig
CMakeLists.txt not found in project directory /home/diego/esp/qemu_esp32_Ebiroll

. . .

It's impossible to pass from step 3! Probably with an previous version of ESP-IDF.

How to add to my project

Hi,

I have followed the instructions in the readme file but have some overarching questions to understand what the steps are doing and more importantly how I would enable my project to use qemu. Please feel free to point me to any documentation.

I have an ESP32 project which I currently flash to a chip and test. I would instead like to run/ debug it in QEMU on my Ubuntu PC but from the README file can't understand how I would go about it.

I assume step 3 is getting a sample project but then unclear how steps 4 onwards related to my project e.g. do I copy toFlash.c and esp32flash.bin to my project and then proceed?

Any help appreciated.

thanks

Lee.

`make` command fails

According the README I was able to execute these commands successfully

git clone git://github.com/Ebiroll/qemu-xtensa-esp32
mkdir qemu_esp32
cd qemu_esp32
../qemu-xtensa-esp32/configure --disable-werror --prefix=`pwd`/root --target-list=xtensa-softmmu,xtensaeb-softmmu

But on trying to run make it fails the following error trace

22 warnings generated.
  CXX   xtensa-softmmu/hw/xtensa/MemoryMapped.o
In file included from /Users/miraj/qemu-xtensa-esp32/hw/xtensa/MemoryMapped.cpp:7:
In file included from /Users/miraj/qemu-xtensa-esp32/hw/xtensa/MemoryMapped.h:20:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string:506:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:175:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__string:57:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:639:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/initializer_list:46:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cstddef:37:
/Users/miraj/qemu-xtensa-esp32/version:1:1: error: expected unqualified-id
2.7.0
^
In file included from /Users/miraj/qemu-xtensa-esp32/hw/xtensa/MemoryMapped.cpp:7:
In file included from /Users/miraj/qemu-xtensa-esp32/hw/xtensa/MemoryMapped.h:20:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string:506:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:175:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__string:57:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:639:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/initializer_list:46:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cstddef:49:9: error: no member named 'ptrdiff_t' in the global namespace
using ::ptrdiff_t;
      ~~^
In file included from /Users/miraj/qemu-xtensa-esp32/hw/xtensa/MemoryMapped.cpp:7:
In file included from /Users/miraj/qemu-xtensa-esp32/hw/xtensa/MemoryMapped.h:20:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string:506:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:175:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__string:57:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:640:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:418:
/Users/miraj/qemu-xtensa-esp32/version:1:1: error: expected unqualified-id
2.7.0
^
In file included from /Users/miraj/qemu-xtensa-esp32/hw/xtensa/MemoryMapped.cpp:7:
In file included from /Users/miraj/qemu-xtensa-esp32/hw/xtensa/MemoryMapped.h:20:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string:506:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:175:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__string:57:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:642:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/utility:205:
/Users/miraj/qemu-xtensa-esp32/version:1:1: error: expected unqualified-id
2.7.0
^
In file included from /Users/miraj/qemu-xtensa-esp32/hw/xtensa/MemoryMapped.cpp:7:
In file included from /Users/miraj/qemu-xtensa-esp32/hw/xtensa/MemoryMapped.h:20:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string:506:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:175:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__string:57:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:643:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:668:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/typeinfo:60:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/exception:83:
/Users/miraj/qemu-xtensa-esp32/version:1:1: error: expected unqualified-id
2.7.0
^
In file included from /Users/miraj/qemu-xtensa-esp32/hw/xtensa/MemoryMapped.cpp:7:
In file included from /Users/miraj/qemu-xtensa-esp32/hw/xtensa/MemoryMapped.h:20:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string:506:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:175:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__string:57:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:643:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:671:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/new:93:
/Users/miraj/qemu-xtensa-esp32/version:1:1: error: expected unqualified-id
2.7.0
^
In file included from /Users/miraj/qemu-xtensa-esp32/hw/xtensa/MemoryMapped.cpp:7:
In file included from /Users/miraj/qemu-xtensa-esp32/hw/xtensa/MemoryMapped.h:20:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string:506:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:175:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__string:57:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:643:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:673:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/limits:121:
/Users/miraj/qemu-xtensa-esp32/version:1:1: error: expected unqualified-id
2.7.0
^
In file included from /Users/miraj/qemu-xtensa-esp32/hw/xtensa/MemoryMapped.cpp:7:
In file included from /Users/miraj/qemu-xtensa-esp32/hw/xtensa/MemoryMapped.h:20:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string:506:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:175:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__string:57:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:643:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:674:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/iterator:423:
/Users/miraj/qemu-xtensa-esp32/version:1:1: error: expected unqualified-id
2.7.0
^
In file included from /Users/miraj/qemu-xtensa-esp32/hw/xtensa/MemoryMapped.cpp:7:
In file included from /Users/miraj/qemu-xtensa-esp32/hw/xtensa/MemoryMapped.h:20:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string:506:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:175:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__string:57:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:643:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:674:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/iterator:562:13: error: unknown type name 'ptrdiff_t'
    typedef ptrdiff_t difference_type;
            ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/iterator:623:56: error: unknown type name 'ptrdiff_t'
template<class _Category, class _Tp, class _Distance = ptrdiff_t,
                                                       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/iterator:989:66: error: unknown type name 'ptrdiff_t'
          class _Traits = char_traits<_CharT>, class _Distance = ptrdiff_t>
                                                                 ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/iterator:989:54: error: template parameter missing a default argument
          class _Traits = char_traits<_CharT>, class _Distance = ptrdiff_t>
                                                     ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/iterator:989:27: note: previous default template argument defined here
          class _Traits = char_traits<_CharT>, class _Distance = ptrdiff_t>
                          ^
In file included from /Users/miraj/qemu-xtensa-esp32/hw/xtensa/MemoryMapped.cpp:7:
In file included from /Users/miraj/qemu-xtensa-esp32/hw/xtensa/MemoryMapped.h:20:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string:506:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:175:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__string:57:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:643:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:677:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/tuple:154:
/Users/miraj/qemu-xtensa-esp32/version:1:1: error: expected unqualified-id
2.7.0
^
In file included from /Users/miraj/qemu-xtensa-esp32/hw/xtensa/MemoryMapped.cpp:7:
In file included from /Users/miraj/qemu-xtensa-esp32/hw/xtensa/MemoryMapped.h:20:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string:506:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:175:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__string:57:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:643:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:681:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/atomic:576:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__threading_support:14:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/chrono:831:
/Users/miraj/qemu-xtensa-esp32/version:1:1: error: expected unqualified-id
2.7.0
^
In file included from /Users/miraj/qemu-xtensa-esp32/hw/xtensa/MemoryMapped.cpp:7:
In file included from /Users/miraj/qemu-xtensa-esp32/hw/xtensa/MemoryMapped.h:20:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string:506:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:175:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__string:57:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:643:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:681:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/atomic:581:
/Users/miraj/qemu-xtensa-esp32/version:1:1: error: expected unqualified-id
2.7.0
^
In file included from /Users/miraj/qemu-xtensa-esp32/hw/xtensa/MemoryMapped.cpp:7:
In file included from /Users/miraj/qemu-xtensa-esp32/hw/xtensa/MemoryMapped.h:20:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string:506:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:175:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__string:57:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:643:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:681:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/atomic:1052:73: error: unknown type name 'ptrdiff_t'
_Tp* __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp*> volatile* __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
                                                                        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/atomic:1057:65: error: unknown type name 'ptrdiff_t'
_Tp* __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp*> * __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
                                                                ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/atomic:1073:73: error: unknown type name 'ptrdiff_t'
_Tp* __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp*> volatile* __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
                                                                        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/atomic:1078:65: error: unknown type name 'ptrdiff_t'
_Tp* __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp*> * __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
                                                                ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[1]: *** [hw/xtensa/MemoryMapped.o] Error 1
make: *** [subdir-xtensa-softmmu] Error 2

Not sure what's the issue. Any help is appreciated

MacOS simple compilation error "error: conflicting types for 'esp32_i2c_interruptSet'"

Hi,
during compilation I have got :
.. /qemu-xtensa-esp32/hw/xtensa/esp32.c:2835:13: error: conflicting types for 'esp32_i2c_interruptSet'
extern void esp32_i2c_interruptSet(qemu_irq new_irq);

.. /qemu-xtensa-esp32/hw/xtensa/esp32.c:2476:12: note: previous implicit declaration is here
esp32_i2c_interruptSet(PROcpu->env.irq_inputs[val]);

solution: move at beginning lines with "extern ..."

How to use basic_webserver example

Hi, I wanted to run the example number 14_basic_webserver, but I don't know if I'm doing it correctly, because I can't get it to connect to a web browser. So I wanted to ask if I am doing something wrong.
The steps that I follow are the following.

  1. The example I am running inside a docker container. Inside this container install and configure the following:

    • ESP-IDF SDK version 4.2
    • The Qemu tool from git: //github.com/Ebiroll/qemu-xtensa-esp32
    • download and configure the git repository: //github.com/Ebiroll/qemu_esp32

  2. Then I went to the example directory, and did the following
    • I copied the files rom.bin and rom1.bin in the directory of the example
    • Then I did menuconfig
    • make
    • Then execute gcc toflash.c -o qemu_flash
    • After ./qemu_flash build / 14_basic_webserver.elf

  3. Once the esp32flash.bin binary is generated, I run qemu as follows.

qemu-system-xtensa -d guest_errors,unimp -cpu esp32 -M esp32 -m 4M -net nic,model=vlan0 -net user,id=simnet,ipver4=on,net=172.17.0.0/24,host=172.17.0.2,hostfwd=tcp::10800-172.17.0.2:80 -net dump,file=/tmp/vm0.pcap -s > io.txt

So the Docker's console shows me the following:

(92) esp_image: segment 5: paddr=0x000b7104 vaddr=0x4008b2b0 size=0x08dfc ( 36348) load
HOST RER TBD
I (101) boot: Loaded app from partition at offset 0x10000
I (101) boot: Disabling RNG early entropy source...
I (101) cpu_start: Pro cpu up.
I (102) cpu_start: Application information:
I (102) cpu_start: Project name: 14_basic_webserver
I (102) cpu_start: App version: 2aaea3b-dirty
I (102) cpu_start: Compile time: May 14 2021 22:50:32
I (102) cpu_start: ELF file SHA256: bbb22de069bde0d7...
I (102) cpu_start: ESP-IDF: v3.3.2-dirty
I (102) cpu_start: Starting app cpu, entry point is 0x4008128c
I (0) cpu_start: App cpu up.
I (1782) heap_init: Initializing. RAM available for dynamic allocation:
I (1782) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (1783) heap_init: At 3FFBA910 len 000256F0 (149 KiB): DRAM
I (1783) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (1783) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (1784) heap_init: At 400940AC len 0000BF54 (47 KiB): IRAM
I (1784) cpu_start: Pro cpu start user code
esp32_i2c_interruptSet: new IRQ val 0x601e82b0
TBD(pc = 400940a7): /root/qemu-xtensa-esp32/target-xtensa/translate.c:1409
I (590) cpu_start: Starting scheduler on PRO CPU.
I (990) cpu_start: Starting scheduler on APP CPU.
NV_INIT_CALLED

  1. Then I open another console within Docker and try to connect to the web server with netcat, as follows

    nc 172.17.0.2 10800

But what I see is that it does not connect to the server, since nothing is shown. On the other hand, the qemu console always shows the same thing. Does not advance from NV_INIT_CALLED. I also tried to connect using Putty from outside the container, but the same thing happens to me.

For that reasonn I wanted to ask if I am doing something wrong.

From already thank you very much.

[Ubuntu17.04] Compilation error

Hello,

I've the following error on Ubuntu 17.04
hw/xtensa/xtfpga.o: In function lx_init': /home/pef/qemu-xtensa-esp32/hw/xtensa/xtfpga.c:323: undefined reference to load_device_tree'
collect2: error: ld returned 1 exit status
Makefile:197: recipe for target 'qemu-system-xtensa' failed
make[1]: *** [qemu-system-xtensa] Error 1
Makefile:204: recipe for target 'subdir-xtensa-softmmu' failed
make: *** [subdir-xtensa-softmmu] Error 2

I've googled it but no answers.

Any ideas ?

Use with docker and GitLab CI to run IDF unit tests

This is a really cool project. My first thought was that it could be used with GitLab CI (or another CI) to automatically run unittests.

So for example you could have CI automatically running the unittests for your firmware (or library) repo on each checkin, each PR branch, etc.

All the pieces are here, but getting them all strung together is a daunting task. Anybody interested in working on this together?

build fails with `undefined reference to `major'`

This is the output using the instructions from the readme

/usr/bin/ld: qga/commands-posix.o: in function `dev_major_minor':
/home/morgan/devel/qemu-xtensa-esp32/qga/commands-posix.c:656: undefined reference to `major'
/usr/bin/ld: /home/morgan/devel/qemu-xtensa-esp32/qga/commands-posix.c:657: undefined reference to `minor'
collect2: error: ld returned 1 exit status

There are several warning prior

/home/morgan/devel/qemu-xtensa-esp32/qga/commands-posix.c: In function ‘dev_major_minor’:
/home/morgan/devel/qemu-xtensa-esp32/qga/commands-posix.c:656:21: warning: implicit declaration of function ‘major’ [-Wimplicit-function-declaration]
         *devmajor = major(st.st_rdev);
                     ^~~~~
/home/morgan/devel/qemu-xtensa-esp32/qga/commands-posix.c:656:21: warning: nested extern declaration of ‘major’ [-Wnested-externs]
/home/morgan/devel/qemu-xtensa-esp32/qga/commands-posix.c:657:21: warning: implicit declaration of function ‘minor’; did you mean ‘mincore’? [-Wimplicit-function-declaration]
         *devminor = minor(st.st_rdev);
                     ^~~~~
                     mincore
/home/morgan/devel/qemu-xtensa-esp32/qga/commands-posix.c:657:21: warning: nested extern declaration of ‘minor’ [-Wnested-externs]

Question about ESP32 BT emulation

Hi, first of all, thanks for the really great project.
I'm new to qemu and was wondering if the Bluetooth hardware part for ESP32 is implemented.

If not, would this require efforts in reverse engineering esp32 BT lib?

Regards

About ROM0/ROM1...

FYI, I see you only dump one version of the ROM with esptool. I'm not sure if it makes any difference in the emulation, but just fyi: the version of the ROM that the 2nd CPU sees is slightly different from the one the 1st CPU sees. I think the changes are all in the 1st 64K and entirely irrelevant if you're running an esp-idf app, but if you strive for 100% emulation, you may want to take that into account.

Need rom.bin and rom1.bin

Hi Ebiroll,

Thanks for the project!

in installation manual I see that rom.bin and rom1.bin should be dumped from a physical hardware board.
I do not have that yet. Just ordered, awaiting.
Meantime I wanted to try some examples.

I tried to google them, but links are outdated.
Is it possible you place your rom.bin and rom1.bin to github?

Issue with running latest ESP-IDF code.

When running with latest esp-idf bbafd506624b2a3d1e58f2dd3154286b79a8632b (and updated tool chain), I get

esp32flash.bin @ FD000000
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:9172
load:0x40078000,len:12636
load:0x40080400,len:7068
csum err:0x57!=0xff
Falling back to built-in command interpreter.
OK

but when running with esp-idf version a20d02b7f196c407bc9f39b781e31a0a4f665968 (Thu Apr 18 2019), I get (correctly) when using the latest qemu_esp32 and qemu-xtensa-esp32 code in both cases

esp32flash.bin @ 27600000
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:9052
load:0x40078000,len:12312
load:0x40080400,len:7140
entry 0x400807a4
D (12) bootloader_flash: mmu set block paddr=0x00000000 (was 0xffffffff)
I (4) boot: ESP-IDF v3.3-beta2-474-g90f4379 2nd stage bootloader
I (4) boot: compile time 18:47:57
D (4) boot: Enabling RTCWDT(9000 ms)
I (4) boot: Enabling RNG early entropy source...
... etc

Any clues as to what needs to be done here?

Error when dumping ROM

Hi all, I am trying to test the emulator because it is an interesting project for me.
Unfortunately I run into an error at step 2 of the Quick Start, when I try to dump the ROMs.
I have cloned the espressif/esp-idf repository.

My system is Ubuntu 14.04 on a VirtualBox.
Any help will be highly appreciated.
My output when executing sudo ~/esp/esp-idf/components/esptool_py/esptool/esptool.py --chip esp32 -b 921600 -p /dev/tty0 dump_mem 0x40000000 0x000C2000 rom.bin follows.

esptool.py v2.3.1
Connecting...
Traceback (most recent call last):
File "/home/username/esp/esp-idf/components/esptool_py/esptool/esptool.py", line 2637, in
_main()
File "/home/username/esp/esp-idf/components/esptool_py/esptool/esptool.py", line 2630, in _main
main()
File "/home/username/esp/esp-idf/components/esptool_py/esptool/esptool.py", line 2356, in main
esp.connect(args.before)
File "/home/username/esp/esp-idf/components/esptool_py/esptool/esptool.py", line 407, in connect
last_error = self._connect_attempt(mode=mode, esp32r0_delay=False)
File "/home/username/esp/esp-idf/components/esptool_py/esptool/esptool.py", line 365, in _connect_attempt
self._port.setDTR(False) # IO0=HIGH
File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 535, in setDTR
fcntl.ioctl(self.fd, TIOCMBIC, TIOCM_DTR_str)
IOError: [Errno 22] Invalid argument

Error in esp_gdbstub_arch.h

Hi, I'm trying to follow the Quick Start steps, but when I do step 3, it shows me an error that the esp_gdbstub_arch.h file cannot be found. This error appears after executing the "make" command, after having executed "make menuconfig". I show below the error I get through the screen

CC build/esp_serial_slave_link/essl_spi.o
CC build/esp_serial_slave_link/essl_sdio.o
CC build/esp_serial_slave_link/essl.o
AR build/esp_serial_slave_link/libesp_serial_slave_link.a
CC build/esp_system/panic.o
In file included from /root/esp-idf/components/esp_system/panic.c:58:
/root/esp-idf/components/esp_gdbstub/include/esp_gdbstub.h:17:10: fatal error: esp_gdbstub_arch.h: No such file or directory
#include "esp_gdbstub_arch.h"
^~~~~~~~~~~~~~~~~~~~
compilation terminated.
/root/esp-idf/make/component_wrapper.mk:291: recipe for target 'panic.o' failed
make[1]: *** [panic.o] Error 1
/root/esp-idf//make/project.mk:642: recipe for target 'component-esp_system-build' failed
make: *** [component-esp_system-build] Error 2

Could I be doing some Quick Start step incorrectly?

From already thank you very much

cant follow readme instructions

Hi,
during the step 3.build of application I got this error when running make(running on win10 WSL ubuntu 18.04 LTS):

In file included from /home/esp32/esp/qemu_esp32/main/main.c:22:
/home/esp32/esp/esp-idf/components/esp_event/include/esp_event_loop.h:2:2: warning: #warning "esp_event_loop.h is deprecated, please include esp_event.h instead" [-Wcpp]
#warning "esp_event_loop.h is deprecated, please include esp_event.h instead"
^~~~~~~
In file included from /home/esp32/esp/qemu_esp32/main/main.c:33:
/home/esp32/esp/esp-idf/components/esp32/include/rom/ets_sys.h:1:2: warning: #warning rom/ets_sys.h is deprecated, please use esp32/rom/ets_sys.h instead [-Wcpp]
#warning rom/ets_sys.h is deprecated, please use esp32/rom/ets_sys.h instead
^~~~~~~
In file included from /home/esp32/esp/qemu_esp32/main/main.c:34:
/home/esp32/esp/esp-idf/components/esp32/include/rom/gpio.h:1:2: warning: #warning rom/gpio.h is deprecated, please use esp32/rom/gpio.h instead [-Wcpp]
#warning rom/gpio.h is deprecated, please use esp32/rom/gpio.h instead
^~~~~~~
In file included from /home/esp32/esp/qemu_esp32/main/main.c:42:
/home/esp32/esp/esp-idf/components/tcpip_adapter/include/tcpip_adapter.h:15:2: warning: #warning "This header is deprecated, please use new network related API in esp_netif.h" [-Wcpp]
#warning "This header is deprecated, please use new network related API in esp_netif.h"
^~~~~~~
/home/esp32/esp/qemu_esp32/main/main.c: In function 'wifi_task':
/home/esp32/esp/qemu_esp32/main/main.c:253:5: warning: 'tcpip_adapter_init' is deprecated [-Wdeprecated-declarations]
tcpip_adapter_init();
^~~~~~~~~~~~~~~~~~
In file included from /home/esp32/esp/esp-idf/components/esp_netif/include/esp_netif.h:35,
from /home/esp32/esp/esp-idf/components/esp_event/include/esp_event_legacy.h:22,
from /home/esp32/esp/esp-idf/components/esp_event/include/esp_event.h:26,
from /home/esp32/esp/esp-idf/components/esp_wifi/include/esp_wifi.h:64,
from /home/esp32/esp/qemu_esp32/main/main.c:19:
/home/esp32/esp/esp-idf/components/tcpip_adapter/include/tcpip_adapter.h:34:6: note: declared here
void tcpip_adapter_init(void) attribute ((deprecated));
^~~~~~~~~~~~~~~~~~
/home/esp32/esp/qemu_esp32/main/main.c:254:5: warning: 'esp_event_loop_init' is deprecated [-Wdeprecated-declarations]
ESP_ERROR_CHECK( esp_event_loop_init(event_handler, NULL) );
^~~~~~~~~~~~~~~
In file included from /home/esp32/esp/esp-idf/components/esp_event/include/esp_event.h:26,
from /home/esp32/esp/esp-idf/components/esp_wifi/include/esp_wifi.h:64,
from /home/esp32/esp/qemu_esp32/main/main.c:19:
/home/esp32/esp/esp-idf/components/esp_event/include/esp_event_legacy.h:231:11: note: declared here
esp_err_t esp_event_loop_init(system_event_cb_t cb, void ctx) attribute ((deprecated));
^~~~~~~~~~~~~~~~~~~
/home/esp32/esp/qemu_esp32/main/main.c: In function 'emulated_net':
/home/esp32/esp/qemu_esp32/main/main.c:341:5: warning: 'tcpip_adapter_init' is deprecated [-Wdeprecated-declarations]
tcpip_adapter_init();
^~~~~~~~~~~~~~~~~~
In file included from /home/esp32/esp/esp-idf/components/esp_netif/include/esp_netif.h:35,
from /home/esp32/esp/esp-idf/components/esp_event/include/esp_event_legacy.h:22,
from /home/esp32/esp/esp-idf/components/esp_event/include/esp_event.h:26,
from /home/esp32/esp/esp-idf/components/esp_wifi/include/esp_wifi.h:64,
from /home/esp32/esp/qemu_esp32/main/main.c:19:
/home/esp32/esp/esp-idf/components/tcpip_adapter/include/tcpip_adapter.h:34:6: note: declared here
void tcpip_adapter_init(void) attribute ((deprecated));
^~~~~~~~~~~~~~~~~~
/home/esp32/esp/qemu_esp32/main/main.c: In function 'phy_tlk110_init':
/home/esp32/esp/qemu_esp32/main/main.c:430:5: error: implicit declaration of function 'esp_eth_smi_write'; did you mean 'esp_eth_start'? [-Werror=implicit-function-declaration]
esp_eth_smi_write(0x1f, 0x8000);
^~~~~~~~~~~~~~~~~
esp_eth_start
/home/esp32/esp/qemu_esp32/main/main.c:433:12: error: implicit declaration of function 'esp_eth_smi_read'; did you mean 'esp_eth_start'? [-Werror=implicit-function-declaration]
while (esp_eth_smi_read(0x2) != 0x2000) {
^~~~~~~~~~~~~~~~
esp_eth_start
/home/esp32/esp/qemu_esp32/main/main.c: In function 'ethernet_main':
/home/esp32/esp/qemu_esp32/main/main.c:487:5: warning: 'tcpip_adapter_init' is deprecated [-Wdeprecated-declarations]
tcpip_adapter_init();
^~~~~~~~~~~~~~~~~~
In file included from /home/esp32/esp/esp-idf/components/esp_netif/include/esp_netif.h:35,
from /home/esp32/esp/esp-idf/components/esp_event/include/esp_event_legacy.h:22,
from /home/esp32/esp/esp-idf/components/esp_event/include/esp_event.h:26,
from /home/esp32/esp/esp-idf/components/esp_wifi/include/esp_wifi.h:64,
from /home/esp32/esp/qemu_esp32/main/main.c:19:
/home/esp32/esp/esp-idf/components/tcpip_adapter/include/tcpip_adapter.h:34:6: note: declared here
void tcpip_adapter_init(void) attribute ((deprecated));
^~~~~~~~~~~~~~~~~~
/home/esp32/esp/qemu_esp32/main/main.c:488:5: warning: 'esp_event_loop_init' is deprecated [-Wdeprecated-declarations]
esp_event_loop_init(NULL, NULL);
^~~~~~~~~~~~~~~~~~~
In file included from /home/esp32/esp/esp-idf/components/esp_event/include/esp_event.h:26,
from /home/esp32/esp/esp-idf/components/esp_wifi/include/esp_wifi.h:64,
from /home/esp32/esp/qemu_esp32/main/main.c:19:
/home/esp32/esp/esp-idf/components/esp_event/include/esp_event_legacy.h:231:11: note: declared here
esp_err_t esp_event_loop_init(system_event_cb_t cb, void ctx) attribute ((deprecated));
^~~~~~~~~~~~~~~~~~~
/home/esp32/esp/qemu_esp32/main/main.c:490:5: error: unknown type name 'eth_config_t'; did you mean 'esp_eth_config_t'?
eth_config_t config;
^~~~~~~~~~~~
esp_eth_config_t
/home/esp32/esp/qemu_esp32/main/main.c:491:11: error: request for member 'phy_addr' in something not a structure or union
config.phy_addr = PHY31;
^
/home/esp32/esp/qemu_esp32/main/main.c:491:23: error: 'PHY31' undeclared (first use in this function)
config.phy_addr = PHY31;
^~~~~
/home/esp32/esp/qemu_esp32/main/main.c:491:23: note: each undeclared identifier is reported only once for each function it appears in
/home/esp32/esp/qemu_esp32/main/main.c:492:11: error: request for member 'mac_mode' in something not a structure or union
config.mac_mode = ETH_MODE_RMII;
^
/home/esp32/esp/qemu_esp32/main/main.c:492:23: error: 'ETH_MODE_RMII' undeclared (first use in this function)
config.mac_mode = ETH_MODE_RMII;
^~~~~~~~~~~~~
/home/esp32/esp/qemu_esp32/main/main.c:493:11: error: request for member 'phy_init' in something not a structure or union
config.phy_init = phy_tlk110_init;
^
/home/esp32/esp/qemu_esp32/main/main.c:494:11: error: request for member 'gpio_config' in something not a structure or union
config.gpio_config = eth_gpio_config_rmii;
^
/home/esp32/esp/qemu_esp32/main/main.c:495:11: error: request for member 'tcpip_input' in something not a structure or union
config.tcpip_input = tcpip_adapter_eth_input;
^
/home/esp32/esp/qemu_esp32/main/main.c:497:11: error: implicit declaration of function 'esp_eth_init'; did you mean 'esp_netif_init'? [-Werror=implicit-function-declaration]
ret = esp_eth_init(&config);
^~~~~~~~~~~~
esp_netif_init
/home/esp32/esp/qemu_esp32/main/main.c:499:9: error: implicit declaration of function 'esp_eth_enable'; did you mean 'esp_intr_enable'? [-Werror=implicit-function-declaration]
esp_eth_enable();
^~~~~~~~~~~~~~
esp_intr_enable
/home/esp32/esp/qemu_esp32/main/main.c: In function 'dump_regs':
/home/esp32/esp/qemu_esp32/main/main.c:522:19: warning: unused variable 'end' [-Wunused-variable]
unsigned int
end=(unsigned int
)0x400C1FFF;
^~~
/home/esp32/esp/qemu_esp32/main/main.c:521:18: warning: unused variable 'simple_mem_location' [-Wunused-variable]
unsigned intsimple_mem_location=(unsigned int)mem_location;
^~~~~~~~~~~~~~~~~~~
/home/esp32/esp/qemu_esp32/main/main.c: In function 'app_main':
/home/esp32/esp/qemu_esp32/main/main.c:601:2: warning: 'tcpip_adapter_init' is deprecated [-Wdeprecated-declarations]
tcpip_adapter_init();
^~~~~~~~~~~~~~~~~~
In file included from /home/esp32/esp/esp-idf/components/esp_netif/include/esp_netif.h:35,
from /home/esp32/esp/esp-idf/components/esp_event/include/esp_event_legacy.h:22,
from /home/esp32/esp/esp-idf/components/esp_event/include/esp_event.h:26,
from /home/esp32/esp/esp-idf/components/esp_wifi/include/esp_wifi.h:64,
from /home/esp32/esp/qemu_esp32/main/main.c:19:
/home/esp32/esp/esp-idf/components/tcpip_adapter/include/tcpip_adapter.h:34:6: note: declared here
void tcpip_adapter_init(void) attribute ((deprecated));
^~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
/home/esp32/esp/esp-idf/make/component_wrapper.mk:291: recipe for target 'main.o' failed
make[1]: *** [main.o] Error 1
/home/esp32/esp/esp-idf/make/project.mk:635: recipe for target 'component-main-build' failed
make: *** [component-main-build] Error 2

Any suggestion how to build it?

An Error about the port

When running the instruction, there is an error. Perhaps, I should 'make menuconfig' to change the port, but how I get the corresponding port? Thanks!
~/esp/esp-idf/components/esptool_py/esptool/esptool.py --chip esp32 -b 921600 -p /dev/ttyUSB0 dump_mem 0x40000000 0x000C2000 rom.bin
Error:
serial.serialutil.SerialException: [Errno 2] could not open port /dev/ttyUSB0: [Errno 2] No such file or directory: '/dev/ttyUSB0'

How to use sd card example

Hi,

I have followed the instructions in the readme file but can't successfully start 43_sdcard example. It shows me that sd card has not pullup resistors (or is not connected). Is is possible to emulate sd card in Linux?

Thanks

Michael.

Cannot send and receive on the same UART

It appears the serial interface cannot send and receive on the same UART.

The behavior can be see in esp-idf/examples/peripherals/uart/uart_events

Loading this example on a real ESP32 with a USB bridge connected to UART_0 anything typed on the terminal will be echo with uart_write_bytes and a ESP_LOGI call will be made on the default CONSOLE_UART, also UART_0

Loading this same example in qemu_esp32 will do nothing. But if uart_events/main/uart_events_example_main.c is edited to change...

#define EX_UART_NUM UART_NUM_0

to

#define EX_UART_NUM UART_NUM_1

It will work using two instances of nc connected to 8880 and 8881. In this case, anything typed into 8881 will be printed to 8880

flash read err, 1000

Thanks for creating such a fantastically useful project.

I'm seeing a problem with the QEMU version here. I've built apps using a number of the example programs, as well as the hello_world example, all compiled against the espressif esp-idf (v4.1). But they won’t run on this fork of QEMU even though they do run on the espressif fork.

Creating the app (I’ve tried it with a number with the same result):
$ pwd
/home/user/esp/qemu_esp32/examples/hello_world
$ make menuconfig

Set [*] Run FreeRTOS only on first core
[ ] Make exception and panic handlers JTAG/OCD aware

$ make
$ gcc ../../toflash.c -o qemu_flash
$ ./qemu_flash build/hello-world.bin

Ebiroll QEMU
$ xtensa-softmmu/qemu-system-xtensa -d guest_errors,unimp -cpu esp32 -M esp32 -m 4M -s > /dev/null

esp32flash.bin @ 4DE00000
VNC server running on 127.0.0.1:5900
ets Jun 8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
Falling back to built-in command interpreter.
OK

Espressif QEMU
I don't see the same behaviour when using the espressif version of QEMU – exactly the same flash loads fine.

Hello world!
This is ESP32 chip with 2 CPU cores, WiFi/BT/BLE, silicon revision 0, 2MB external flash
Restarting in 10 seconds...
Restarting in 9 seconds...
Restarting in 8 seconds...
Restarting in 7 seconds...
Restarting in 6 seconds...
Restarting in 5 seconds...
Restarting in 4 seconds...
Restarting in 3 seconds...
Restarting in 2 seconds...
Restarting in 1 seconds...
Restarting in 0 seconds...
Restarting now.

Clarify readme please

I see in the readme one step is to do 'mkdir qemu_esp32'
but then later the user is asked to clone a repo named qemu_esp32 and it seems both would be in $HOME/esp and would conflict.

I think I am misunderstanding something regarding the above.

Especially so because I don't see logs via telnet and the io.txt log file doesn't seem to show any of my code (gets stuck on wifi read 0x1c)

I tried both esp-idf master and v3.1.2

thanks!

float.s instructions causing unexpected exceptions?

this is FreeRTOS code for a screen using the float() function in device/display/frame_buffer.h

XRatio = float(getBufferWidth())/float(getScreenWidth()+1);
YRatio = float(getBufferHeight())/float(getScreenHeight()+1);

putting aside the screen for a moment (not relevant), this translates to a float.s instruction which is implemented in translate.c as

case 12: /*FLOAT.Sf*/
case 13: /*UFLOAT.Sf*/
if (gen_window_check1(dc, RRR_S) &&
gen_check_cpenable(dc, 0)) {
TCGv_i32 scale = tcg_const_i32(-RRR_T);
if (OP2 == 13) {
gen_helper_uitof(cpu_FR[RRR_R], cpu_env,
cpu_R[RRR_S], scale);
} else {
gen_helper_itof(cpu_FR[RRR_R], cpu_env,
cpu_R[RRR_S], scale);
}
tcg_temp_free(scale);
}
break;

the relevant check here is gen_check_cpenable(dc, 0) which is causing the exception to be thrown

Guru Meditation Error: Core 0 panic'ed (Coprocessor exception)

This is what cpenable is defined as in core-esp32/gdb-config.c

XTREG(137,548, 8, 4, 4,0x02e0,0x0007,-2, 2,0x1000,cpenable, 0,0,0,0,0,0)
no = 0x2e0
flags = 0x7 (b0111)

when dumping 'info all-registers' at the offending instruction, i find cpenable is completely 0

(gdb) info all-register
excsave7 0x0 0
cpenable 0x0 0
interrupt 0x0 0

The gen_check_cpenable(dc,0) check is a little strange itself
if the option is not enabled, we return true and don't throw an exception (that seems strange, shouldn't it exception?)
if the option is enabled, but the bit is clear, we throw an exception (that seems correct)
if the option is enabled, and the bit is not clear, we return true and don't throw an exception

the issue I have is this code runs without issue on a real ESP32, and it throws an exception on QEMU. It's a bit bizarre.

A few possible leads:

  1. Is it possible that cpenable is being initialized incorrectly?

  2. Is it possible FreeRTOS is using cpenable unintialized and the real device happens to have in initialized to CP0 being 1?

  3. Is there a possibility that a lazy-enable situation is happening here and isn't being handled correctly?

Can't follow readme please help

Hi,

I have my esp IDF stored in /opt/esp/esp-idf. So for step 1 from within /opt/esp I clone the repository and make it so end up with 2 new directories
/opt/esp/qemu_esp32
/opt/esp/qemu-xtensa-esp32

step 2 then puts the bin files in qemu_esp32

Step 3 - I am unclear what directory it assumes I am in to run cd esp. In my example does it assume I should be in /opt and therefore cd esp takes me to /opt/esp? If so, doesn't the clone conflict with step 1?

I have tried doing step 3 in ~ instead so it doesn't conflict but that doesn;t seem to work either.

I guess my challenge is I don;t quite understand what the steps are doing and therefore follow what I need to do - sorry.

Any help greatly appreciated.

thanks

Lee.

An Error about the port

When running the instruction, there is an error. Perhaps, I should 'make menuconfig' to change the port, but how I get the corresponding port? Thanks!
~/esp/esp-idf/components/esptool_py/esptool/esptool.py --chip esp32 -b 921600 -p /dev/ttyUSB0 dump_mem 0x40000000 0x000C2000 rom.bin
Error:
serial.serialutil.SerialException: [Errno 2] could not open port /dev/ttyUSB0: [Errno 2] No such file or directory: '/dev/ttyUSB0'

error: variable has incomplete type 'struct stat64'

CXX xtensa-softmmu/hw/xtensa/MemoryMapped.o
/Users/fanzhiri/GitHub/qemu-xtensa-esp32/hw/xtensa/MemoryMapped.cpp:132:17: error: variable has incomplete type 'struct stat64'
struct stat64 statInfo;
^
/Users/fanzhiri/GitHub/qemu-xtensa-esp32/hw/xtensa/MemoryMapped.cpp:132:10: note: forward declaration of 'stat64'
struct stat64 statInfo;

Dumping roms problem

Hello
I’ve followed your instruction and I got a problem with dumping roms from my ESP32. It is a copy of ESP32 devkit doit. Any attempt to dump roms failed giving me the following shown below.
Could you advise what is wrong? ESP32 is a new soc for me, therefore, any advice in this matter highly appreciated.
haps

esptool.py --chip esp32 -b 921600 -p com3: dump_mem 0x40000000 0x000C2000 rom.bin
esptool.py v3.0
Serial port com3:
Connecting.....
Chip is ESP32-D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 24:6f:28:aa:8e:c4
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
794624 bytes read... (100 %)Traceback (most recent call last):
File "C:\Users\xxxxx\AppData\Roaming\Python\Python39\Scripts\esptool.py-script.py", line 33, in
sys.exit(load_entry_point('esptool==3.0', 'console_scripts', 'esptool.py')())
File "C:\Users\xxxxx\AppData\Roaming\Python\Python39\site-packages\esptool.py", line 3962, in _main
main()
File "C:\Users\xxxx\AppData\Roaming\Python\Python39\site-packages\esptool.py", line 3604, in main
operation_func(esp, args)
File "C:\Users\xxx\AppData\Roaming\Python\Python39\site-packages\esptool.py", line 2840, in dump_mem
print_overwrite("Read %d bytes" % f.tell(), last_line=True)
ValueError: I/O operation on closed file

esptool.py --chip esp32 -b 921600 -p com3: dump_mem 0x3FF90000 0x00010000 rom1.bin
esptool.py v3.0
Serial port com3:
Connecting....
Chip is ESP32-D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 24:6f:28:aa:8e:c4
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
65536 bytes read... (100 %)Traceback (most recent call last):
File "C:\Users\xxx\AppData\Roaming\Python\Python39\Scripts\esptool.py-script.py", line 33, in
sys.exit(load_entry_point('esptool==3.0', 'console_scripts', 'esptool.py')())
File "C:\Users\xxx\AppData\Roaming\Python\Python39\site-packages\esptool.py", line 3962, in _main
main()
File "C:\Users\xxxx\AppData\Roaming\Python\Python39\site-packages\esptool.py", line 3604, in main
operation_func(esp, args)
File "C:\Users\xxxx\AppData\Roaming\Python\Python39\site-packages\esptool.py", line 2840, in dump_mem
print_overwrite("Read %d bytes" % f.tell(), last_line=True)
ValueError: I/O operation on closed file

MacOS compilation supported?

Hi before I dive deep into this very cool/fun project!
Is mac platform supported? Because I tried and immediately receive some errors like:

Error 1:

/Users/roderickgroesbeek/esp/qemu/qemu-xtensa-esp32/hw/xtensa/MemoryMapped.cpp:124:45: error: use of
undeclared identifier 'O_LARGEFILE'
_file = ::open(filename.c_str(), O_RDWR | O_LARGEFILE);

Error 2:

/Users/roderickgroesbeek/esp/qemu/qemu-xtensa-esp32/hw/xtensa/MemoryMapped.cpp:284:19: error: no member named
'mmap64' in the global namespace; did you mean 'mmap'?
_mappedView = ::mmap64(NULL, mappedBytes, PROT_READ | PROT_WRITE, MAP_SHARED, _file, offset);
~~^~~~~~
mmap

Error 3:

/Users/roderickgroesbeek/esp/qemu/qemu-xtensa-esp32/hw/xtensa/esp32_sha.c:331:13: error: void function
'esp_sha_write' should not return a value [-Wreturn-type]
return 0;
^ ~
/Users/roderickgroesbeek/esp/qemu/qemu-xtensa-esp32/hw/xtensa/esp32_sha.c:334:10: error: void function
'esp_sha_write' should not return a value [-Wreturn-type]
return 0;
^ ~

Fix for Error1 - 2:

unkphone-4:qemu-xtensa-esp32 roderickgroesbeek$ git diff
diff --git a/Makefile b/Makefile
index 50b4b3a..8f8dadd 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,5 @@

Makefile for QEMU.

+CFLAGS="$(CFLAGS) -Wno-return-type"

Always point to the root of the build tree (needs GNU make).

BUILD_DIR=$(CURDIR)
diff --git a/hw/xtensa/MemoryMapped.cpp b/hw/xtensa/MemoryMapped.cpp
index b3fc4fc..5cf6e1d 100644
--- a/hw/xtensa/MemoryMapped.cpp
+++ b/hw/xtensa/MemoryMapped.cpp
@@ -121,7 +121,8 @@ bool MemoryMapped::open(const std::string& filename, size_t mappedBytes, CacheHi
// Linux

// open file , O_RDONLY

  • _file = ::open(filename.c_str(), O_RDWR | O_LARGEFILE);
  • //[Unk] _file = ::open(filename.c_str(), O_RDWR | O_LARGEFILE);

  • _file = ::open(filename.c_str(), O_RDWR);
    if (_file == -1)
    {
    _file = 0;
    @@ -281,7 +282,8 @@ bool MemoryMapped::remap(uint64_t offset, size_t mappedBytes)

    // Linux
    // new mapping

  • _mappedView = ::mmap64(NULL, mappedBytes, PROT_READ | PROT_WRITE, MAP_SHARED, _file, offset);
  • //[Unk] _mappedView = ::mmap64(NULL, mappedBytes, PROT_READ | PROT_WRITE, MAP_SHARED, _file, offset);
  • _mappedView = ::mmap(NULL, mappedBytes, PROT_READ | PROT_WRITE, MAP_SHARED, _file, offset);
    if (_mappedView == MAP_FAILED)
    {
    _mappedBytes = 0;
    diff --git a/hw/xtensa/esp32.c b/hw/xtensa/esp32.c
    index f20af03..1e69771 100644
    --- a/hw/xtensa/esp32.c
    +++ b/hw/xtensa/esp32.c
    @@ -68,7 +68,7 @@ esp_err_t ulp_run(uint32_t entry_point)
    #else
    #include <pthread.h>
    #endif
    -#include <error.h>
    +//#include <error.h>
    #include "hw/i2c/i2c.h"
    #include "esp32_sha.h"

unkphone-4:qemu-xtensa-esp32 roderickgroesbeek$

Fix for Error3:

unkphone-4:qemu_esp32 roderickgroesbeek$ echo $CFLAGS
-Wno-return-type
unkphone-4:qemu_esp32 roderickgroesbeek$
unkphone-4:qemu_esp32 roderickgroesbeek$ ../qemu-xtensa-esp32/configure --disable-werror --extra-cflags="$CFLAGS" --prefix=pwd/root --target-list=xtensa-softmmu,xtensaeb-softmmu
unkphone-4:qemu_esp32 roderickgroesbeek$ make
unkphone-4:qemu_esp32 roderickgroesbeek$

So I can patch/hack it a little bit to have it compile...
But returning to my original question.
But should MacOS platform be supported very easily?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.