Commit Graph
62 Commits
Author SHA1 Message Date
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
Martin Vychodil 3ce5725282 fix(esp_partition): read-only and encrypted partition support 2025-10-09 09:06:54 +02:00
Martin Vychodil 5c8a10e61e fix(esp_partition): fixes related to BDL update 2025-10-09 09:06:40 +02:00
Martin Vychodil 4493b39d18 feat(storage): Added Block Device Layer support for esp_partition component 2025-10-07 14:55:36 +08:00
sonika.rathi 5b65634b49 feat(esp_partition): add error-returning variants for partition find APIs
Add esp_partition_find_err() and esp_partition_find_first_err() to provide
error reporting while maintaining backward compatibility.

Closes https://github.com/espressif/esp-idf/issues/9281
2025-09-29 15:00:41 +02:00
Konstantin Kondrashov b7da740f12 Merge branch 'feature/log_v2_optimization' into 'master'
feat(log): Optimize idf components for binary logging

Closes IDF-12775

See merge request espressif/esp-idf!40289
2025-09-19 14:45:43 +08:00
sonika.rathi 2fa2010aa4 feat(esp_partition): add support for partition tables larger than 4MB with linux target 2025-09-16 22:23:06 +08:00
Konstantin Kondrashov dcf486359e feat(log): Optimize log tag init for bin logging 2025-09-15 15:59:52 +03:00
Marek Fiala 9d35d63651 feat(cmake): Update minimum cmake version to 3.22 (whole repository) 2025-08-19 14:44:32 +02:00
Laukik Hase 41bf07e6ce refactor(esp_tee): Remove the deprecated TEE secure storage partition subtype 2025-05-04 18:03:30 +05:30
Laukik Hase c9f7bcd452 feat(esp_tee): Support the nvs_flash for the ESP-TEE build 2025-05-04 18:03:28 +05:30
igor.udot daf2d31008 test: format all test scripts 2025-03-05 12:08:48 +08:00
Mahavir Jain 3821d6cb97 fix(esp_tee): TEE otadata partition default encrypted for flash-enc case 2025-03-03 15:50:47 +08:00
harshal.patil 4c38499303 fix(esp_partition): Support reading unencrypted partitions by the bootloader
- When flash encryption is enable to support reading a partition that is not
marked as "encrypted", the `esp_partition_read()` API of bootloader build
should be redirected to the `bootloader_flash_read()` API.
2025-01-29 18:51:28 +05:30
harshal.patil 2ee22f968a fix(nvs_flash): Allow matching with partition when label provided is NULL
- When esp_parition_find_first() is called with the partition label provided
as NULL by the bootloader, allowing matching to the first partition that matches
partition_type and partition_subtype as done in the app variant.
2025-01-29 18:51:28 +05:30
Laukik Hase 2dee5791a6 feat(esp_tee): Support for ESP-TEE - esptool_py, esp_rom & other components 2024-12-02 11:27:58 +05:30
Radek Tandler 8255ba29a6 Merge branch 'feature/storage_nvs_bootloader' into 'master'
feat(storage/nvs): NVS bootloader support

See merge request espressif/esp-idf!31753
2024-11-15 00:12:18 +08:00
radek.tandler c445ec134b feat(nvs_flash): Implemented basic nvs_flash support for bootloader 2024-11-14 11:56:45 +01:00
Konstantin Kondrashov 52f14f344d feat(partition_table): Support recovery bootloader subtype 2024-11-12 17:22:53 +08:00
Konstantin Kondrashov 97d150d69a feat(app_update): OTA update bootloader, partition_table and other partitions
Passive app partition can be used as the staging partition where a new image is loaded.
Then copy it to the final partition.

Closes: https://github.com/espressif/esp-idf/issues/14195
Closes: https://github.com/espressif/esp-idf/issues/13824
2024-11-07 13:48:51 +02:00
Konstantin Kondrashov d5f37b526d feat(partitions): Adds new partition types and subtypes for bootloader and partition_table 2024-10-01 14:22:22 +03:00
Konstantin Kondrashov 02d61c1c5a feat(esp_partition): Adds new esp_partition APIs 2024-09-26 08:42:12 +03:00
Sonika Rathi d5da858cd9 refactor: remove dependency on spi_flash include for sector size 2024-09-26 13:01:24 +08:00
Alexey Lapshin 4c87af6359 fix(build): fix calloc warnings 2024-09-08 13:53:52 +07:00
Konstantin Kondrashov 0bdf675992 fix(linux): Fix warnings for Linux target when COMPILER_STATIC_ANALYZER=y 2024-07-31 11:23:54 +03:00
sonika.rathi a81f5768c6 fix(esp_partition): fix data type overflow sanity check 2024-07-08 22:19:19 +08:00
Tomáš Rohlínek f753434640 fix(storage/esp_partition): add option to control erase check during write for linux target 2024-05-28 10:05:58 +02:00
Adam Múdry 050db26419 Merge branch 'fix/coverity_use_after_free_partition.c' into 'master'
fix(partition): Simplify macro loop in esp_partition_unload_all, should fix Coverity problem

