From 018de8101fb8356dd5ed17a02535d0f78673a5bc Mon Sep 17 00:00:00 2001 From: suda-morris <362953310@qq.com> Date: Fri, 12 Jul 2019 17:58:45 +0800 Subject: [PATCH] ethernet: can build without enable esp32 emac Closes https://github.com/espressif/esp-idf/issues/3770 --- components/esp_eth/CMakeLists.txt | 2 +- components/esp_eth/component.mk | 2 +- components/soc/esp32/component.mk | 4 ++++ components/soc/esp32/sources.cmake | 2 +- components/soc/linker.lf | 13 +++++++------ 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/components/esp_eth/CMakeLists.txt b/components/esp_eth/CMakeLists.txt index 7f41a8409..3829df188 100644 --- a/components/esp_eth/CMakeLists.txt +++ b/components/esp_eth/CMakeLists.txt @@ -4,7 +4,7 @@ set(esp_eth_srcs "src/esp_eth.c" "src/esp_eth_phy_lan8720.c" "src/esp_eth_phy_rtl8201.c") -if(CONFIG_IDF_TARGET_ESP32) +if(CONFIG_ETH_USE_ESP32_EMAC) list(APPEND esp_eth_srcs "src/esp_eth_mac_esp32.c") endif() diff --git a/components/esp_eth/component.mk b/components/esp_eth/component.mk index 2a5ba23b3..3a768fdf8 100644 --- a/components/esp_eth/component.mk +++ b/components/esp_eth/component.mk @@ -5,7 +5,7 @@ COMPONENT_ADD_INCLUDEDIRS := include COMPONENT_SRCDIRS := src COMPONENT_ADD_LDFRAGMENTS += linker.lf -ifndef CONFIG_IDF_TARGET_ESP32 +ifndef CONFIG_ETH_USE_ESP32_EMAC COMPONENT_OBJEXCLUDE += src/esp_eth_mac_esp32.o endif diff --git a/components/soc/esp32/component.mk b/components/soc/esp32/component.mk index 83a2ef722..52c33c8d2 100644 --- a/components/soc/esp32/component.mk +++ b/components/soc/esp32/component.mk @@ -1 +1,5 @@ +ifndef CONFIG_ETH_USE_ESP32_EMAC + COMPONENT_OBJEXCLUDE += esp32/emac_hal.o +endif + esp32/rtc_clk.o: CFLAGS += -fno-jump-tables -fno-tree-switch-conversion diff --git a/components/soc/esp32/sources.cmake b/components/soc/esp32/sources.cmake index ea4201cc0..a5471b6b3 100644 --- a/components/soc/esp32/sources.cmake +++ b/components/soc/esp32/sources.cmake @@ -13,7 +13,7 @@ set(SOC_SRCS "cpu_util.c" "soc_memory_layout.c" "spi_periph.c") -if(NOT BOOTLOADER_BUILD) +if(NOT BOOTLOADER_BUILD AND CONFIG_ETH_USE_ESP32_EMAC) list(APPEND SOC_SRCS "emac_hal.c") endif() diff --git a/components/soc/linker.lf b/components/soc/linker.lf index 2d0918a8b..21aa0a033 100644 --- a/components/soc/linker.lf +++ b/components/soc/linker.lf @@ -14,9 +14,10 @@ entries: spi_slave_hal_iram (noflash_text) spi_flash_hal_iram (noflash) lldesc (noflash_text) - emac_hal:emac_hal_isr (noflash_text) - emac_hal:emac_hal_tx_complete_cb (noflash_text) - emac_hal:emac_hal_tx_unavail_cb (noflash_text) - emac_hal:emac_hal_rx_complete_cb (noflash_text) - emac_hal:emac_hal_rx_early_cb (noflash_text) - emac_hal:emac_hal_rx_unavail_cb (noflash_text) + if ETH_USE_ESP32_EMAC = y: + emac_hal:emac_hal_isr (noflash_text) + emac_hal:emac_hal_tx_complete_cb (noflash_text) + emac_hal:emac_hal_tx_unavail_cb (noflash_text) + emac_hal:emac_hal_rx_complete_cb (noflash_text) + emac_hal:emac_hal_rx_early_cb (noflash_text) + emac_hal:emac_hal_rx_unavail_cb (noflash_text)