From fb420725d2fc56b78ca4d7997e165675394c76a1 Mon Sep 17 00:00:00 2001 From: Armando Date: Tue, 27 Jun 2023 15:59:46 +0800 Subject: [PATCH] feat(hal): unify hal cmake for spi_flash_hal_gpspi.c --- components/hal/CMakeLists.txt | 24 ++++------------------- components/spi_flash/memspi_host_driver.c | 4 ++++ 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/components/hal/CMakeLists.txt b/components/hal/CMakeLists.txt index ad55f1490d..b12b620ae1 100644 --- a/components/hal/CMakeLists.txt +++ b/components/hal/CMakeLists.txt @@ -167,6 +167,10 @@ if(NOT BOOTLOADER_BUILD) list(APPEND srcs "spi_slave_hd_hal.c") endif() + if(CONFIG_SOC_GPSPI_SUPPORTED AND NOT CONFIG_IDF_TARGET_ESP32) + list(APPEND srcs "spi_flash_hal_gpspi.c") + endif() + if(CONFIG_SOC_SDIO_SLAVE_SUPPORTED) list(APPEND srcs "sdio_slave_hal.c") endif() @@ -198,7 +202,6 @@ if(NOT BOOTLOADER_BUILD) if(${target} STREQUAL "esp32s2") list(APPEND srcs - "spi_flash_hal_gpspi.c" "touch_sensor_hal.c" "usb_hal.c" "usb_phy_hal.c" @@ -210,7 +213,6 @@ if(NOT BOOTLOADER_BUILD) if(${target} STREQUAL "esp32s3") list(APPEND srcs - "spi_flash_hal_gpspi.c" "touch_sensor_hal.c" "usb_hal.c" "usb_phy_hal.c" @@ -222,34 +224,16 @@ if(NOT BOOTLOADER_BUILD) if(${target} STREQUAL "esp32c3") list(APPEND srcs - "spi_flash_hal_gpspi.c" "xt_wdt_hal.c" "esp32c3/rtc_cntl_hal.c") endif() if(${target} STREQUAL "esp32c2") list(APPEND srcs - "spi_flash_hal_gpspi.c" "esp32c2/rtc_cntl_hal.c") endif() - if(${target} STREQUAL "esp32c6") - list(APPEND srcs - "spi_flash_hal_gpspi.c") - - endif() - - if(${target} STREQUAL "esp32p4") - list(APPEND srcs - "spi_flash_hal_gpspi.c") - - endif() - if(${target} STREQUAL "esp32h2") - list(APPEND srcs - "spi_flash_hal_gpspi.c" - ) - list(REMOVE_ITEM srcs "esp32h2/rtc_cntl_hal.c" ) diff --git a/components/spi_flash/memspi_host_driver.c b/components/spi_flash/memspi_host_driver.c index 0668c9a65b..d8210f81fc 100644 --- a/components/spi_flash/memspi_host_driver.c +++ b/components/spi_flash/memspi_host_driver.c @@ -34,6 +34,7 @@ extern uint32_t spi_flash_hal_gpspi_check_status(spi_flash_host_inst_t *host); extern bool spi_flash_hal_gpspi_supports_direct_write(spi_flash_host_inst_t *host, const void *p); extern bool spi_flash_hal_gpspi_supports_direct_read(spi_flash_host_inst_t *host, const void *p); +#if SOC_GPSPI_SUPPORTED /** Default configuration for GPSPI */ static const spi_flash_host_driver_t esp_flash_gpspi_host = { .dev_config = spi_flash_hal_gpspi_device_config, @@ -58,6 +59,9 @@ static const spi_flash_host_driver_t esp_flash_gpspi_host = { .resume = spi_flash_hal_resume, .suspend = spi_flash_hal_suspend, }; +#else +static const spi_flash_host_driver_t esp_flash_gpspi_host = {}; +#endif #endif esp_err_t memspi_host_init_pointers(memspi_host_inst_t *host, const memspi_host_config_t *cfg)