esp-idf: esp_partition_mmap fails with partitions larger than 3MB (IDFGH-107)
Using esp_partition_mmap to map a partition larger than 3MB results in failures. The following reproduces the issue: https://github.com/OtherCrashOverride/esp32-flashtest
When the partition is:
storage, 0x40, 0x01, 0x100000, 0x300000 the operation is successful.
When the partion is:
storage, 0x40, 0x01, 0x100000, 0x400000 an error is returned (ESP_ERR_NO_MEM).
When the partition is:
storage, 0x40, 0x01, 0x100000, 0x500000 a “double exception” occurs.
The test hardware is an ESP-WROOM32 with the flash chip removed and replaced with W25Q128JVSIQ (16MB). The flash is correctly detected for flash and boot:
I (48) boot: SPI Speed : 40MHz
I (49) boot: SPI Mode : DIO
I (53) boot: SPI Flash Size : 16MB
About this issue
- Original URL
- State: open
- Created 7 years ago
- Comments: 22 (9 by maintainers)
Hello, I see something that looks like a variation of this issue. The following code
with the following partition table
runs to completion without an error, but the dumped data does not match the FLASH contents once the virtual address crosses the
0x40400000boundary. The complete output:I know that the correct data is in the FLASH, because changing
map_partition("rootfs", 0);tomap_partition("rootfs", 20 << 16);prints the missing data.That is I have two questions here. First there seems to be a bug that the function
esp_partition_mmapreturns success, but the mapping is not fully functional. I guess I should report it as a separate issue, right? Second it looks very much like a hardware issue, so the question is: is it supposed to work at all on esp32 (simultaneous mapping of 4MB of PSRAM and 4MB of FLASH)?@negativekelvin yes, you’re right, it should be 4 * 64 not 3 * 64. And the other issue is incorrect bail-out a couple of lines below (shouldn’t return from the function with the cache disabled). Still looking into the data corruption issue here, will update this ticket once we have some progress.
https://github.com/OtherCrashOverride/esp32-flashtest/tree/instmap
The output of spi_flash_mmap_dump follows. Note that spi_flash_mmap_dump for the 8MB mapping can not be provided since it “double exception” panics: