Giter Site home page Giter Site logo

Unable to run echo test about esp32_awho HOT 32 CLOSED

ebiroll avatar ebiroll commented on July 2, 2024
Unable to run echo test

from esp32_awho.

Comments (32)

antfobe avatar antfobe commented on July 2, 2024 1

Well I'll close the issue since the problem is not related to your code.

from esp32_awho.

antfobe avatar antfobe commented on July 2, 2024 1

Was able to get a http_server running with espressif's qemu, after they applied your patch: issue2.

Thank you once more!

from esp32_awho.

Ebiroll avatar Ebiroll commented on July 2, 2024

OK. What version of esp-idf did you use?

When I tested I got,
csum err:0xe4!=0xff
Falling back to built-in command interpreter.
Was not able to create a proper qemu flash file.
However try
xtensa-softmmu/qemu-system-xtensa -d guest_errors -cpu esp32 -M esp32 -m 4M -net nic,model=vlan0 -net user,id=simnet,ipver4=on,net=192.168.122.0/24,host=192.168.122.1,hostfwd=tcp::10007-192.168.1.3:7 -net dump,file=/tmp/vm0.pcap -s > io,txt

Then look at the capture with wireshark /tmp/vm0.pcap

from esp32_awho.

Ebiroll avatar Ebiroll commented on July 2, 2024

The simulated ip address is 192.168.1.3 and the echo server should be on port 7 so those values are mandatory. You can however probably change them in emulwiP.c.

from esp32_awho.

antfobe avatar antfobe commented on July 2, 2024

Thanks for the quick reply! here it goes:

ESP_IDF_VERSION: ESP-IDF v4.1-dev-592-g758db1e00
And a quick video with what I got - nc terminates just after stablishing a connection:
ebiroll_qemuesp32net-05112019

The /tmp/vm0.pcap file only displays one line with tcpdump -r /tmp/vm0.pcap:
reading from file /tmp/vm0.pcap, link-type EN10MB (Ethernet)

from esp32_awho.

Ebiroll avatar Ebiroll commented on July 2, 2024

OK.
Nice animation.
But are you sure emulation starts correctly? if you pipe to io.txt you should see the normal boot message as the esp32 output is sent to stderr.

from esp32_awho.

antfobe avatar antfobe commented on July 2, 2024

let me add my io.txt:
cmd: /opt/qemu-esp32/xtensa-softmmu/qemu-system-xtensa -d guest_errors -cpu esp32 -M esp32 -m 4M -net nic,model=vlan0 -net user,id=simnet,ipver4=on,net=192.168.122.1/24,host=192.168.122.1,hostfwd=tcp::10007-192.168.122.3:7 -net dump,file=/tmp/vm0.pcap > io.txt
io.txt

from esp32_awho.

antfobe avatar antfobe commented on July 2, 2024

Also netcat -v 192.168.122.3 outputs:
nc: connect to 192.168.122.3 port 7 (tcp) failed: No route to host
Is there any additional network configuration I must do? From what i remember -net nic should take care of everything

from esp32_awho.

Ebiroll avatar Ebiroll commented on July 2, 2024

