Commit Graph

974 Commits

Author SHA1 Message Date
Guillaume Souchere
a28c236c21 fix(spi_flash): Check for SPM memory in esp_task_stack_is_sane_cache_disabled 2026-09-11 09:42:26 +02:00
morris
5aa18f1104 Merge branch 'fix/spi_flash_keep_program_erase_in_iram_v6.0' into 'release/v6.0'
fix(spi_flash): keep program and erase paths in IRAM (v6.0)

See merge request espressif/esp-idf!51892
2026-09-08 14:43:07 +08:00
morris
50642bc839 Merge branch 'feat/move_flash_120_out_from_experimental_v6.0' into 'release/v6.0'
feat(flash): p4 flash 120MHz is no longer experimental feature (v6.0)

See merge request espressif/esp-idf!51699
2026-09-08 14:41:26 +08:00
morris
17dabceecf Merge branch 'fix/dualcore_branch_predictor_cache_race_v6.0' into 'release/v6.0'
fix(spi_flash): disable branch prediction on the parked core during flash ops (v6.0)

See merge request espressif/esp-idf!52202
2026-09-04 17:57:09 +08:00
wuzhenghui
87e3dda66d fix(spi_flash): integrate branch prediction control during cache operations 2026-08-31 10:43:20 +08:00
Ashish Sharma
f91ec54912 fix(spi_flash): disable branch prediction on the parked core during flash ops 2026-08-31 10:42:46 +08:00
Michael.B
6e826fdb27 test(spi_flash): temp_skip_ci esp32h4 flash_encryption xip_psram
Keep SOC_SPIRAM_XIP_SUPPORTED target selection and skip esp32h4 in CI
until FE support is ready (IDF-12388).
2026-08-27 02:21:17 +08:00
Michael.B
39294955fd test(spi_flash): add flash_encryption xip_psram repro coverage
Add an IDF-15875 regression config that places .ext_ram.bss in PSRAM under
XIP, and align flash_encryption disable_test rules with available runners.
2026-08-27 02:21:17 +08:00
Chen Chen
c862edb946 fix(spi_flash): keep program and erase paths in IRAM 2026-08-25 16:16:43 +08:00
Armando (Dou Yiwen)
d6f4172d14 feat(flash): p4 flash 120MHz is no longer experimental feature
Signed-off-by: Armando (Dou Yiwen) <douyiwen@espressif.com>
2026-08-14 02:33:11 +00:00
C.S.M
f1a734ca8d fix(spi_flash): Fix spi_flash leaks release aes-xts in error path
(cherry picked from commit 305c5869ee)
2026-07-24 14:52:17 +08:00
Shengyu Qu
7727fa14f4 fix(spi_flash): add #if check for s_mxic_set_required_regs()
Currently, s_mxic_set_required_regs() lacks checking for
CONFIG_SPI_FLASH_SUPPORT_MXIC_OPI_CHIP. And this causes a defined but not
used warning when MXIC flash driver is disabled in project config. So add
a #if check for this to supress warning.

Signed-off-by: Shengyu Qu <wiagn@4d2.org>
(cherry picked from commit 062c948c18)
2026-07-24 14:52:17 +08:00
morris
3576e8a4d4 Merge branch 'bugfix/gpspi_flash_freq_calc_v6.0' into 'release/v6.0'
fix(spi_flash): gpspi flash clock could reach higher frequency (v6.0)

See merge request espressif/esp-idf!49441
2026-06-29 10:18:04 +08:00
harshal.patil
5ed711bc06 fix(esp_common/esp_fault): make ESP_FAULT_ASSERT survive optimization
ESP_FAULT_ASSERT(C) was silently deleted by the optimizer when C is a cached
flag/status already proven by a preceding `if (!C) return/goto`: the compiler
folds C to a constant and drops all three checks, removing the fault-injection
protection with no warning.
2026-06-18 19:41:56 +05:30
Song Ruo Jing
a242565623 fix(spi_flash): gpspi flash clock could reach higher frequency 2026-06-09 21:56:36 +08:00
Chen Jichang
d1a64bffc0 refactor(clk_tree): use general api to enable the clk 2026-05-15 13:55:37 +08:00
Konstantin Kondrashov
2fcf83e2f3 fix(test_apps): Increase CONFIG_PARTITION_TABLE_OFFSET to 0x9000
Fix some test apps that have a partition table offset of 0x8000,
which left no room for the bootloader for some chips.
2026-05-13 10:18:40 +03:00
C.S.M
9025fffe44 fix(spi_flash): Fix flash hpm build failure,
Closes https://github.com/espressif/esp-idf/issues/18535
2026-05-11 16:13:45 +08:00
morris
ed6a7e267e Merge branch 'fix/32mb_120m_v6.0' into 'release/v6.0'
fix(spi_flash): 1. Fix flash 120m in qio mode failed on esp32p4 (with 32M map enabled) 2. Add C61 32M flash support (backport v6.0)

