155 Commits

Author SHA1 Message Date
Xiao Xufeng
789ce684c9 fix(mmap): fixed some API read wrong data via mmap when flash being erased/written while XIP on PSRAM
Before:

The cache won't be disabled when XIP on psram. But during flash
erasing/programming, read data will be courrupt.

When XIP in psram is enabled, the image is not mapped to the cache so
usually there will be no flash access. The only way to read from flash
is via the driver or use mmap. The driver has protection during erasing,
while th mmap region not.

Now:

Mmap APIs provide a flag to make mmap->unmap region mutually exclusive
to flash erase/programming when XIP from psram. SPI Flash write APIs
will benefit from this. When the flag is used, no concurrent access to
mapped region will happen while writing; otherwise the cache will be
disable to avoid data corruption.

Most ESP-IDF APIs calls mmap with this flag. As for users calling
mmap-like APIs directly, they can choose whether to enable this by a
flag.

Closes https://github.com/espressif/esp-idf/issues/14897
2026-06-16 01:00:43 +08:00
Song Ruo Jing
545b31e6b9 feat(spi_flash): Add exclusive support for ESP32H4
Add 32bit addr support for esp32s31 as well
2026-06-08 17:56:09 +08:00
C.S.M
2acd9b9a7c fix(spi_flash): Fix suspend issue on esp32s31, and add trs timing on other target 2026-06-08 11:15:13 +08:00
C.S.M
b37f62e080 fix(flash): fix mspi boot crash 2026-04-22 11:26:05 +08:00
Xorlent
51d059232b Fix output bit range in bitscrambler documentation
Destination bit range incorrect in `Sub-instructions` example
2026-04-17 17:20:28 +08:00
armando
2b582796d3 feat(mmu): s31 support 2026-04-01 11:49:22 +08:00
hebinglin
474d89b4c2 fix(clk): update H21 ECO1 to use 64MHz clock for mspi 2026-03-25 15:38:49 +08:00
Chen Ji Chang
7a8a5d8852 Merge branch 'test/parlio_flash_enc_test' into 'master'
test(parlio,rmt,lcd): add virtual flash encryption test

Closes IDF-15064, IDF-15065, and IDF-15069

See merge request espressif/esp-idf!45006
2026-02-06 19:26:22 +08:00
Chen Jichang
b8c527a87c refactor(flash_enc): move esp_flash_encryption_enabled() to efuse component 2026-02-05 11:42:08 +08:00
C.S.M
879d74e298 fix(spi_flash): Fix esp32p4 120m flash suspend failed 2026-02-04 11:42:35 +08:00
wuzhenghui
cf3c8cb77c feat(esp_hw_support): hold MSPI pins in pd_top lightsleep 2026-01-28 19:49:46 +08:00
wuzhenghui
aaeec3228d fix(bootloader): fix bootloader bad spi pin drv config and clear all wpu/wpd by default 2026-01-28 19:49:46 +08:00
Xiao Xufeng
8dbf23630a refactor(spi_flash): reorganize header files and improve API encapsulation
This commit reorganizes SPI flash header files to better reflect their
visibility and intended usage:

1. Rename `esp_flash_port/` to `esp_flash_chips/`:
   - Better reflects that these headers are for chip driver implementations
   - All chip driver headers moved to `esp_flash_chips/` directory
   - Added README.md explaining semi-public nature of these headers

2. Move internal headers to `esp_private/`:
   - `esp_flash_internal.h` -> `esp_private/esp_flash_internal.h`
   - `memspi_host_driver.h` -> `esp_private/memspi_host_driver.h`

3. Move chip driver related headers to `esp_flash_chips/`:
   - `esp_private/esp_flash_types.h` -> `esp_flash_chips/esp_flash_types.h`
   - `spi_flash/spi_flash_defs.h` -> `esp_flash_chips/spi_flash_defs.h`
   - `spi_flash_override.h` -> `esp_flash_chips/spi_flash_override.h`
   - All `spi_flash_chip_*.h` headers moved to `esp_flash_chips/`