Oh. Your emulator does not start, :-(
Do you have all the files.
ls -lah rom*.bin
-rw-r--r-- 1 olof users 64K 30 dec 2016 rom1.bin
-rw-r--r-- 1 olof users 776K 30 dec 2016 rom.bin
ls -lah esp32flash.bin
rw-r--r-- 1 olof users 4,0M 5 nov 19.59 esp32flash.bin

from esp32_awho.

Ebiroll avatar Ebiroll commented on July 2, 2024

This is my output...

esp32flash.bin @ 62E00000
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:6880
ho 0 tail 12 room 4
load:0x40078000,len:14692
load:0x40080400,len:4292
entry 0x400806e4
I (11) boot: Chip Revision: 0
I (4) boot: ESP-IDF v4.0-beta1-279-g0a03a55c1 2nd stage bootloader
I (4) boot: compile time 19:55:16
I (4) boot: Enabling RNG early entropy source...
I (4) boot: SPI Speed : 40MHz
I (4) boot: SPI Mode : DIO
I (4) boot: SPI Flash Size : 2MB
I (4) boot: Partition Table:
I (4) boot: ## Label Usage Type ST Offset Length
I (4) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (4) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (4) boot: 2 factory factory app 00 00 00010000 00100000
I (4) boot: End of partition table
I (4) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x0c4b0 ( 50352) map
I (11) esp_image: segment 1: paddr=0x0001c4d8 vaddr=0x3ffb0000 size=0x018a0 ( 6304) load
I (12) esp_image: segment 2: paddr=0x0001dd80 vaddr=0x40080000 size=0x00400 ( 1024) load
I (13) esp_image: segment 3: paddr=0x0001e188 vaddr=0x40080400 size=0x01e88 ( 7816) load
I (14) esp_image: segment 4: paddr=0x00020018 vaddr=0x400d0018 size=0x2ddb8 (187832) map
I (39) esp_image: segment 5: paddr=0x0004ddd8 vaddr=0x40082288 size=0x0732c ( 29484) load
HOST RER TBD
E (43) esp_image: Image hash failed - image is corrupt
E (44) boot: Factory app partition is not bootable
E (44) boot: No bootable app partitions in the partition table

from esp32_awho.

Ebiroll avatar Ebiroll commented on July 2, 2024

Now I got it running. Remove the sdkconfig file.
Then make sure you set it to running on one core only.

from esp32_awho.

antfobe avatar antfobe commented on July 2, 2024

I do have them, ls -sh: 4,0M esp32flash.bin 64K rom1.bin 776K rom.bin. How are you generating the esp32flash?
Im doing ESP_IDF_PATH=/opt/esp-idf PATH="$PATH:/opt/esp-idf/espressif/tools/xtensa-esp32-elf/esp32-2019r1-8.2.0/xtensa-esp32-elf/bin" make && gcc toflash.c -o qemu_flash && ./qemu_flash build/awho.bin

from esp32_awho.

antfobe avatar antfobe commented on July 2, 2024

Now I got it running. Remove the sdkconfig file.
Then make sure you set it to running on one core only.

Still nothing for me :(

Im using your setup from https://github.com/Ebiroll/qemu_esp32 - is it the same you are using for this project?

from esp32_awho.

antfobe avatar antfobe commented on July 2, 2024

Tried changing the subnet from 122 to 1, so my shell command would be just like this project's README, but no success either

Can you reply with a zip containing your binaries? esp32flash.bin and the xtensa-softmmu/qemu-system-xtensa

from esp32_awho.

Ebiroll avatar Ebiroll commented on July 2, 2024

You have to modify the toflash.c file so it that it copies the flash file to your /opt/qemu location...

system("cp esp32flash.bin ~/qemu_esp32");

from esp32_awho.

Ebiroll avatar Ebiroll commented on July 2, 2024

You should also do a git pull to get the changes I made. The emulation part was a little outdated.

from esp32_awho.

Ebiroll avatar Ebiroll commented on July 2, 2024

from esp32_awho.

Ebiroll avatar Ebiroll commented on July 2, 2024

However there is probably some other error with the rom dumps. This is my io.txt file

esp32_init
Socket created
bind done
Socket created
bind done
Waiting for incoming connections...
Waiting for incoming connections...
Waiting for incoming connections...
Waiting for incoming connections...
Socket created
bind done
Waiting for incoming connections...
Waiting for incoming connections...
Open net
trace_sysbus_open_eth_init
Flash map data to 00000000 to memory, 3F400000
trace_sysbus_open_eth_reset
io read 44 DPORT_PRO_CACHE_CTRL1_REG 3ff00044=8E6
io write 44,8e6
DPORT_PRO_CACHE_CTRL1_REG 3ff00044 8e6
io read 48034 RTC_CNTL_RESET_STATE_REG 3ff48034=3390
io read 48088 RTC_CNTL_DIG_ISO_REG 3ff48088=00000000
io write 48088,0
RTC_CNTL_DIG_ISO_REG 3ff48088
io read 48088 RTC_CNTL_DIG_ISO_REG 3ff48088=00000000
io write 48088,400
RTC_CNTL_DIG_ISO_REG 3ff48088
io read 5f06c TIMG_RTCCALICFG1_REG 3ff5f06c=0x25
io read 5a010 EFUSE_BLK0_RDATA4_REG 3ff5a010=01
io read 480b4 RTC_CNTL_STORE5_REG 3ff480b4=00000000
io read 480b4 RTC_CNTL_STORE5_REG 3ff480b4=00000000
io write 480b4,0
RTC_CNTL_STORE5_REG 3ff480b4 0
io read 48474
io write 48474,0
io read 48474
io write 48474,0
io read 49088
io write 49088,0
io read 49088
io write 49088,0
io write 18c,5

You can try without network arguments.
xtensa-softmmu/qemu-system-xtensa -d guest_errors -cpu esp32 -M esp32 -m 4M

from esp32_awho.

Ebiroll avatar Ebiroll commented on July 2, 2024

You should double check the rom.bin file. What hardware did you use to make the dump?
Here is what mine starts with

00000000: 4910 d549 20e5 4930 f549 0034 0000 ..I..I .I0.I.4..
00000010: 2841 3851 4861 12d1 0100 d113 0048 03f0 (A8QHa.......H..
00000020: 8040 20e6 0320 3834 4033 3046 0800 0000 .@ .. 84@30F....
00000030: 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000040: 00c5 0910 d509 20e5 0930 f509 0035 0000 ...... ..0...5..
00000050: 40d1 0380 3311 3022 3020 e613 1020 00f7 @...3.0"0 ... ..
00000060: 74dd f080 40e7 7857 f080 4046 3400 0000 [email protected]..@f4...
00000070: 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000080: 00c9 4900 d109 10d9 4920 e949 30f9 4940 ..I.....I .I0.I@
00000090: 8049 5090 4960 a049 70b0 4900 3400 0000 .IP.I.Ip.I.4... 000000a0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 000000b0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 000000c0: 00c9 0910 d909 20e9 0970 d109 30f9 0940 ...... ..p..0..@ 000000d0: 8709 5097 0960 a709 70b7 0900 3500 0000 ..P....p...5...
000000e0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
000000f0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000100: 00cd 4900 d109 10dd 4920 ed49 30fd 4940 ..I.....I .I0.I@
00000110: 4049 5050 4960 6049 7070 4980 8049 9090 @IPPI``IppI..I..
00000120: 49a0 a049 b0b0 4900 3400 0000 0000 0000 I..I..I.4.......
00000130: 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000140: 00cd 0910 dd09 20ed 09b0 d109 30fd 0940 ...... .....0..@
00000150: 4b09 505b 0960 6b09 707b 0980 8b09 909b K.P[.`k.p{......
00000160: 09a0 ab09 b0bb 0900 3500 0000 4804 fe3f ........5...H..?
00000170:

from esp32_awho.

antfobe avatar antfobe commented on July 2, 2024

You should double check the rom.bin file. What hardware did you use to make the dump?
Here is what mine starts with

00000000: 4910 d549 20e5 4930 f549 0034 0000 ..I..I .I0.I.4..
00000010: 2841 3851 4861 12d1 0100 d113 0048 03f0 (A8QHa.......H..
00000020: 8040 20e6 0320 3834 4033 3046 0800 0000 .@ .. 84@30F....

Indeed mine looks very different:
rom.bin.txt

And just checked, they are from an esp8266, not esp32 - funny thing is that the 06_1306_interactive example worked

from esp32_awho.

Ebiroll avatar Ebiroll commented on July 2, 2024

You are right. Your rom dump matches the 8266.rom
https://github.com/OSLL/qemu-xtensa/blob/ffe1be088d55882d49b3e5557dcc0a6762f15e1b/pc-bios/esp8266.rom
That is really interesting. I downloaded and tested with the esp8266 rom but it does not really boot up properly.
esp32flash.bin @ 4CA00000
RESERVED(pc = 4000040c, fffe00): /home/olof/qemu-xtensa-esp32/target-xtensa/translate.c:3105
INVALID(pc = 4000040c)
RESERVED(pc = 400003c0, 600000): /home/olof/qemu-xtensa-esp32/target-xtensa/translate.c:1075
INVALID(pc = 400003c0)
I think you will be more successful with a esp32 rom dump.

from esp32_awho.

antfobe avatar antfobe commented on July 2, 2024

Oh cool didnt know OSLL had the roms - this should probably be rom1: https://github.com/OSLL/qemu-xtensa/blob/xtensa-esp32/pc-bios/esp32-40000000.rom

At least it matches the beginning of yours above:
00000000 00 c5 49 10 d5 49 20 e5 49 30 f5 49 00 34 00 00 |..I..I .I0.I.4..|
00000010 28 41 38 51 48 61 12 d1 01 00 d1 13 00 48 03 f0 |(A8QHa.......H..|
00000020 80 40 20 e6 03 20 38 34 40 33 30 46 08 00 00 00 |.@ .. 84@30F....|
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000040 00 c5 09 10 d5 09 20 e5 09 30 f5 09 00 35 00 00 |...... ..0...5..|
00000050 40 d1 03 80 33 11 30 22 30 20 e6 13 10 20 00 f7 |@...3.0"0 ... ..|
00000060 74 dd f0 80 40 e7 78 57 f0 80 40 46 34 00 00 00 |[email protected]..@f4...|
00000070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000080 00 c9 49 00 d1 09 10 d9 49 20 e9 49 30 f9 49 40 |..I.....I .I0.I@|
00000090 80 49 50 90 49 60 a0 49 70 b0 49 00 34 00 00 00 |.IP.I`.Ip.I.4...|

from esp32_awho.

Ebiroll avatar Ebiroll commented on July 2, 2024

Thanks for the tips. I have been looking for a rom dump as it would allow running qemu on travis or circleCI.

His rom dumps does not match my mapping. I also make a dump of parts or the RAM but never got time to fix that.

from esp32_awho.

antfobe avatar antfobe commented on July 2, 2024

And sorry man going to reopen, since it isn't working with the right rom (esp32).

Here's what I'm doing:
ebiroll_weird_qemu

What I noticed is that the build/phy_init_data.bin is missing. What generates it?
Oh yeah - and I made the changes to toflash.c:

97c97
< system("cp esp32flash.bin qemu_esp32");

> system("cp esp32flash.bin ~/qemu_esp32");

Since from what I'm doing the call to qemu is made from the project (awho) folder.

from esp32_awho.

Ebiroll avatar Ebiroll commented on July 2, 2024

I am not sure what generates build/phy_init_data.bin but you can comment that out.
Maybe it was in ESP-IDF v4.0-beta1-279-g0a03a55c1
The romfiles from OSSL does not work. I am investigating.

from esp32_awho.

Ebiroll avatar Ebiroll commented on July 2, 2024

I did some investigation and most likely I do not emulate the boot process correctly or his romdump is not complete.
In both cases you need cannot use his romdump. Instead try,
~/esp/esp-idf/components/esptool_py/esptool/esptool.py --chip esp32 -b 921600 -p /dev/ttyUSB0 dump_mem 0x40000000 0x000C2000 rom.bin

from esp32_awho.

antfobe avatar antfobe commented on July 2, 2024

I did some investigation and most likely I do not emulate the boot process correctly or his romdump is not complete.
In both cases you need cannot use his romdump. Instead try,
~/esp/esp-idf/components/esptool_py/esptool/esptool.py --chip esp32 -b 921600 -p /dev/ttyUSB0 dump_mem 0x40000000 0x000C2000 rom.bin

Can't find my esp32, I must've borrowed to someone - ordered a new one (wroom-32) should arrive in a few days

from esp32_awho.

Ebiroll avatar Ebiroll commented on July 2, 2024

Hello. I noticed that espressif recently released a qemu implementation.
https://github.com/espressif/qemu

Maybe there is a rom there. I have not looked into it so much but the implementation is probably more correct than mine.

https://github.com/espressif/qemu

Please tell me how it goes.

from esp32_awho.

Ebiroll avatar Ebiroll commented on July 2, 2024

Found some instructions.
https://github.com/espressif/qemu/wiki

Also found this,
https://github.com/gschorcht/esp32-elf-rom

from esp32_awho.

Ebiroll avatar Ebiroll commented on July 2, 2024

F.Y.I. No usable rom.elf file found there
Here is the file you need.

https://drive.google.com/open?id=0BzWk4S_FHpPtdWdoRnM2bTF0cE0

from esp32_awho.

antfobe avatar antfobe commented on July 2, 2024

F.Y.I. No usable rom.elf file found there
Here is the file you need.

https://drive.google.com/open?id=0BzWk4S_FHpPtdWdoRnM2bTF0cE0

Sorry for the wait, the esp32 chip just arrived, here is the rom dump, output of esptool.py --chip esp32 -b 921600 -p /dev/ttyUSB0 dump_mem 0x40000000 0x000C2000 rom.bin:
rom.bin-dump.txt

And the io.txt:
io.txt

My cmds: /opt/qemu-esp32/xtensa-softmmu/qemu-system-xtensa -d guest_errors -cpu esp32 -M esp32 -m 4M -net nic,model=vlan0 -net user,id=simnet,ipver4=on,net=192.168.1.0/24,host=192.168.1.19,hostfwd=tcp::10007-192.168.1.3:7 -net dump,file=/tmp/vm0.pcap -s > io.txt
ESP_IDF_PATH=/opt/esp-idf PATH="$PATH:/opt/zephyr-os/crosstool-NG/builds/xtensa-esp32-elf/bin" make && gcc toflash.c -o qemu_flash && ./qemu_flash build/awho.bin
From the looks of it, Im still getting the same problem - will trace my steps from Ebiroll/qemu_esp32.

And I also checked the espressif and gschorcht links above - Gschorcht works in riot-os, I emailed him asking him if he managed to get network working in qemu for esp8266 (unfortunately, he replied that it wasnt possible).

from esp32_awho.

antfobe avatar antfobe commented on July 2, 2024

Oops sorry had that rom.bin above as rom1!
Heres the io.txt (with rom.bin above as rom.bin):
esp32_init
Socket created
Socket created
bind done
Socket created
bind done
Waiting for incoming connections...
Waiting for incoming connections...
bind done
Waiting for incoming connections...
Waiting for incoming connections...
Waiting for incoming connections...
Waiting for incoming connections...
Open net
trace_sysbus_open_eth_init
Flash map data to 00000000 to memory, 3F400000
trace_sysbus_open_eth_reset
io read 44 DPORT_PRO_CACHE_CTRL1_REG 3ff00044=8E6
io write 44,8e6
DPORT_PRO_CACHE_CTRL1_REG 3ff00044 8e6
io read 48034 RTC_CNTL_RESET_STATE_REG 3ff48034=3390
io read 48088 RTC_CNTL_DIG_ISO_REG 3ff48088=00000000
io write 48088,0
RTC_CNTL_DIG_ISO_REG 3ff48088
io read 48088 RTC_CNTL_DIG_ISO_REG 3ff48088=00000000
io write 48088,400
RTC_CNTL_DIG_ISO_REG 3ff48088
io read 5f06c TIMG_RTCCALICFG1_REG 3ff5f06c=0x25
io read 5a010 EFUSE_BLK0_RDATA4_REG 3ff5a010=01
io read 480b4 RTC_CNTL_STORE5_REG 3ff480b4=00000000
io read 480b4 RTC_CNTL_STORE5_REG 3ff480b4=00000000
io write 480b4,0
RTC_CNTL_STORE5_REG 3ff480b4 0

Additionally, esp32flash.bin @ D6A00000 SIMCALL but semihosting is disabled
to stderr

from esp32_awho.

Related Issues (1)

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.