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

unhandled double exception ESP32-S2 IDF 5.1.2 what is the cause in a previous well running project on IDF 5.0.1? (IDFGH-11592) #12711

Closed
3 tasks done
ralphde opened this issue Dec 3, 2023 · 13 comments
Assignees
Labels
Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Type: Bug bugs in IDF

Comments

@ralphde
Copy link

ralphde commented Dec 3, 2023

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.

5.0.4 and 5.1.2

Operating System used.

Windows

How did you build your project?

Eclipse IDE

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

None

What is the expected behavior?

should work out of the box

What is the actual behavior?

The following start up ends in extensa_vectors.S line 564 _DoubleExceptionVector:.

Previously the code was running fine until IDF 5.0.1, stopped loading in 5.0.4 and 5.1.2

what should I look at ?

Bootloader issue:

ESP-ROM:esp32s2-rc4-20191025 Build:Oct 25 2019 rst:0x10 (RTCWDT_RTC_RST),boot:0x8 (SPI_FAST_FLASH_BOOT) SPIWP:0xee mode:DIO, clock div:1 load:0x3ffe6108,len:0x2138 load:0x4004b000,len:0x4 load:0x4004b004,len:0xc30 load:0x4004f000,len:0x3544 SHA-256 comparison failed: Calculated: 7b4bf3281ac986894c811941b66f9443d4bc32bfd5862f7c1770019daafa3070 Expected: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff Attempting to boot anyway... entry 0x4004b204 �[0;32mI (43) boot: ESP-IDF v5.1.2-dirty 2nd stage bootloader�[0m �[0;32mI (43) boot: compile time Dec 2 2023 23:05:15�[0m D (43) bootloader_flash: non-XMC chip detected by SFDP Read (00), skip.�[0m D (49) bootloader_flash: mmu set block paddr=0x00000000 (was 0xffffffff)�[0m �[0;32mI (56) boot: chip revision: v0.0�[0m D (60) boot.esp32s2: magic e9�[0m D (63) boot.esp32s2: segments 04�[0m D (66) boot.esp32s2: spi_mode 02�[0m D (70) boot.esp32s2: spi_speed 0f�[0m D (73) boot.esp32s2: spi_size 02�[0m �[0;32mI (76) boot.esp32s2: SPI Speed : 80MHz�[0m �[0;32mI (81) boot.esp32s2: SPI Mode : DIO�[0m �[0;32mI (86) boot.esp32s2: SPI Flash Size : 4MB�[0m D (91) boot: Enabling RTCWDT(9000 ms)�[0m �[0;32mI (94) boot: Enabling RNG early entropy source...�[0m D (100) bootloader_flash: rodata starts from paddr=0x00008000, size=0xc00, will be mapped to vaddr=0x3f000000�[0m D (110) boot: mapped partition table 0x8000 at 0x3f008000�[0m D (115) flash_parts: partition table verified, 4 entries�[0m �[0;32mI (121) boot: Partition Table:�[0m �[0;32mI (124) boot: ## Label Usage Type ST Offset Length�[0m D (132) boot: load partition table entry 0x3f008000�[0m D (137) boot: type=1 subtype=2�[0m �[0;32mI (140) boot: 0 nvs WiFi data 01 02 00009000 00006000�[0m D (147) boot: load partition table entry 0x3f008020�[0m D (152) boot: type=1 subtype=1�[0m �[0;32mI (155) boot: 1 phy_init RF data 01 01 0000f000 00001000�[0m D (163) boot: load partition table entry 0x3f008040�[0m D (168) boot: type=0 subtype=0�[0m �[0;32mI (171) boot: 2 factory factory app 00 00 00010000 00177000�[0m �[0;32mI (179) boot: End of partition table�[0m D (183) boot: Trying partition index -1 offs 0x10000 size 0x177000�[0m D (189) esp_image: reading image header @ 0x10000�[0m D (194) bootloader_flash: mmu set block paddr=0x00010000 (was 0xffffffff)�[0m D (201) esp_image: image header: 0xe9 0x05 0x02 0x02 4002344c�[0m �[0;32mI (206) esp_image: segment 0: paddr=00010020 vaddr=3f000020 size=28cd8h (167128) map�[0m D (206) esp_image: free data page_count 0x00000038�[0m D (209) bootloader_flash: rodata starts from paddr=0x00010020, size=0x28cd8, will be mapped to vaddr=0x3f000000�[0m D (240) bootloader_flash: mmu set block paddr=0x00030000 (was 0xffffffff)�[0m �[0;32mI (240) esp_image: segment 1: paddr=00038d00 vaddr=3ffc8b60 size=04920h ( 18720) load�[0m D (244) esp_image: free data page_count 0x00000038�[0m D (249) bootloader_flash: rodata starts from paddr=0x00038d00, size=0x4920, will be mapped to vaddr=0x3f000000�[0m D (262) bootloader_flash: mmu set block paddr=0x00030000 (was 0xffffffff)�[0m �[0;32mI (266) esp_image: segment 2: paddr=0003d628 vaddr=40022000 size=029f0h ( 10736) load�[0m D (275) esp_image: free data page_count 0x00000038�[0m D (279) bootloader_flash: rodata starts from paddr=0x0003d628, size=0x29f0, will be mapped to vaddr=0x3f000000�[0m D (292) bootloader_flash: mmu set block paddr=0x00040000 (was 0xffffffff)�[0m �[0;32mI (296) esp_image: segment 3: paddr=00040020 vaddr=40080020 size=969ech (616940) map�[0m D (305) esp_image: free data page_count 0x00000038�[0m D (310) bootloader_flash: rodata starts from paddr=0x00040020, size=0x969ec, will be mapped to vaddr=0x3f000000�[0m D (398) bootloader_flash: mmu set block paddr=0x000d0000 (was 0xffffffff)�[0m �[0;32mI (398) esp_image: segment 4: paddr=000d6a14 vaddr=400249f0 size=14164h ( 82276) load�[0m D (402) esp_image: free data page_count 0x00000038�[0m D (407) bootloader_flash: rodata starts from paddr=0x000d6a14, size=0x14164, will be mapped to vaddr=0x3f000000�[0m �[0;32mI (444) boot: Loaded app from partition at offset 0x10000�[0m �[0;32mI (444) boot: Disabling RNG early entropy source...�[0m D (444) boot: Mapping segment 0 as DROM�[0m D (448) boot: Mapping segment 3 as IROM�[0m D (452) boot: calling set_cache_and_start_app�[0m D (456) boot: configure drom and irom and start�[0m D (461) boot: start: 0x4002344c�[0m �[0;32mI (475) cpu_start: Unicore app�[0m �[0;32mI (475) cache: Instruction cache : size 8KB, 4Ways, cache line size 32Byte�[0m

Steps to reproduce.

compile and flash using ESP-Prog

Build or installation Logs.

ae\esp-clang\bin;C:\Users\ralph\.espressif\tools\riscv32-esp-elf\esp-12.2.0_20230208\riscv32-esp-elf\bin;C:\Users\ralph\.espressif\tools\esp32ulp-elf\2.35_20220830\esp32ulp-elf\bin;C:\Users\ralph\.espressif\tools\cmake\3.24.0\bin;C:\Users\ralph\.espressif\tools\openocd-esp32\v0.12.0-esp32-20230921\openocd-esp32\bin;C:\Users\ralph\.espressif\tools\ninja\1.10.2\;C:\Users\ralph\.espressif\tools\idf-exe\1.0.3\;C:\Users\ralph\.espressif\tools\ccache\4.8\ccache-4.8-windows-x86_64;C:\Users\ralph\.espressif\tools\dfu-util\0.11\dfu-util-0.11-win64;C:\Users\ralph\.espressif\python_env\idf5.1_py3.12_env\Scripts;C:\IDF-5.1.2\esp-idf-v5.1.2\tools;C:/eclipse-cpp-2023-09//plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.9.v20231028-0858/jre/bin/server;C:/eclipse-cpp-2023-09//plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.9.v20231028-0858/jre/bin;C:\Program Files\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\IVI Foundation\IVI\bin;C:\Program Files\IVI Foundation\IVI\bin;C:\Program Files (x86)\IVI Foundation\VISA\WinNT\Bin\;C:\Program Files\IVI Foundation\VISA\Win64\Bin\;C:\Program Files (x86)\IVI Foundation\VISA\WinNT\Bin;C:\Program Files\AutoFirma\AutoFirma;C:\Program Files\Git\cmd;C:\Users\ralph\AppData\Local\Programs\Python\Python312\Scripts\;C:\Users\ralph\AppData\Local\Programs\Python\Python312\;C:\Users\ralph\AppData\Local\Microsoft\WindowsApps;;C:\eclipse-cpp-2023-09;
USERDOMAIN_ROAMINGPROFILE: DESKTOP-84B1J43
PROCESSOR_LEVEL: 25
SESSIONNAME: Console
ALLUSERSPROFILE: C:\ProgramData
PROCESSOR_ARCHITECTURE: AMD64
ESP_IDF_VERSION: 5.1
PSModulePath: C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules
SystemDrive: C:
VXIPNPPATH: C:\Program Files (x86)\IVI Foundation\VISA\
OPENOCD_SCRIPTS: C:\Users\ralph\.espressif\tools\openocd-esp32\v0.12.0-esp32-20230921\openocd-esp32\share\openocd\scripts
IDF_DEACTIVATE_FILE_PATH: C:\Users\ralph\AppData\Local\Temp\tmpt15e2xyeidf_7044
IVIROOTDIR64: C:\Program Files\IVI Foundation\IVI\
IDF_CCACHE_ENABLE: 1
USERNAME: ralph
ProgramFiles(x86): C:\Program Files (x86)
VXIPNPPATH64: C:\Program Files\IVI Foundation\VISA\
PATHEXT: .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
DriverData: C:\Windows\System32\Drivers\DriverData
OneDriveConsumer: C:\Users\ralph\OneDrive
NIEXTCCOMPILERSUPP: C:\Program Files (x86)\National Instruments\Shared\ExternalCompilerSupport\C\
ProgramData: C:\ProgramData
IDF_COMPONENT_MANAGER: 1
ProgramW6432: C:\Program Files
__PSLockDownPolicy: 0
HOMEPATH: \Users\ralph
PROCESSOR_IDENTIFIER: AMD64 Family 25 Model 80 Stepping 0, AuthenticAMD
IVIROOTDIR32: C:\Program Files (x86)\IVI Foundation\IVI\
ProgramFiles: C:\Program Files
PUBLIC: C:\Users\Public
windir: C:\Windows
=::: ::\
ZES_ENABLE_SYSMAN: 1
LOCALAPPDATA: C:\Users\ralph\AppData\Local
USERDOMAIN: DESKTOP-84B1J43
LOGONSERVER: \\DESKTOP-84B1J43
OneDrive: C:\Users\ralph\OneDrive
APPDATA: C:\Users\ralph\AppData\Roaming
CommonProgramFiles: C:\Program Files\Common Files
OS: Windows_NT
COMPUTERNAME: DESKTOP-84B1J43
NIIVIPATH: C:\Program Files (x86)\IVI Foundation\IVI\
IDF_PATH: C:\IDF-5.1.2\esp-idf-v5.1.2
PROCESSOR_REVISION: 5000
CommonProgramW6432: C:\Program Files\Common Files
ComSpec: C:\Windows\system32\cmd.exe
IDF_MAINTAINER: 1
TEMP: C:\Users\ralph\AppData\Local\Temp
SystemRoot: C:\Windows
HOMEDRIVE: C:
USERPROFILE: C:\Users\ralph
TMP: C:\Users\ralph\AppData\Local\Temp
CommonProgramFiles(x86): C:\Program Files (x86)\Common Files
NUMBER_OF_PROCESSORS: 16
IDF_PYTHON_ENV_PATH: C:\Users\ralph\.espressif\python_env\idf5.1_py3.12_env
ESP_ROM_ELF_DIR: C:\Users\ralph\.espressif\tools\esp-rom-elfs\20230320\

Operating System: windows 10
Java Runtime Version: 17.0.9+9
Eclipse Version: 4.29.0.v20230903-1000
Eclipse CDT Version: 11.3.0.202307110141
IDF Eclipse Plugin Version: 2.11.1.202310270725
ESP-IDF v5.1.2-dirty
Python set for IDF_PYTHON_ENV: Python 3.12.0

More Information.

Same code works fine on IDF 5.0.1. Problem started with 5.0.4

@ralphde ralphde added the Type: Bug bugs in IDF label Dec 3, 2023
@espressif-bot espressif-bot added the Status: Opened Issue is new label Dec 3, 2023
@github-actions github-actions bot changed the title unhandled double exception ESP32-S2 IDF 5.1.2 what is the cause in a previous well running project on IDF 5.0.1? unhandled double exception ESP32-S2 IDF 5.1.2 what is the cause in a previous well running project on IDF 5.0.1? (IDFGH-11592) Dec 3, 2023
@0xjakob
Copy link
Collaborator

0xjakob commented Dec 4, 2023

@ralphde I can't say exactly what the reason for the failures is. A double exception usually occurs when there is another interrupt going on already, which indicates a deeper rooted problem. Do you by chance have a reproducing example that we could try to reproduce the issue on our side?

@0xjakob
Copy link
Collaborator

0xjakob commented Dec 4, 2023

Have you tried flashing another board with a different device than the original ESP-Prog? I'm asking because the line SHA-256 comparison failed: means the image verification fails. The values FFF... look like erased flash, so something might have happened during flashing.

@ralphde
Copy link
Author

ralphde commented Dec 4, 2023

@0xjakob yes, this is a deeper issue. To make it clear, this issue occurs BEFORE any user code (app_main) is reached. And it started happening when we migrated from 5.0.1 to 5.0.4.
I asked clearly if more then one IDF version can be used parallel on the same machine using Eclipse plug in and Kondal said clearly yes. But I am not sure about this after trying to nail this issue down. I have both 5.0.4 and 5.1.2 on my machine (WIN10pro)
Further, with the same setup, means same ESP-Prog, same user hardware board ESP32_s2, same workspace, ANY other sample project runs and debugs fine. I have no idea what to do next.
We are more then happy to provide you our code to investigate further. however, that should go via non public route.

@ralphde
Copy link
Author

ralphde commented Dec 5, 2023

@0xjakob how can we provide our code? obviously not via here. we need an urgent solution

@0xjakob
Copy link
Collaborator

0xjakob commented Dec 5, 2023

@ralphde If you're OK sharing it privately without NDA, then you can send it to the email address of an Espressif engineer, which would be jakob.hasse@espressif.com for me (you can see the email address in the logs of IDF). I will also forward it to the relevant colleagues. If you can't share without NDA, then you would need to contact Espressif sales: sales@espressif.com.

@0xjakob
Copy link
Collaborator

0xjakob commented Dec 6, 2023

@ralphde How do you actually know there's a double exception? It seems like the log output is cropped. If that's the case, are you able to post the full log output including any panic handler messages and, ideally, backtraces?

@ralphde
Copy link
Author

ralphde commented Dec 6, 2023

@0xjakob no this is all what falls out of UART0 at startup. The code lands in extensa_vectors.S line 564 _DoubleExceptionVector before restrart. That basically loops due to setting in sdkconfig.

@ESP-Marius
Copy link
Collaborator

Issue seems to be in the cache init code, where we actually do not properly handle ESP32S2_DATA_CACHE_0KB. It falls back to configuring cache the same way as ESP32S2_DATA_CACHE_16KB

We'll fix this.

@espressif-bot espressif-bot assigned Icarus113 and unassigned 0xjakob Dec 18, 2023
@ralphde
Copy link
Author

ralphde commented Jan 2, 2024

it seem to be much more problems with memory management including partition handling

@ralphde
Copy link
Author

ralphde commented Jan 2, 2024

any progress on this?

@Icarus113
Copy link
Collaborator

It's because 0 size dcache condition is not configured well. It can be reproduced on master as well. We'll fix it on master then bring the fix to previous release versions.

You may try this for now:

s2_dcache_0_size_v5.txt

@espressif-bot espressif-bot added Status: Reviewing Issue is being reviewed and removed Status: Opened Issue is new labels Jan 4, 2024
@ralphde
Copy link
Author

ralphde commented Jan 4, 2024 via email

@espressif-bot espressif-bot added Status: Done Issue is done internally Resolution: NA Issue resolution is unavailable and removed Status: Reviewing Issue is being reviewed labels Jan 5, 2024
@Icarus113
Copy link
Collaborator

This sounds like another issue. You may follow-up it in #12917 you posted.

The crash in this issue is caused by the cache wrong configurations. This issue will be closed after the corresponding commit is synced here.

Feel free to reopen and leave comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Type: Bug bugs in IDF
Projects
None yet
Development

No branches or pull requests

5 participants