4. Code improvements:
   - Remove unused includes (e.g., `spi_flash_override.h` from `cache_utils.c`)
   - Use public API `esp_flash_get_size()` instead of direct member access
   - Add `esp_flash_is_quad_mode` to linker.lf for IRAM placement

5. Documentation updates:
   - Add README.md in `esp_flash_chips/` explaining semi-public headers
   - Update programming guide with warnings about internal headers
   - Update both English and Chinese documentation

6. Update all references across the codebase:
   - Update includes in `spi_flash` component
   - Update `bootloader_support`, `app_update`, `esp_tee`, `espcoredump`
   - Update example projects

Breaking changes:
- Headers moved to new locations require include path updates
- `custom_flash_driver` example temporarily disabled until external
  components are updated
2026-01-23 03:38:54 +08:00
Michael (XIAO Xufeng)
b61f940191 Merge branch 'fix/min_rev_usage' into 'master'
fix: fix wrong REV_MIN usage for security, bt, efuse

See merge request espressif/esp-idf!45219
2026-01-22 21:25:57 +08:00
Song Ruo Jing
526bf6176e Merge branch 'feature/esp32c61_flash_psram_timing_tuning' into 'master'
feat(mspi): support 120MHz flash and psram for esp32c61

Closes IDF-9256, IDF-14918, and IDFCI-3240

See merge request espressif/esp-idf!45012
2026-01-22 16:36:25 +08:00
Xiao Xufeng
64d93379ae fix(tee): fix failed to configure flash on C6 v0.1 and above when REV_MIN_0 configured 2026-01-22 02:55:12 +08:00
Song Ruo Jing
fc4f07abd6 feat(mspi): support 120MHz flash and psram for esp32c61 2026-01-21 14:38:04 +08:00
armando
364dc14de4 change(flash): improve bootloader_flash_read log 2026-01-20 10:07:54 +08:00
Song Ruo Jing
215c9993bf fix(clk): update H4 to use 64MHz clock for mspi
And add pll clock ref count
2026-01-04 14:07:01 +08:00
wanckl
6449181ce0 feat(driver_spi): split spi hal component 2025-12-11 15:00:18 +08:00
Samuel Obuch
1ec4c2e1af Merge branch 'esp32p4_fix_bootloader_flash_read_allow_decrypt' into 'master'
fix(bootloader_flash): always invalidate FLASH_READ_VADDR before read

See merge request espressif/esp-idf!42501
2025-12-04 03:48:40 +08:00
C.S.M
0c4cf75c35 feat(esp32s31): Introduce esp32s31 hello world 2025-12-02 10:44:16 +08:00
Samuel Obuch
afde0fee27 fix(bootloader_flash): invalidate FLASH_READ_VADDR before read
Fixed address to match corresponding mmu_hal_map_region call.
FLASH_MMAP_VADDR was invalidated by mistake in commit
ea38a2e9a4
2025-12-01 10:39:09 +01:00
Song Ruo Jing
1862fdec74 refactor(gpio): split GPIO HAL into separate component
cleaned up some includes in GPIO peripheral files
2025-11-26 15:35:07 +08:00
C.S.M
a90c93541c feat(esp32s31): Introduce new target esp32s31 2025-11-17 14:48:55 +08:00
Song Ruo Jing
266c06354d refactor(gpio): remove some useless macros from io_mux_reg.h 2025-11-07 15:26:52 +08:00
armando
755ee49b72 feat(mspi): supported psram & flash 120MHz timing tuning 2025-10-28 09:52:36 +08:00
Mahavir Jain
23c04b681e Merge branch 'feat/esp_tee_mspi_tuning' into 'master'
change(esp_tee): Fix TEE SPI flash API issues on ESP32-C5

Closes IDF-13826

See merge request espressif/esp-idf!41952
2025-10-27 10:09:29 +05:30
Laukik Hase
02cb0425b9 fix(esp_tee): Handle the SPI1 WB mode incompatibility in TEE flash APIs on ESP32-C5
- When `esp_flash_read()` is invoked from REE, it internally enables WB mode
  via `spi_flash_ll_wb_mode_enable()`. However, the ROM flash APIs used by TEE
  do not support WB mode, resulting in failures when TEE attempts to access
  flash after this call.
