Skip to content

Commit

Permalink
Merge branch 'feature/spi_flash_vendor_classify' into 'master'
Browse files Browse the repository at this point in the history
spi_flash: only link flash vendor which is officially supported to save IRAM

See merge request espressif/esp-idf!22255
  • Loading branch information
mythbuster5 committed Feb 9, 2023
2 parents d2c3700 + 0f8f13d commit 7e08b40
Show file tree
Hide file tree
Showing 20 changed files with 337 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Expand Up @@ -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
Expand Down
22 changes: 14 additions & 8 deletions components/spi_flash/Kconfig
Expand Up @@ -219,25 +219,30 @@ 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
chips, however will extend detecting time.

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
chips, however will extend detecting time.

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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
24 changes: 24 additions & 0 deletions 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
29 changes: 29 additions & 0 deletions 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)
32 changes: 32 additions & 0 deletions 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
14 changes: 14 additions & 0 deletions 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)
32 changes: 32 additions & 0 deletions 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
14 changes: 14 additions & 0 deletions 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)
8 changes: 8 additions & 0 deletions 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
8 changes: 8 additions & 0 deletions 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)
8 changes: 8 additions & 0 deletions 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
8 changes: 8 additions & 0 deletions 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)
32 changes: 32 additions & 0 deletions 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
14 changes: 14 additions & 0 deletions 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)
32 changes: 32 additions & 0 deletions 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
14 changes: 14 additions & 0 deletions 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)
32 changes: 32 additions & 0 deletions 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

0 comments on commit 7e08b40

Please sign in to comment.