Merge branch 'feature/spi_flash_vendor_classify' into 'master'

spi_flash: only link flash vendor which is officially supported to save IRAM

See merge request espressif/esp-idf!22255
This commit is contained in:
C.S.M
2023-02-09 13:48:15 +08:00
20 changed files with 337 additions and 10 deletions

View File

@@ -129,9 +129,9 @@ repos:
pass_filenames: false pass_filenames: false
- id: check-generated-soc-caps-kconfig - 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) 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 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 pass_filenames: false
additional_dependencies: additional_dependencies:
- pyparsing - pyparsing

View File

@@ -219,9 +219,12 @@ menu "SPI Flash driver"
menu "Auto-detect flash chips" menu "Auto-detect flash chips"
visible if !SPI_FLASH_OVERRIDE_CHIP_DRIVER_LIST visible if !SPI_FLASH_OVERRIDE_CHIP_DRIVER_LIST
orsource "./$IDF_TARGET/Kconfig.soc_caps.in"
config SPI_FLASH_SUPPORT_ISSI_CHIP config SPI_FLASH_SUPPORT_ISSI_CHIP
bool "ISSI" bool "ISSI"
default y default y if SPI_FLASH_VENDOR_ISSI_SUPPORTED
default n
help help
Enable this to support auto detection of ISSI chips if chip vendor not directly 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 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 config SPI_FLASH_SUPPORT_MXIC_CHIP
bool "MXIC" bool "MXIC"
default y default y if SPI_FLASH_VENDOR_MXIC_SUPPORTED
default n
help help
Enable this to support auto detection of MXIC chips if chip vendor not directly 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 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 config SPI_FLASH_SUPPORT_GD_CHIP
bool "GigaDevice" bool "GigaDevice"
default y default y if SPI_FLASH_VENDOR_GD_SUPPORTED
default n
help help
Enable this to support auto detection of GD (GigaDevice) chips if chip vendor not 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 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 config SPI_FLASH_SUPPORT_WINBOND_CHIP
bool "Winbond" bool "Winbond"
default y default y if SPI_FLASH_VENDOR_WINBOND_SUPPORTED
default n
help help
Enable this to support auto detection of Winbond chips if chip vendor not directly 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 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 config SPI_FLASH_SUPPORT_BOYA_CHIP
bool "BOYA" bool "BOYA"
# ESP32 doens't usually use this chip, default n to save iram. # ESP32 doens't usually use this chip, default n to save iram.
default n if IDF_TARGET_ESP32 default y if SPI_FLASH_VENDOR_BOYA_SUPPORTED
default y default n
help help
Enable this to support auto detection of BOYA chips if chip vendor not directly 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 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 config SPI_FLASH_SUPPORT_TH_CHIP
bool "TH" bool "TH"
# ESP32 doens't usually use this chip, default n to save iram. # ESP32 doens't usually use this chip, default n to save iram.
default n if IDF_TARGET_ESP32 default y if SPI_FLASH_VENDOR_TH_SUPPORTED
default y default n
help help
Enable this to support auto detection of TH chips if chip vendor not directly 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 given by ``chip_drv`` member of the chip struct. This adds support for variant

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -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)

View File

@@ -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_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. - 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. - 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 .. only:: esp32c3

View File

@@ -47,6 +47,10 @@ Quad mode (QIO/QOUT) is supported on following chip types:
6. XMC 6. XMC
7. BOYA 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 Optional Features
^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^