See merge request espressif/esp-idf!46042
2026-03-23 16:14:19 +08:00
morris
01c8f89bf8 Merge branch 'bugfix/flash_user_command_with_pms_v6.0' into 'release/v6.0'
fix(flash): flash erase operation may fail to raise PMS exception (v6.0)

See merge request espressif/esp-idf!46845
2026-03-23 11:52:49 +08:00
Song Ruo Jing
7d0ddf3010 fix(flash): flash erase operation may fail to raise PMS exception 2026-03-20 22:44:09 +08:00
igor.udot
e2a8bbe639 ci: update build-test-rules to use common_components 2026-03-20 15:53:26 +08:00
C.S.M
52d5b1a173 fix(spi_flash): Fix esp32p4 120m flash suspend failed 2026-03-20 15:21:22 +08:00
morris
23e199d646 Merge branch 'feature/esp32c61_flash_psram_timing_tuning_v6.0' into 'release/v6.0'
feat(mspi): support 120MHz flash and psram for esp32c61 (v6.0)

See merge request espressif/esp-idf!45886
2026-03-20 13:55:06 +08:00
Jiang Jiang Jian
59a686ffac Merge branch 'fix/fix_sleep_exception_in_spi_flash_rom_impl_v6.0' into 'release/v6.0'
fix(esp_hw_support): fix sleep exception in spi flash rom impl (v6.0)

See merge request espressif/esp-idf!46445
2026-03-20 10:16:57 +08:00
Marius Vikhammer
a138e4e516 Merge branch 'change/added_mutex_for_get_apis_v6.0' into 'release/v6.0'
mmu: add mutex for get_max_consecutive_free_block_size and paddr_find_caps (v6.0)

See merge request espressif/esp-idf!46432
2026-03-20 10:04:27 +08:00
Song Ruo Jing
c7ae253b89 feat(mspi): support 120MHz flash and psram for esp32c61 2026-03-19 14:30:46 +00:00
wuzhenghui
9ed0d4bc4e fix(esp_rom): sync spi_flash_disable/enable_cache patches to rom implementation 2026-03-10 14:14:01 +08:00
armando
15cbf78a64 fix(mmap): added 24bit addr check 2026-03-10 11:34:48 +08:00
Chen Jichang
04df934c05 refactor(flash_enc): move esp_flash_encryption_enabled() to efuse component 2026-03-06 18:14:22 +08:00
Xiao Xufeng
34035b0e7c fix(spi_flash): add suspend related code back 2026-02-02 03:44:59 +08:00
Xiao Xufeng
6539624176 fix(spi_flash): fixed overboundary check skipping of erase and write_encrypted 2026-01-29 03:28:30 +08:00
Xiao Xufeng
d8030432ec refactor(spi_flash): not patching api_funcs on C3 and S3 2026-01-29 03:28:30 +08:00
Xiao Xufeng
3411286544 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-29 03:28:30 +08:00
Xiao Xufeng
170061e971 refactor(spi_flash): move internal types to private headers and refactor initialization
This commit refactors the SPI flash component to improve encapsulation and
modularity by moving internal types and functions to private headers, and
reorganizing initialization code.

Key changes:

1. Move PSRAM frequency constraint macro from soc_caps.h to mspi_ll.h
   - Rename SOC_SPI_MEM_PSRAM_FREQ_AXI_CONSTRAINED to
     MSPI_TIMING_LL_PSRAM_FREQ_AXI_CONSTRAINED
   - Move macro definition to chip-specific mspi_ll.h files (C5, C61, H4, P4, S31)
   - Update usage in clk_utils.c and esp_flash_spi_init.c
   - Remove old macro from all soc_caps.h files

2. Move internal types to private headers
   - Move esp_flash_t structure to esp_private/esp_flash_types.h
   - Move esp_flash_os_functions_t to esp_private/spi_flash_os.h
   - Update all internal files to include private headers
   - Keep forward declarations in public esp_flash.h

3. Move chip driver header to internal directory
   - Move spi_flash_chip_driver.h to esp_flash_port/spi_flash_chip_driver.h
   - Update all references to use new path
   - Add esp_private/esp_flash_types.h include to the moved header

4. Refactor initialization functions
   - Move init_flash from esp_system/startup_funcs.c to
     spi_flash/esp_flash_spi_init.c
   - Create new init_pm_flash_freq_limit function in startup_funcs.c
     to call esp_pm_flash_freq_limit_init() conditionally
   - Update system_init_fn.txt with new function locations

