Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initializing WiFi in QEMU crashes the application (IDFGH-14296) #15087

Closed
3 tasks done
szekelyisz opened this issue Dec 24, 2024 · 2 comments
Closed
3 tasks done

Initializing WiFi in QEMU crashes the application (IDFGH-14296) #15087

szekelyisz opened this issue Dec 24, 2024 · 2 comments
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Bug bugs in IDF

Comments

@szekelyisz
Copy link

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

v5.5-dev-1050-gb5ac4fbdf9

Espressif SoC revision.

qemu

Operating System used.

Linux

How did you build your project?

Command line with idf.py

If you are using Windows, please specify command line type.

None

Development Kit.

QEMU

Power Supply used.

USB

What is the expected behavior?

The example to run in qemu.

What is the actual behavior?

It crashes.

Steps to reproduce.

  1. Make a copy of the wifi/getting_started/station example.
  2. Run idf.py qemu monitor

Debug Logs.

Running qemu on socket://localhost:5555
Adding "qemu"'s dependency "all" to list of commands with default set of options.
Executing action: all (aliases: build)
Running ninja in directory /home/szabi/Documents/GTR/PlaybackEngine/nodes/auranode/station/build
Executing "ninja all"...
[0/1] Re-running CMake...
-- Minimal build - ON
-- git rev-parse returned 'fatal: not a git repository (or any parent up to mount point /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).'
-- Could not use 'git describe' to determine PROJECT_VER.
-- Building ESP-IDF components for target esp32
-- Project sdkconfig file /home/szabi/Documents/GTR/PlaybackEngine/nodes/auranode/station/sdkconfig
Loading defaults file /home/szabi/Documents/GTR/PlaybackEngine/nodes/auranode/station/sdkconfig.defaults...
-- Compiler supported targets: xtensa-esp-elf
-- App "wifi_station" version: 1
-- Adding linker script /home/szabi/Documents/GTR/PlaybackEngine/nodes/auranode/station/build/esp-idf/esp_system/ld/memory.ld
-- Adding linker script /home/szabi/Documents/GTR/PlaybackEngine/nodes/auranode/station/build/esp-idf/esp_system/ld/sections.ld.in
-- Adding linker script /home/szabi/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.ld
-- Adding linker script /home/szabi/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.api.ld
-- Adding linker script /home/szabi/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
-- Adding linker script /home/szabi/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-data.ld
-- Adding linker script /home/szabi/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.syscalls.ld
-- Adding linker script /home/szabi/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.libc-funcs.ld
-- Adding linker script /home/szabi/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-reent-funcs.ld
-- Adding linker script /home/szabi/esp/esp-idf/components/soc/esp32/ld/esp32.peripherals.ld
-- Components: app_update bootloader bootloader_support cxx efuse esp_app_format esp_bootloader_format esp_coex esp_common esp_driver_gpio esp_driver_uart esp_driver_usb_serial_jtag esp_event esp_hw_support esp_mm esp_netif esp_netif_stack esp_partition esp_phy esp_pm esp_ringbuf esp_rom esp_security esp_system esp_timer esp_vfs_console esp_wifi esptool_py freertos hal heap log lwip main mbedtls newlib nvs_flash partition_table pthread soc spi_flash vfs wpa_supplicant xtensa
-- Component paths: /home/szabi/esp/esp-idf/components/app_update /home/szabi/esp/esp-idf/components/bootloader /home/szabi/esp/esp-idf/components/bootloader_support /home/szabi/esp/esp-idf/components/cxx /home/szabi/esp/esp-idf/components/efuse /home/szabi/esp/esp-idf/components/esp_app_format /home/szabi/esp/esp-idf/components/esp_bootloader_format /home/szabi/esp/esp-idf/components/esp_coex /home/szabi/esp/esp-idf/components/esp_common /home/szabi/esp/esp-idf/components/esp_driver_gpio /home/szabi/esp/esp-idf/components/esp_driver_uart /home/szabi/esp/esp-idf/components/esp_driver_usb_serial_jtag /home/szabi/esp/esp-idf/components/esp_event /home/szabi/esp/esp-idf/components/esp_hw_support /home/szabi/esp/esp-idf/components/esp_mm /home/szabi/esp/esp-idf/components/esp_netif /home/szabi/esp/esp-idf/components/esp_netif_stack /home/szabi/esp/esp-idf/components/esp_partition /home/szabi/esp/esp-idf/components/esp_phy /home/szabi/esp/esp-idf/components/esp_pm /home/szabi/esp/esp-idf/components/esp_ringbuf /home/szabi/esp/esp-idf/components/esp_rom /home/szabi/esp/esp-idf/components/esp_security /home/szabi/esp/esp-idf/components/esp_system /home/szabi/esp/esp-idf/components/esp_timer /home/szabi/esp/esp-idf/components/esp_vfs_console /home/szabi/esp/esp-idf/components/esp_wifi /home/szabi/esp/esp-idf/components/esptool_py /home/szabi/esp/esp-idf/components/freertos /home/szabi/esp/esp-idf/components/hal /home/szabi/esp/esp-idf/components/heap /home/szabi/esp/esp-idf/components/log /home/szabi/esp/esp-idf/components/lwip /home/szabi/Documents/GTR/PlaybackEngine/nodes/auranode/station/main /home/szabi/esp/esp-idf/components/mbedtls /home/szabi/esp/esp-idf/components/newlib /home/szabi/esp/esp-idf/components/nvs_flash /home/szabi/esp/esp-idf/components/partition_table /home/szabi/esp/esp-idf/components/pthread /home/szabi/esp/esp-idf/components/soc /home/szabi/esp/esp-idf/components/spi_flash /home/szabi/esp/esp-idf/components/vfs /home/szabi/esp/esp-idf/components/wpa_supplicant /home/szabi/esp/esp-idf/components/xtensa
-- Configuring done
-- Generating done
-- Build files have been written to: /home/szabi/Documents/GTR/PlaybackEngine/nodes/auranode/station/build
[0/1] Re-running CMake...
-- Minimal build - OFF
-- Building ESP-IDF components for target esp32
-- Project sdkconfig file /home/szabi/Documents/GTR/PlaybackEngine/nodes/auranode/station/sdkconfig
-- Compiler supported targets: xtensa-esp-elf
-- Adding linker script /home/szabi/esp/esp-idf/components/soc/esp32/ld/esp32.peripherals.ld
-- Bootloader project name: "bootloader" version: 1
-- Adding linker script /home/szabi/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.ld
-- Adding linker script /home/szabi/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.api.ld
-- Adding linker script /home/szabi/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
-- Adding linker script /home/szabi/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.libc-funcs.ld
-- Adding linker script /home/szabi/esp/esp-idf/components/bootloader/subproject/main/ld/esp32/bootloader.ld
-- Adding linker script /home/szabi/esp/esp-idf/components/bootloader/subproject/main/ld/esp32/bootloader.rom.ld
-- Components: bootloader bootloader_support efuse esp_app_format esp_bootloader_format esp_common esp_hw_support esp_rom esp_security esp_system esptool_py freertos hal log main micro-ecc newlib partition_table soc spi_flash xtensa
-- Component paths: /home/szabi/esp/esp-idf/components/bootloader /home/szabi/esp/esp-idf/components/bootloader_support /home/szabi/esp/esp-idf/components/efuse /home/szabi/esp/esp-idf/components/esp_app_format /home/szabi/esp/esp-idf/components/esp_bootloader_format /home/szabi/esp/esp-idf/components/esp_common /home/szabi/esp/esp-idf/components/esp_hw_support /home/szabi/esp/esp-idf/components/esp_rom /home/szabi/esp/esp-idf/components/esp_security /home/szabi/esp/esp-idf/components/esp_system /home/szabi/esp/esp-idf/components/esptool_py /home/szabi/esp/esp-idf/components/freertos /home/szabi/esp/esp-idf/components/hal /home/szabi/esp/esp-idf/components/log /home/szabi/esp/esp-idf/components/bootloader/subproject/main /home/szabi/esp/esp-idf/components/bootloader/subproject/components/micro-ecc /home/szabi/esp/esp-idf/components/newlib /home/szabi/esp/esp-idf/components/partition_table /home/szabi/esp/esp-idf/components/soc /home/szabi/esp/esp-idf/components/spi_flash /home/szabi/esp/esp-idf/components/xtensa
-- Configuring done
-- Generating done
-- Build files have been written to: /home/szabi/Documents/GTR/PlaybackEngine/nodes/auranode/station/build/bootloader
[100/101] Generating binary image from built executable
esptool.py v4.8.1
Creating esp32 image...
Merged 2 ELF sections
Successfully created esp32 image.
Generated /home/szabi/Documents/GTR/PlaybackEngine/nodes/auranode/station/build/bootloader/bootloader.bin
[101/101] cd /home/szabi/Documents/GTR/PlaybackEngine/nodes/auranode/stat...GTR/PlaybackEngine/nodes/auranode/station/build/bootloader/bootloader.bin
Bootloader binary size 0x6600 bytes. 0xa00 bytes (9%) free.
[697/698] Generating binary image from built executable
esptool.py v4.8.1
Creating esp32 image...
Merged 2 ELF sections
Successfully created esp32 image.
Generated /home/szabi/Documents/GTR/PlaybackEngine/nodes/auranode/station/build/wifi_station.bin
[698/698] cd /home/szabi/Documents/GTR/PlaybackEngine/nodes/auranode/stat...ocuments/GTR/PlaybackEngine/nodes/auranode/station/build/wifi_station.bin
wifi_station.bin binary size 0xaaf80 bytes. Smallest app partition is 0x100000 bytes. 0x55080 bytes (33%) free.
Executing action: qemu
Generating flash image: /home/szabi/Documents/GTR/PlaybackEngine/nodes/auranode/station/build/qemu_flash.bin
esptool.py --chip=esp32 merge_bin --output=/home/szabi/Documents/GTR/PlaybackEngine/nodes/auranode/station/build/qemu_flash.bin --fill-flash-size=2MB --flash_mode dio --flash_freq 40m --flash_size 2MB 0x1000 bootloader/bootloader.bin 0x10000 wifi_station.bin 0x8000 partition_table/partition-table.bin
esptool.py v4.8.1
SHA digest in image updated
Wrote 0x200000 bytes to file /home/szabi/Documents/GTR/PlaybackEngine/nodes/auranode/station/build/qemu_flash.bin, ready to flash to offset 0x0
Using existing efuse image: /home/szabi/Documents/GTR/PlaybackEngine/nodes/auranode/station/build/qemu_efuse.bin
Running qemu (bg): qemu-system-xtensa -M esp32 -m 4M -drive file=/home/szabi/Documents/GTR/PlaybackEngine/nodes/auranode/station/build/qemu_flash.bin,if=mtd,format=raw -drive file=/home/szabi/Documents/GTR/PlaybackEngine/nodes/auranode/station/build/qemu_efuse.bin,if=none,format=raw,id=efuse -global driver=nvram.esp32.efuse,property=drive,value=efuse -global driver=timer.esp32.timg,property=wdt_disable,value=true -nic user,model=open_eth -nographic -serial tcp::5555,server
Executing action: monitor
Running idf_monitor in directory /home/szabi/Documents/GTR/PlaybackEngine/nodes/auranode/station
Executing "/home/szabi/.espressif/python_env/idf5.5_py3.11_env/bin/python /home/szabi/esp/esp-idf/tools/idf_monitor.py -p socket://localhost:5555 -b 115200 --toolchain-prefix xtensa-esp32-elf- --target esp32 --revision 0 /home/szabi/Documents/GTR/PlaybackEngine/nodes/auranode/station/build/wifi_station.elf /home/szabi/Documents/GTR/PlaybackEngine/nodes/auranode/station/build/bootloader/bootloader.elf -m '/home/szabi/.espressif/python_env/idf5.5_py3.11_env/bin/python' '/home/szabi/esp/esp-idf/tools/idf.py'"...
--- esp-idf-monitor 1.5.0 on socket://localhost:5555 115200
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_RESET),boot:0x12 (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:0x3fff0030,len:6328
load:0x40078000,len:15828
load:0x40080400,len:3860
--- 0x40080400: _invalid_pc_placeholder at /home/szabi/esp/esp-idf/components/xtensa/xtensa_vectors.S:2235

entry 0x40080638
--- 0x40080638: call_start_cpu0 at /home/szabi/esp/esp-idf/components/bootloader/subproject/main/bootloader_start.c:25

I (688) boot: ESP-IDF v5.5-dev-1050-gb5ac4fbdf9 2nd stage bootloader
I (689) boot: compile time Dec 24 2024 01:59:56
I (690) boot: Multicore bootloader
I (747) boot: chip revision: v3.0
I (750) boot.esp32: SPI Speed      : 40MHz
I (751) boot.esp32: SPI Mode       : DIO
I (751) boot.esp32: SPI Flash Size : 2MB
I (760) boot: Enabling RNG early entropy source...
I (775) boot: Partition Table:
I (775) boot: ## Label            Usage          Type ST Offset   Length
I (775) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (775) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (776) boot:  2 factory          factory app      00 00 00010000 00100000
I (780) boot: End of partition table
I (830) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=17658h ( 95832) map
I (868) esp_image: segment 1: paddr=00027680 vaddr=3ff80000 size=0001ch (    28) load
I (894) esp_image: segment 2: paddr=000276a4 vaddr=3ffb0000 size=03eech ( 16108) load
I (918) esp_image: segment 3: paddr=0002b598 vaddr=40080000 size=04a80h ( 19072) load
I (949) esp_image: segment 4: paddr=00030020 vaddr=400d0020 size=7823ch (492092) map
I (1058) esp_image: segment 5: paddr=000a8264 vaddr=40084a80 size=12cf8h ( 77048) load
I (1145) boot: Loaded app from partition at offset 0x10000
I (1145) boot: Disabling RNG early entropy source...
I (1166) cpu_start: Multicore app
I (2038) cpu_start: Pro cpu start user code
I (2039) cpu_start: cpu freq: 160000000 Hz
I (2039) app_init: Application information:
I (2039) app_init: Project name:     wifi_station
I (2040) app_init: App version:      1
I (2040) app_init: Compile time:     Dec 24 2024 01:59:51
I (2040) app_init: ELF file SHA256:  4f12d50cd...
I (2040) app_init: ESP-IDF:          v5.5-dev-1050-gb5ac4fbdf9
I (2040) efuse_init: Min chip rev:     v0.0
I (2041) efuse_init: Max chip rev:     v3.99 
I (2041) efuse_init: Chip rev:         v3.0
I (2044) heap_init: Initializing. RAM available for dynamic allocation:
I (2046) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (2047) heap_init: At 3FFB8100 len 00027F00 (159 KiB): DRAM
I (2047) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (2047) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (2048) heap_init: At 40097778 len 00008888 (34 KiB): IRAM
I (2116) spi_flash: detected chip: winbond
I (2123) spi_flash: flash io: dio
I (2145) main_task: Started on CPU0
I (2155) main_task: Calling app_main()
I (2675) wifi station: ESP_WIFI_MODE_STA
I (2755) wifi:wifi driver task: 3ffbfe50, prio:23, stack:6656, core=0
I (2815) wifi:wifi firmware version: 34d97ea27
I (2815) wifi:wifi certification version: v7.0
I (2815) wifi:config NVS flash: enabled
I (2815) wifi:config nano formatting: disabled
I (2815) wifi:Init data frame dynamic rx buffer num: 32
I (2815) wifi:Init static rx mgmt buffer num: 5
I (2815) wifi:Init management short buffer num: 32
I (2815) wifi:Init dynamic tx buffer num: 32
I (2815) wifi:Init static rx buffer size: 1600
I (2815) wifi:Init static rx buffer num: 10
I (2815) wifi:Init dynamic rx buffer num: 32
I (2825) wifi_init: rx ba win: 6
I (2825) wifi_init: accept mbox: 6
I (2825) wifi_init: tcpip mbox: 32
I (2825) wifi_init: udp mbox: 6
I (2825) wifi_init: tcp mbox: 6
I (2825) wifi_init: tcp tx win: 5760
I (2825) wifi_init: tcp rx win: 5760
I (2825) wifi_init: tcp mss: 1440
I (2825) wifi_init: WiFi IRAM OP enabled
I (2825) wifi_init: WiFi RX IRAM OP enabled
I (3765) phy_init: phy_version 4840,02e0d70,Sep  2 2024,19:39:07
W (3765) phy_init: failed to load RF calibration data (0x1102), falling back to full calibration
Guru Meditation Error: Core  0 panic'ed (LoadStorePIFAddrError). Exception was unhandled.

Core  0 register dump:
PC      : 0x4012f3a8  PS      : 0x00060b30  A0      : 0x8010f65e  A1      : 0x3ffbfbc0  
--- 0x4012f3a8: register_chipv7_phy at /home/lxf/gittree/chip7.1_phy/chip_7.1/board_code/app_test/pp/phy/phy_chip_v7.c:3889

A2      : 0x3f411ecc  A3      : 0x3ffc62e0  A4      : 0x00000002  A5      : 0x60033c00  
A6      : 0x00000000  A7      : 0x00000000  A8      : 0x00000000  A9      : 0x3ffbfc60  
A10     : 0x00000000  A11     : 0x3f408f14  A12     : 0x3f4091a4  A13     : 0x3ffbfca0  
A14     : 0x00000000  A15     : 0x3ffbfcc0  SAR     : 0x00000000  EXCCAUSE: 0x0000000f  
EXCVADDR: 0x60033c00  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0xffffffff  
--- 0x4000c2e0: memcpy in ROM
0x4000c2f6: memcpy in ROM



Backtrace: 0x4012f3a5:0x3ffbfbc0 0x4010f65b:0x3ffbfcc0 0x4010f6f5:0x3ffbfcf0 0x40145fb1:0x3ffbfd10 0x400f8dca:0x3ffbfd30 0x400f966a:0x3ffbfd50 0x400f80b6:0x3ffbfd70 0x40092741:0x3ffbfd90 0x4008a115:0x3ffbfdc0
--- 0x4012f3a5: register_chipv7_phy at /home/lxf/gittree/chip7.1_phy/chip_7.1/board_code/app_test/pp/phy/phy_chip_v7.c:3889
0x4010f65b: esp_phy_load_cal_and_init at /home/szabi/esp/esp-idf/components/esp_phy/src/phy_init.c:930
0x4010f6f5: esp_phy_enable at /home/szabi/esp/esp-idf/components/esp_phy/src/phy_init.c:304
0x40145fb1: esp_phy_enable_wrapper at /home/szabi/esp/esp-idf/components/esp_wifi/esp32/esp_adapter.c:604
0x400f8dca: wifi_hw_start at ??:?
0x400f966a: wifi_start_process at ??:?
0x400f80b6: ieee80211_ioctl_process at ??:?
0x40092741: ppTask at ??:?
0x4008a115: vPortTaskWrapper at /home/szabi/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:139





ELF file SHA256: 4f12d50cd

More Information.

The hello_world example works fine in qemu.

@szekelyisz szekelyisz added the Type: Bug bugs in IDF label Dec 24, 2024
@github-actions github-actions bot changed the title Initializing WiFi in QEMU crashes the application Initializing WiFi in QEMU crashes the application (IDFGH-14296) Dec 24, 2024
@espressif-bot espressif-bot added the Status: Opened Issue is new label Dec 24, 2024
@o-marshmallow
Copy link
Collaborator

o-marshmallow commented Dec 24, 2024

Hello @szekelyisz ,

You won't be able to run the Wifi examples since wifi is not supported in our QEMU fork. For networking, we implement an ethernet driver that can be enabled in ESP-IDF in the menuconfig via the option Support OpenCores Ethernet MAC (for use with QEMU).

Also, please note that we have another repository for QEMU issues: https://github.com/espressif/qemu/issues/

@szekelyisz
Copy link
Author

Thanks @o-marshmallow I will try that. I think this should be mentioned in the docs, but that's another story.

@espressif-bot espressif-bot added Status: Done Issue is done internally Resolution: Done Issue is done internally and removed Status: Opened Issue is new labels Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Bug bugs in IDF
Projects
None yet
Development

No branches or pull requests

4 participants