- This commit adds a workaround in the TEE flash layer by saving WB mode state,
  temporarily disabling it for ROM API calls, and restoring it afterward.
2025-10-22 11:44:34 +05:30
C.S.M
c81cf3bdf6 refactor(spi_flash): Remove spi_flash rom driver patch config option 2025-10-22 10:37:19 +08:00
Laukik Hase
6e51fac96e Merge branch 'fix/esp_tee_flash_op_bound_checks' into 'master'
fix(esp_tee): Correct flash operation bound checks to handle all overlap cases

Closes IDF-14129

See merge request espressif/esp-idf!41946
2025-10-13 13:31:03 +05:30
Peter Dragun
e3198fff3c feat: Update esptool to v5 2025-09-30 15:28:55 +02:00
Laukik Hase
8b92f3603f fix(esp_tee): Correct flash operation bound checks to handle all overlap cases
- Ensure bound checks correctly handle all scenarios, including
  when a requested operation's (SPI0/1) range fully contains the
  TEE-protected region.
- Disable delegation of INTWDT timeout and Cache error interrupts as they reset
  the device after the panic handler
2025-09-30 12:22:25 +05:30
armando
8ebce9b805 change(cache): no use sdkconfig in cache/mmu hal 2025-09-22 01:01:03 +00:00
Konstantin Kondrashov
dcf486359e feat(log): Optimize log tag init for bin logging 2025-09-15 15:59:52 +03:00
armando
179d00a6f8 feat(p4): p4 rev3 real chip support 2025-08-28 17:56:16 +08:00
C.S.M
47218f6291 fix(bootloader_flash): Make bootloader flash size accurate 2025-07-30 17:10:59 +08:00
C.S.M
b765ad43cf feat(spi_flash): Add flash suspend support on esp32h21, esp32h4 2025-07-21 19:24:00 +08:00
C.S.M
50aee21d33 feat(spi_flash): Add basic support for esp32h4 2025-07-21 19:24:00 +08:00
C.S.M
bc9fa040da feat(spi_flash): support spi_flash on esp32h21 2025-07-21 19:24:00 +08:00
Song Ruo Jing
b3fd9b6afa fix(clk): XTAL_X2 clock is not usable on H21 MPW and H4 BETA5 2025-07-10 16:35:58 +08:00
Song Ruo Jing
6d293c8582 feat(clk): Add basic clock support for esp32h21 2025-06-16 15:05:32 +08:00
armando
2f8cd616cc test(psram): re-enable 80M psram tests on C5 ECO2 2025-05-22 14:52:40 +08:00
Armando (Dou Yiwen)
dadcc7b9f3 Merge branch 'feat/c5_eco2_psram_timing_tuning' into 'master'
mspi: psram 80M timing tuning on C5 ECO2

Closes IDF-13003

See merge request espressif/esp-idf!39232
2025-05-22 06:41:56 +00:00
armando
00e3f4885a feat(mspi): supported psram 80MHz timing tuning 2025-05-22 10:27:19 +08:00
Laukik Hase
12e2df2d74 feat(esp_tee): Support for ESP32-H2 - the rest of the components 2025-05-20 16:31:23 +05:30
Chen Jichang
6c4271d4bb feat(esp32h4): disable unsupported build 2025-03-28 14:41:29 +08:00
Armando (Dou Yiwen)
64ff6ec274 Merge branch 'fix/mutex_between_oct_flash_and_flash_rom_impl' into 'master'
flash: mutex between oct flash and flash rom impl

See merge request espressif/esp-idf!37760
2025-03-21 14:51:08 +08:00
Chen Jichang
45ba78940f feat(esp32h4): finnal introduce hello world 2025-03-19 18:48:41 +08:00
armando
cbcee1625f refactor(flash): rename SOC_SPI_MEM_SUPPORT_OPI_MODE to SOC_SPI_MEM_SUPPORT_FLASH_OPI_MOD 2025-03-19 14:01:22 +08:00