espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
12.88k stars 7.08k forks source link

Persistent Boot Failure on ESP32-S3 (IDFGH-13089) #14035

Open Gspohu opened 1 week ago

Gspohu commented 1 week ago

Answers checklist.

General issue report

Board

ESP32-S3-WROOM-1U-N4R2

Device Description

Plain module

Version

IDF v5.1.4

IDE Name

PlatformIO

Operating System

Linux Ubuntu 22.04

Flash frequency

80

PSRAM enabled

yes

Upload speed

115200

Description

Hello,

I am experiencing a consistent boot failure issue with my ESP32-S3, regardless of the complexity or simplicity of the firmware I attempt to upload. This issue persists across both my pretty complex custom firmware and basic example code, such as the WiFi connection example. The behavior suggests a fundamental problem related to the boot process.

Issue Description

The device fails to boot properly. The error message that is consistently output is as follows:

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0xc (RTC_SW_CPU_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x40377989
...
E (681) mmap: esp_mmu_unmap(595): munmap target pointer is outside external memory regions
assert failed: spi_flash_munmap flash_mmap.c:241 (0 && "invalid handle, or handle already unmapped")
Backtrace: 0x40377d1e:0x3fcf4610 ...
ELF file SHA256: fd4bb4dfa7adf1ca

My point of view is that it's linked to the model chip I have.

I'm currently stuck on this model of chip, but it's not the first time I've had to unravel memory-related boot problems with this model of chip ESP32-S3-WROOM-1U-N4R2.

Additional Context

This seems to be a regression or a newly introduced bug associated with the latest updates. Any guidance or suggestions on how to mitigate this issue would be greatly appreciated. Thank you for your attention to this matter.

Debug Message

rst:0xc (RTC_SW_CPU_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x40377989
SPIWP:0xee
mode
, clock div:1
load:0x3fce3818,len:0x508
load:0x403c9700,len:0x4
load:0x403c9704,len:0xad0
load:0x403cc700,len:0x29e4
entry 0x403c9880
E (681) mmap: esp_mmu_unmap(595): munmap target pointer is outside external memory regions

assert failed: spi_flash_munmap flash_mmap.c:241 (0 && "invalid handle, or handle already unmapped")

Backtrace: 0x40377d1e:0x3fcf4610 0x4037d915:0x3fcf4630 0x403838a5:0x3fcf4650 0x4201d19b:0x3fcf4780 0x4201cbd1:0x3fcf47a0 0x4201ccd5:0x3fcf47c0 0x4201d06f:0x3fcf47f0 0x42014784:0x3fcf4850 0x420167a2:0x3fcf4890 0x420c4ac9:0x3fcf48c0 0x4038064a:0x3fcf4900

ELF file SHA256: fd4bb4dfa7adf1ca

I took the time to make a more methodical study of the problem, to understand when it first appeared.

So I went back to the version where I was before the problem appeared. Here's a table summarising my research/tests: Date Commit Build ? Start ? WiFi ? WPS ? Note Note
29/04/2024 platform = https://github.com/platformio/platform-espressif32.git
platform_packages =
framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git#7e7c01aadf81af799ab296574827d16ddfe8621f
framework-arduinoespressif32-libs@https://github.com/espressif/esp32-arduino-libs.git#b0850286f4be64cb08eeedcf1594cbd5b59ea7f1
Yes Yes Yes Yes
02/05/2024 platform = https://github.com/platformio/platform-espressif32.git
platform_packages =
framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git#5a023568a640f7b55f40381a28389d05df3af9c5
framework-arduinoespressif32-libs@https://github.com/espressif/esp32-arduino-libs.git#9250b6970c27d2863935fad42fd8d491b4731ff1
Yes Yes Yes Yes
07/05/2024 platform = https://github.com/platformio/platform-espressif32.git
platform_packages =
framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git#789b1a84258e1b50f40d651be8a3f39226c98753
framework-arduinoespressif32-libs@https://github.com/espressif/esp32-arduino-libs.git#831d0d92c7c998493dbc379798b8efe4c617b300
Yes Yes Yes Yes
08/05/2024 platform = https://github.com/platformio/platform-espressif32.git
platform_packages =
framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git#e883a2ccfac32b64b50926a3c8a498745a9546de
framework-arduinoespressif32-libs@https://github.com/espressif/esp32-arduino-libs.git#07d6415e1df493c23a3091761be59ece49527313
Yes Yes Yes Yes
13/05/2024 platform = https://github.com/platformio/platform-espressif32.git
platform_packages =
framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git#0c4b35e07ea696a94de859151c00acbef12eda7f
framework-arduinoespressif32-libs@https://github.com/espressif/esp32-arduino-libs.git#951ade74d7886e1ce931ea46614c4ac47ae3a6c0
Yes Yes Yes Yes
22/05/2024 platform = https://github.com/platformio/platform-espressif32.git
platform_packages =
framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git#d164df89de350aa945ccb0cb4261f56306bfdb3c
framework-arduinoespressif32-libs@https://github.com/espressif/esp32-arduino-libs.git#8206d4ee579b83a955ba22dfa45588c836522c0b
Yes Yes Yes Yes
29/05/2024 platform = https://github.com/platformio/platform-espressif32.git
platform_packages =
framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git#79b835059f6a2f39b74dde92144909a52617ee5f
framework-arduinoespressif32-libs@https://github.com/espressif/esp32-arduino-libs.git#db132bfa666a5b1705ec810d9addbb8aaede2b33
Yes Yes Yes Yes
30/05/2024 platform = https://github.com/platformio/platform-espressif32.git
platform_packages =
framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git#c16a325439fe5a8a3160701d9601634155bb1443
framework-arduinoespressif32-libs@https://github.com/espressif/esp32-arduino-libs.git#80ef50f35ae7f6736ad639c236c846cac8a9750e
Yes Yes Yes Yes
04/06/2024 platform = https://github.com/platformio/platform-espressif32.git
platform_packages =
framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git#640523827be8db2ed201623f107569a6dd1b2a13
framework-arduinoespressif32-libs@https://github.com/espressif/esp32-arduino-libs.git#a6dac936bfcfa4c11468e003f550b41c76efeae6
Yes Yes Yes Yes
05/06/2024 platform = https://github.com/platformio/platform-espressif32.git
platform_packages =
framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git#cc50d90ce4ff7414015dfc597eb083d427b86faf
framework-arduinoespressif32-libs@https://github.com/espressif/esp32-arduino-libs.git#a6dac936bfcfa4c11468e003f550b41c76efeae6
Yes Yes Yes Yes Release 3.0.1
06/06/2024 platform = https://github.com/platformio/platform-espressif32.git
platform_packages =
framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git#5d9cd9ac58471624c07295112095cc3864b9cbaf
framework-arduinoespressif32-libs@https://github.com/espressif/esp32-arduino-libs.git#a6dac936bfcfa4c11468e003f550b41c76efeae6
Yes Yes ? ? esp32-arduino-libs of 04/06/2024 Impossible to monitor, USB or UART. But the LED start and is green, so we can think that the WiFi is connected
07/06/2024 platform = https://github.com/platformio/platform-espressif32.git
platform_packages =
framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git#e3fedc5e8c47427d2fc8c4b45c60dd083243d786
framework-arduinoespressif32-libs@https://github.com/espressif/esp32-arduino-libs.git#a6dac936bfcfa4c11468e003f550b41c76efeae6
Yes Yes ? ? esp32-arduino-libs of 04/06/2024 Impossible to monitor in USB but in UART I can see somme debug line about the WiFi but that's all, nothing more. But the LED start and is green, so we can think that the WiFi is connected
10/06/2024 platform = https://github.com/platformio/platform-espressif32.git
platform_packages =
framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git#575a415719d875f88460ec1461408597744f7053
framework-arduinoespressif32-libs@https://github.com/espressif/esp32-arduino-libs.git#a6dac936bfcfa4c11468e003f550b41c76efeae6
Yes Yes ? ? esp32-arduino-libs of 04/06/2024 Impossible to monitor in USB but in UART I can see somme debug line about the WiFi but that's all, nothing more. But the LED start and is green, so we can think that the WiFi is connected
12/06/2024 platform = https://github.com/platformio/platform-espressif32.git
platform_packages =
framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git#e382746b95be9f19a74a10408ae3e250e36e1930
framework-arduinoespressif32-libs@https://github.com/espressif/esp32-arduino-libs.git#a6dac936bfcfa4c11468e003f550b41c76efeae6
Yes Yes ? ? esp32-arduino-libs of 04/06/2024 Impossible to monitor in USB but in UART I can see somme debug line about the WiFi but that's all, nothing more. But the LED start and is green, so we can think that the WiFi is connected
13/06/2024 platform = https://github.com/platformio/platform-espressif32.git
platform_packages =
framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git#cbf1e94dd5f9ac8bdabaae9603611a3b81d8fbe4
framework-arduinoespressif32-libs@https://github.com/espressif/esp32-arduino-libs.git#9f889b1dadfb54c37f017b21f70c35828941a3fd
Yes No, crash as in this issue No No

I come from this issue : https://github.com/espressif/arduino-esp32/issues/9874 , we think that the issue came from the precompile lib, so I'm here. Did anyone know if there are recent change about PSRAM for the version IDF v5.1.4 ?

HamzaHajeir commented 4 days ago

I'm having the same issue!

TL;DR: The issue goes to ESP-IDF after some commit.

It seems an ESP-IDF commit(s) between (Jun 09) and (Jun 13).

By enabling the correct configuration of PSRAM of I have N8R2, so:

build_flags = -DBOARD_HAS_PSRAM
    -mfix-esp32-psram-cache-issue
board_build.arduino.memory_type = qio_qspi

The errors goes like:

E (693) mmap: esp_mmu_unmap(595): munmap target pointer is outside external memory regions

assert failed: spi_flash_munmap flash_mmap.c:241 (0 && "invalid handle, or handle already unmapped") 

Backtrace: 0x40377caa:0x3fcf77b0 0x4037d7d1:0x3fcf77d0 0x403836bd:0x3fcf77f0 0x4202dda7:0x3fcf7920 0x4202d7dd:0x3fcf7940 0x4202d8e1:0x3fcf7960 0x4202dc7b:0x3fcf7990 0x420244b8:0x3fcf79f0 0x42026af5:0x3fcf7a30 0x420d95bd:0x3fcf7a60 0x40380462:0x3fcf7aa0
  #0  0x40377caa in panic_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_system/panic.c:466
  #1  0x4037d7d1 in esp_system_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_system/port/esp_system_chip.c:84
  #2  0x403836bd in __assert_func at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/newlib/assert.c:81
  #3  0x4202dda7 in spi_flash_munmap at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/spi_flash/flash_mmap.c:241
  #4  0x4202d7dd in esp_partition_munmap at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_partition/partition_target.c:173
  #5  0x4202d8e1 in read_otadata at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/app_update/esp_ota_ops.c:97
  #6  0x4202dc7b in esp_ota_get_state_partition at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/app_update/esp_ota_ops.c:836
      (inlined by) esp_ota_get_state_partition at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/app_update/esp_ota_ops.c:824
  #7  0x420244b8 in initArduino at C:/Users/Hamza/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-misc.c:262
  #8  0x42026af5 in app_main at C:/Users/Hamza/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp:104
  #9  0x420d95bd in main_task at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/app_startup.c:208 (discriminator 15)
  #10 0x40380462 in vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:162

ELF file SHA256: 97d9d44772f1ba59

Rebooting...