Closes IDF-9837

See merge request espressif/esp-idf!30853
2024-05-23 23:08:11 +08:00
Adam Múdry c2ac9bad62 fix(partition): Simplify macro loop in esp_partition_unload_all 2024-05-22 10:54:14 +02:00
Martin Vychodil b24a6af0b7 Merge branch 'refactor/partition_private_includes' into 'master'
refactor(esp_partition): Made private includes private on Linux

See merge request espressif/esp-idf!29747
2024-05-21 04:02:14 +08:00
Jakob Hasse 69c04f4adf refactor(esp_partition): Made private includes private on Linux 2024-05-13 16:02:19 +02:00
harshal.patil 3eb6487bb5 fix(bootloader_support): Make esp_flash_encrypt.h independent of spi_flash_mmap.h header 2024-05-13 16:54:45 +05:30
Ivan Grokhotkov 10cc15b150 fix(storage): applied spelling fixes by codespell pre-commit hook 2024-03-28 13:00:54 +01:00
Jakob Hasse 4d629be602 refactor(linux): Unified libbsd handling
* Users can now use libbsd string.h and sys/cdefs.h functionality
  (e.g., strlcpy, containerof) on Linux by just including
  string.h or sys/cdefs.h. In other words, the includes are the same
  on the Linux target as well as on chips targets (ESP32, etc.).
* libbsd linking is done by the linux component (belongs to common
  components) now instead of handling it separately in each component
2024-03-08 12:26:54 +08:00
sonika.rathi f7e4b9a132 fix(storage): cleanup storage examples/test_apps sdkconfigs 2024-02-12 10:57:46 +01:00
Tomáš Rohlínek 092f5aff29 feat(storage): Update build test rules for storage related components 2024-01-02 13:10:59 +01:00
Adam Múdry 0cc38fb901 refactor(esp_partition): Expose function for unloading partitions
Closes https://github.com/espressif/esp-idf/issues/12625
2023-11-22 11:13:32 +01:00
Adam Múdry e151184da7 refactor: Remove -Wno-format from storage related components 2023-10-22 17:56:41 +00:00
Adam Múdry ab1eb37fe8 feat(partition_table): Add read-only partition flag and functionality 2023-10-11 00:01:05 +02:00
Chen Yudong 2e11919f70 fix(ci): change build-test-rules files folder 2023-09-20 19:17:06 +08:00
Martin Vychodil e44d4260ad Merge branch 'feature/storage_host_test_nvs_flash2' into 'master'
nvs_flash: finished migration of host tests to the linux emulator of esp_partition

See merge request espressif/esp-idf!23926
2023-08-28 20:20:16 +08:00
radek.tandler 28f82d8de7 refactor(nvs_flash): Host test migrated to esp_partition emulation for linux 2023-08-09 14:14:21 +02:00
radek.tandler 4c13bf53ea change(esp_partition): Improved granularity of power-off emulation for Linux 2023-08-09 14:14:14 +02:00
sonika.rathi c9b2b03d3d feat(example/storage/littlefs): add LittleFS demo example 2023-07-21 11:08:01 +02:00
KonstantinKondrashov e72061695e all: Removes unnecessary newline character in logs
Closes https://github.com/espressif/esp-idf/issues/11465
2023-06-09 03:31:21 +08:00
gaoxu 542a61b6cb support SPI_FLASH_ENABLE_COUNTERS feature on esp_flash driver and rename the functions to esp_flash_xx 2023-04-06 11:40:40 +08:00
Jakob Hasse f67bcc669a esp_partition: partition_linux.c and its test do not use hard-coded file anymore 2023-03-31 15:07:07 +08:00
Martin Vychodil 744742cb3d host_test:
[fatfs, wl]: partition.c interim update to work around non-Linux target
 [partition_api_test]: cleanup, new function for tmp filename generation
2023-03-08 05:06:30 +00:00
Martin Vychodil a2b4b27b62 esp_partition: Fixed use-after-free issue (coverity) 2023-03-08 05:06:30 +00:00
Martin Vychodil abc4d67a9d Storage: Fixed formatting of esp_partition Linux code 2023-03-03 23:57:34 +00:00