5. Improve API encapsulation
   - Replace direct access to esp_flash_t->size in
     esp_partition_register_external() with esp_flash_get_size() API
   - Move esp_flash_is_quad_mode from inline function to regular function
     in esp_flash_api.c

6. Update component dependencies
   - Add esp_driver_gpio to spi_flash component PRIV_REQUIRES
   - Remove unused includes and clean up header dependencies

These changes improve code organization by clearly separating public APIs
from internal implementation details, making the codebase more maintainable
and reducing the risk of breaking changes to internal structures.
2026-01-29 03:28:30 +08:00
morris
40fe34e4ab refactor(tests): add missing sdkconfig files in the driver test 2026-01-07 10:16:23 +08:00
morris
16781cd4b4 Merge branch 'refactor/gdma_link_skip_null_buffer_v6.0' into 'release/v6.0'
skip the NULL buffer in DMA mount pre-check (v6.0)

See merge request espressif/esp-idf!44458
2025-12-29 10:27:36 +08:00
armando
245cd9cda8 fix(cache): fixed cache sync ops concurrent call issue
Closes https://github.com/espressif/esp-idf/issues/18023
2025-12-25 09:55:27 +08:00
morris
e5d0955864 refactor(gdma): skip the null buffer in mount pre-check 2025-12-23 10:15:37 +08:00
Jiang Jiang Jian
f409428bf3 Merge branch 'bugfix/esp32c5_encrypted_flash_write_v6.0' into 'release/v6.0'
fix(spi_flash): Add CPU frequency switching during flash encrypted write (v6.0)

See merge request espressif/esp-idf!44304
2025-12-21 15:28:33 +08:00
Xiao Xufeng
ae7124abe3 feat(spi_flash): implement dynamic CPU frequency switching workaround for encrypted writes
This commit implements a workaround that allows ESP32-C5 to run at 240MHz CPU frequency
normally, while automatically reducing CPU frequency during encrypted flash writes to
ensure correct operation. The frequency limit is chip revision dependent:
- v1.2 and above: limited to 160MHz during encrypted writes
- v1.0 and below: limited to 80MHz during encrypted writes

Key implementation details:
- Frequency limiting is triggered automatically when esp_flash_write_encrypted() is called
- Uses start() flags (ESP_FLASH_START_FLAG_LIMIT_CPU_FREQ) to integrate with OS layer
- Works with both PM enabled and disabled configurations
- Frequency is automatically restored after encrypted write completes
- For ESP32-C5 with 120MHz flash, Flash clock and timing registers are adjusted when
  CPU frequency is reduced to 80MHz
- SPI1 timing registers are configured during frequency switching since encrypted writes
  use SPI1 and must work correctly at reduced CPU frequencies

Code improvements:
- Use SOC_MSPI_FREQ_AXI_CONSTRAINED capability macro instead of hardcoded chip checks
- Control workaround via Kconfig (CONFIG_PM_WORKAROUND_FREQ_LIMIT_ENABLED) instead of
  hardcoded macros
- Add comprehensive test cases covering various PM configurations and edge cases

This workaround enables ESP32-C5 applications to benefit from 240MHz CPU performance
while maintaining reliable encrypted flash write functionality.
2025-12-17 01:21:45 +08:00
Mahavir Jain
86f159ec06 fix(spi_flash): limit CPU clock to 160MHz for encrypted flash writes 2025-12-17 01:21:45 +08:00
wanckl
d12f941787 feat(driver_spi): split spi hal component 2025-12-16 20:38:09 +08:00
Martin Vychodil
7c4eac9e22 Merge branch 'feat/spi_flash_bdl_support_v6.0' into 'release/v6.0'
feat(bdl): Add support for spi_flash (v6.0)

See merge request espressif/esp-idf!43812
2025-12-11 21:28:52 +08:00
Adam Múdry
064630c582 feat(bdl): Add support for spi_flash 2025-12-10 22:39:03 +08:00
C.S.M
ed64e7bf78 ci(header_check): Add check for public header should not include freertos 2025-12-10 15:10:43 +08:00
Song Ruo Jing
62899cbba6 refactor(gpio): split GPIO HAL into separate component
cleaned up some includes in GPIO peripheral files
2025-12-08 14:33:26 +08:00
morris
f050c1deb1 Merge branch 'fix/no_function_call_in_min_max_v6.0' into 'release/v6.0'
refactor: avoid function calls inside MIN/MAX macros (v6.0)

See merge request espressif/esp-idf!43476
2025-11-21 12:03:09 +08:00
C.S.M
e0a6261993 fix(spi_flash): Fix software resume wrong config name in flash init 2025-11-18 17:50:24 +08:00
morris
e9539d4560 refactor: avoid function calls inside MIN/MAX macros 2025-11-18 15:18:14 +08:00