diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 306fc59bd6..3cba95905b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -129,9 +129,9 @@ repos: pass_filenames: false - id: check-generated-soc-caps-kconfig name: Check soc caps kconfig files are generated (based on components/soc/IDF_TARGET/include/soc/soc_caps.h) - entry: tools/gen_soc_caps_kconfig/gen_soc_caps_kconfig.py -d 'components/soc/*/include/soc/' 'components/esp_rom/*/' + entry: tools/gen_soc_caps_kconfig/gen_soc_caps_kconfig.py -d 'components/soc/*/include/soc/' 'components/esp_rom/*/' 'components/spi_flash/*/' language: python - files: 'components/soc/.+/include/soc/.+_caps\.h|components/esp_rom/.+/.+_caps\.h|kconfig\.soc_caps.in' + files: 'components/soc/.+/include/soc/.+_caps\.h|components/esp_rom/.+/.+_caps\.h|kconfig\.soc_caps.in|components/spi_flash/.+/.+_caps\.h' pass_filenames: false additional_dependencies: - pyparsing diff --git a/components/spi_flash/Kconfig b/components/spi_flash/Kconfig index cf73c13af1..f3f88ce8f5 100644 --- a/components/spi_flash/Kconfig +++ b/components/spi_flash/Kconfig @@ -219,9 +219,12 @@ menu "SPI Flash driver" menu "Auto-detect flash chips" visible if !SPI_FLASH_OVERRIDE_CHIP_DRIVER_LIST + orsource "./$IDF_TARGET/Kconfig.soc_caps.in" + config SPI_FLASH_SUPPORT_ISSI_CHIP bool "ISSI" - default y + default y if SPI_FLASH_VENDOR_ISSI_SUPPORTED + default n help Enable this to support auto detection of ISSI chips if chip vendor not directly given by ``chip_drv`` member of the chip struct. This adds support for variant @@ -229,7 +232,8 @@ menu "SPI Flash driver" config SPI_FLASH_SUPPORT_MXIC_CHIP bool "MXIC" - default y + default y if SPI_FLASH_VENDOR_MXIC_SUPPORTED + default n help Enable this to support auto detection of MXIC chips if chip vendor not directly given by ``chip_drv`` member of the chip struct. This adds support for variant @@ -237,7 +241,8 @@ menu "SPI Flash driver" config SPI_FLASH_SUPPORT_GD_CHIP bool "GigaDevice" - default y + default y if SPI_FLASH_VENDOR_GD_SUPPORTED + default n help Enable this to support auto detection of GD (GigaDevice) chips if chip vendor not directly given by ``chip_drv`` member of the chip struct. If you are using Wrover @@ -250,7 +255,8 @@ menu "SPI Flash driver" config SPI_FLASH_SUPPORT_WINBOND_CHIP bool "Winbond" - default y + default y if SPI_FLASH_VENDOR_WINBOND_SUPPORTED + default n help Enable this to support auto detection of Winbond chips if chip vendor not directly given by ``chip_drv`` member of the chip struct. This adds support for variant @@ -259,8 +265,8 @@ menu "SPI Flash driver" config SPI_FLASH_SUPPORT_BOYA_CHIP bool "BOYA" # ESP32 doens't usually use this chip, default n to save iram. - default n if IDF_TARGET_ESP32 - default y + default y if SPI_FLASH_VENDOR_BOYA_SUPPORTED + default n help Enable this to support auto detection of BOYA chips if chip vendor not directly given by ``chip_drv`` member of the chip struct. This adds support for variant @@ -269,8 +275,8 @@ menu "SPI Flash driver" config SPI_FLASH_SUPPORT_TH_CHIP bool "TH" # ESP32 doens't usually use this chip, default n to save iram. - default n if IDF_TARGET_ESP32 - default y + default y if SPI_FLASH_VENDOR_TH_SUPPORTED + default n help Enable this to support auto detection of TH chips if chip vendor not directly given by ``chip_drv`` member of the chip struct. This adds support for variant diff --git a/components/spi_flash/esp32/Kconfig.soc_caps.in b/components/spi_flash/esp32/Kconfig.soc_caps.in new file mode 100644 index 0000000000..530c5d7a59 --- /dev/null +++ b/components/spi_flash/esp32/Kconfig.soc_caps.in @@ -0,0 +1,24 @@ +##################################################### +# This file is auto-generated from SoC caps +# using gen_soc_caps_kconfig.py, do not edit manually +##################################################### + +config SPI_FLASH_VENDOR_XMC_SUPPORTED + bool + default y + +config SPI_FLASH_VENDOR_GD_SUPPORTED + bool + default y + +config SPI_FLASH_VENDOR_ISSI_SUPPORTED + bool + default y + +config SPI_FLASH_VENDOR_MXIC_SUPPORTED + bool + default y + +config SPI_FLASH_VENDOR_WINBOND_SUPPORTED + bool + default y diff --git a/components/spi_flash/esp32/flash_vendor_caps.h b/components/spi_flash/esp32/flash_vendor_caps.h new file mode 100644 index 0000000000..054b7158c4 --- /dev/null +++ b/components/spi_flash/esp32/flash_vendor_caps.h @@ -0,0 +1,29 @@ +/* + * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * This file records the flash vendor that we offically supported. + * we have many chip-specific files, like ``spi_flash_chip_gd.c``, + * which means that this file is used for GD flash chips. + * + * The following definations illustrate what flash vendor is officially + * supported by ESP chips. If a flash vendor is officially supported, the chip + * specific file will be linked by default, vice versa. You can also adjust this + * manually in Kconfig options. + * + * For example: + * Following `SPI_FLASH_VENDOR_ISSI_SUPPORTED` is (1), which means file `spi_flash_chip_issi.c` + * will be linked. + * + */ + +#pragma once + +#define SPI_FLASH_VENDOR_XMC_SUPPORTED (1) +#define SPI_FLASH_VENDOR_GD_SUPPORTED (1) +#define SPI_FLASH_VENDOR_ISSI_SUPPORTED (1) +#define SPI_FLASH_VENDOR_MXIC_SUPPORTED (1) +#define SPI_FLASH_VENDOR_WINBOND_SUPPORTED (1) diff --git a/components/spi_flash/esp32c2/Kconfig.soc_caps.in b/components/spi_flash/esp32c2/Kconfig.soc_caps.in new file mode 100644 index 0000000000..d1744a6196 --- /dev/null +++ b/components/spi_flash/esp32c2/Kconfig.soc_caps.in @@ -0,0 +1,32 @@ +##################################################### +# This file is auto-generated from SoC caps +# using gen_soc_caps_kconfig.py, do not edit manually +##################################################### + +config SPI_FLASH_VENDOR_XMC_SUPPORTED + bool + default y + +config SPI_FLASH_VENDOR_GD_SUPPORTED + bool + default y + +config SPI_FLASH_VENDOR_ISSI_SUPPORTED + bool + default y + +config SPI_FLASH_VENDOR_MXIC_SUPPORTED + bool + default y + +config SPI_FLASH_VENDOR_WINBOND_SUPPORTED + bool + default y + +config SPI_FLASH_VENDOR_BOYA_SUPPORTED + bool + default y + +config SPI_FLASH_VENDOR_TH_SUPPORTED + bool + default y diff --git a/components/spi_flash/esp32c2/flash_vendor_caps.h b/components/spi_flash/esp32c2/flash_vendor_caps.h new file mode 100644 index 0000000000..88b64fdba4 --- /dev/null +++ b/components/spi_flash/esp32c2/flash_vendor_caps.h @@ -0,0 +1,14 @@ +/* + * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#define SPI_FLASH_VENDOR_XMC_SUPPORTED (1) +#define SPI_FLASH_VENDOR_GD_SUPPORTED (1) +#define SPI_FLASH_VENDOR_ISSI_SUPPORTED (1) +#define SPI_FLASH_VENDOR_MXIC_SUPPORTED (1) +#define SPI_FLASH_VENDOR_WINBOND_SUPPORTED (1) +#define SPI_FLASH_VENDOR_BOYA_SUPPORTED (1) +#define SPI_FLASH_VENDOR_TH_SUPPORTED (1) diff --git a/components/spi_flash/esp32c3/Kconfig.soc_caps.in b/components/spi_flash/esp32c3/Kconfig.soc_caps.in new file mode 100644 index 0000000000..d1744a6196 --- /dev/null +++ b/components/spi_flash/esp32c3/Kconfig.soc_caps.in @@ -0,0 +1,32 @@ +##################################################### +# This file is auto-generated from SoC caps +# using gen_soc_caps_kconfig.py, do not edit manually +##################################################### + +config SPI_FLASH_VENDOR_XMC_SUPPORTED + bool + default y + +config SPI_FLASH_VENDOR_GD_SUPPORTED + bool + default y + +config SPI_FLASH_VENDOR_ISSI_SUPPORTED + bool + default y + +config SPI_FLASH_VENDOR_MXIC_SUPPORTED + bool + default y + +config SPI_FLASH_VENDOR_WINBOND_SUPPORTED + bool + default y + +config SPI_FLASH_VENDOR_BOYA_SUPPORTED + bool + default y + +config SPI_FLASH_VENDOR_TH_SUPPORTED + bool + default y diff --git a/components/spi_flash/esp32c3/flash_vendor_caps.h b/components/spi_flash/esp32c3/flash_vendor_caps.h new file mode 100644 index 0000000000..88b64fdba4 --- /dev/null +++ b/components/spi_flash/esp32c3/flash_vendor_caps.h @@ -0,0 +1,14 @@ +/* + * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#define SPI_FLASH_VENDOR_XMC_SUPPORTED (1) +#define SPI_FLASH_VENDOR_GD_SUPPORTED (1) +#define SPI_FLASH_VENDOR_ISSI_SUPPORTED (1) +#define SPI_FLASH_VENDOR_MXIC_SUPPORTED (1) +#define SPI_FLASH_VENDOR_WINBOND_SUPPORTED (1) +#define SPI_FLASH_VENDOR_BOYA_SUPPORTED (1) +#define SPI_FLASH_VENDOR_TH_SUPPORTED (1) diff --git a/components/spi_flash/esp32c6/Kconfig.soc_caps.in b/components/spi_flash/esp32c6/Kconfig.soc_caps.in new file mode 100644 index 0000000000..87accd576f --- /dev/null +++ b/components/spi_flash/esp32c6/Kconfig.soc_caps.in @@ -0,0 +1,8 @@ +##################################################### +# This file is auto-generated from SoC caps +# using gen_soc_caps_kconfig.py, do not edit manually +##################################################### + +config SPI_FLASH_VENDOR_XMC_SUPPORTED + bool + default y diff --git a/components/spi_flash/esp32c6/flash_vendor_caps.h b/components/spi_flash/esp32c6/flash_vendor_caps.h new file mode 100644 index 0000000000..ffa84babf7 --- /dev/null +++ b/components/spi_flash/esp32c6/flash_vendor_caps.h @@ -0,0 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#define SPI_FLASH_VENDOR_XMC_SUPPORTED (1) diff --git a/components/spi_flash/esp32h2/Kconfig.soc_caps.in b/components/spi_flash/esp32h2/Kconfig.soc_caps.in new file mode 100644 index 0000000000..87accd576f --- /dev/null +++ b/components/spi_flash/esp32h2/Kconfig.soc_caps.in @@ -0,0 +1,8 @@ +##################################################### +# This file is auto-generated from SoC caps +# using gen_soc_caps_kconfig.py, do not edit manually +##################################################### + +config SPI_FLASH_VENDOR_XMC_SUPPORTED + bool + default y diff --git a/components/spi_flash/esp32h2/flash_vendor_caps.h b/components/spi_flash/esp32h2/flash_vendor_caps.h new file mode 100644 index 0000000000..ffa84babf7 --- /dev/null +++ b/components/spi_flash/esp32h2/flash_vendor_caps.h @@ -0,0 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#define SPI_FLASH_VENDOR_XMC_SUPPORTED (1) diff --git a/components/spi_flash/esp32h4/Kconfig.soc_caps.in b/components/spi_flash/esp32h4/Kconfig.soc_caps.in new file mode 100644 index 0000000000..d1744a6196 --- /dev/null +++ b/components/spi_flash/esp32h4/Kconfig.soc_caps.in @@ -0,0 +1,32 @@ +##################################################### +# This file is auto-generated from SoC caps +# using gen_soc_caps_kconfig.py, do not edit manually +##################################################### + +config SPI_FLASH_VENDOR_XMC_SUPPORTED + bool + default y + +config SPI_FLASH_VENDOR_GD_SUPPORTED + bool + default y + +config SPI_FLASH_VENDOR_ISSI_SUPPORTED + bool + default y + +config SPI_FLASH_VENDOR_MXIC_SUPPORTED + bool + default y + +config SPI_FLASH_VENDOR_WINBOND_SUPPORTED + bool + default y + +config SPI_FLASH_VENDOR_BOYA_SUPPORTED + bool + default y + +config SPI_FLASH_VENDOR_TH_SUPPORTED + bool + default y diff --git a/components/spi_flash/esp32h4/flash_vendor_caps.h b/components/spi_flash/esp32h4/flash_vendor_caps.h new file mode 100644 index 0000000000..88b64fdba4 --- /dev/null +++ b/components/spi_flash/esp32h4/flash_vendor_caps.h @@ -0,0 +1,14 @@ +/* + * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#define SPI_FLASH_VENDOR_XMC_SUPPORTED (1) +#define SPI_FLASH_VENDOR_GD_SUPPORTED (1) +#define SPI_FLASH_VENDOR_ISSI_SUPPORTED (1) +#define SPI_FLASH_VENDOR_MXIC_SUPPORTED (1) +#define SPI_FLASH_VENDOR_WINBOND_SUPPORTED (1) +#define SPI_FLASH_VENDOR_BOYA_SUPPORTED (1) +#define SPI_FLASH_VENDOR_TH_SUPPORTED (1) diff --git a/components/spi_flash/esp32s2/Kconfig.soc_caps.in b/components/spi_flash/esp32s2/Kconfig.soc_caps.in new file mode 100644 index 0000000000..d1744a6196 --- /dev/null +++ b/components/spi_flash/esp32s2/Kconfig.soc_caps.in @@ -0,0 +1,32 @@ +##################################################### +# This file is auto-generated from SoC caps +# using gen_soc_caps_kconfig.py, do not edit manually +##################################################### + +config SPI_FLASH_VENDOR_XMC_SUPPORTED + bool + default y + +config SPI_FLASH_VENDOR_GD_SUPPORTED + bool + default y + +config SPI_FLASH_VENDOR_ISSI_SUPPORTED + bool + default y + +config SPI_FLASH_VENDOR_MXIC_SUPPORTED + bool + default y + +config SPI_FLASH_VENDOR_WINBOND_SUPPORTED + bool + default y + +config SPI_FLASH_VENDOR_BOYA_SUPPORTED + bool + default y + +config SPI_FLASH_VENDOR_TH_SUPPORTED + bool + default y diff --git a/components/spi_flash/esp32s2/flash_vendor_caps.h b/components/spi_flash/esp32s2/flash_vendor_caps.h new file mode 100644 index 0000000000..88b64fdba4 --- /dev/null +++ b/components/spi_flash/esp32s2/flash_vendor_caps.h @@ -0,0 +1,14 @@ +/* + * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#define SPI_FLASH_VENDOR_XMC_SUPPORTED (1) +#define SPI_FLASH_VENDOR_GD_SUPPORTED (1) +#define SPI_FLASH_VENDOR_ISSI_SUPPORTED (1) +#define SPI_FLASH_VENDOR_MXIC_SUPPORTED (1) +#define SPI_FLASH_VENDOR_WINBOND_SUPPORTED (1) +#define SPI_FLASH_VENDOR_BOYA_SUPPORTED (1) +#define SPI_FLASH_VENDOR_TH_SUPPORTED (1) diff --git a/components/spi_flash/esp32s3/Kconfig.soc_caps.in b/components/spi_flash/esp32s3/Kconfig.soc_caps.in new file mode 100644 index 0000000000..d1744a6196 --- /dev/null +++ b/components/spi_flash/esp32s3/Kconfig.soc_caps.in @@ -0,0 +1,32 @@ +##################################################### +# This file is auto-generated from SoC caps +# using gen_soc_caps_kconfig.py, do not edit manually +##################################################### + +config SPI_FLASH_VENDOR_XMC_SUPPORTED + bool + default y + +config SPI_FLASH_VENDOR_GD_SUPPORTED + bool + default y + +config SPI_FLASH_VENDOR_ISSI_SUPPORTED + bool + default y + +config SPI_FLASH_VENDOR_MXIC_SUPPORTED + bool + default y + +config SPI_FLASH_VENDOR_WINBOND_SUPPORTED + bool + default y + +config SPI_FLASH_VENDOR_BOYA_SUPPORTED + bool + default y + +config SPI_FLASH_VENDOR_TH_SUPPORTED + bool + default y diff --git a/components/spi_flash/esp32s3/flash_vendor_caps.h b/components/spi_flash/esp32s3/flash_vendor_caps.h new file mode 100644 index 0000000000..ba081b1b13 --- /dev/null +++ b/components/spi_flash/esp32s3/flash_vendor_caps.h @@ -0,0 +1,15 @@ +/* + * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +#define SPI_FLASH_VENDOR_XMC_SUPPORTED (1) +#define SPI_FLASH_VENDOR_GD_SUPPORTED (1) +#define SPI_FLASH_VENDOR_ISSI_SUPPORTED (1) +#define SPI_FLASH_VENDOR_MXIC_SUPPORTED (1) +#define SPI_FLASH_VENDOR_WINBOND_SUPPORTED (1) +#define SPI_FLASH_VENDOR_BOYA_SUPPORTED (1) +#define SPI_FLASH_VENDOR_TH_SUPPORTED (1) diff --git a/docs/en/api-guides/performance/ram-usage.rst b/docs/en/api-guides/performance/ram-usage.rst index 6132998d0f..415661138b 100644 --- a/docs/en/api-guides/performance/ram-usage.rst +++ b/docs/en/api-guides/performance/ram-usage.rst @@ -140,6 +140,7 @@ The following options will reduce IRAM usage of some ESP-IDF features: - Disabling :ref:`CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR` prevents posting ``esp_event`` events from :ref:`iram-safe-interrupt-handlers` but will save some IRAM. - Disabling :ref:`CONFIG_SPI_MASTER_ISR_IN_IRAM` prevents spi_master interrupts from being serviced while writing to flash, and may otherwise reduce spi_master performance, but will save some IRAM. - Setting :ref:`CONFIG_HAL_DEFAULT_ASSERTION_LEVEL` to disable assertion for HAL component will save some IRAM especially for HAL code who calls `HAL_ASSERT` a lot and resides in IRAM. + - Refer to sdkconfig menu ``Auto-detect flash chips`` and you can disable flash drivers which you don't need to save some IRAM. .. only:: esp32c3 diff --git a/docs/en/api-reference/peripherals/spi_flash/index.rst b/docs/en/api-reference/peripherals/spi_flash/index.rst index b0a2bd8ae9..1531a4eed9 100644 --- a/docs/en/api-reference/peripherals/spi_flash/index.rst +++ b/docs/en/api-reference/peripherals/spi_flash/index.rst @@ -47,6 +47,10 @@ Quad mode (QIO/QOUT) is supported on following chip types: 6. XMC 7. BOYA +.. note:: + + For every flash chip vendor listed above will only be supported by default when the flash is officially supported. If you want to enable/disable the flash series you can go through Kconfig manu ``Auto-detect flash chips``. + Optional Features ^^^^^^^^^^^^^^^^^