lwip: make some of the component dependencies optional

This commit is contained in:
Ivan Grokhotkov
2021-12-13 10:04:43 +01:00
parent 71a884571c
commit 7a5ed12c6b
2 changed files with 17 additions and 10 deletions

View File

@@ -86,7 +86,6 @@ set(srcs
"port/esp32/hooks/lwip_default_hooks.c" "port/esp32/hooks/lwip_default_hooks.c"
"port/esp32/debug/lwip_debug.c" "port/esp32/debug/lwip_debug.c"
"port/esp32/freertos/sys_arch.c" "port/esp32/freertos/sys_arch.c"
"port/esp32/netif/dhcp_state.c"
"port/esp32/netif/wlanif.c") "port/esp32/netif/wlanif.c")
if(CONFIG_LWIP_PPP_SUPPORT) if(CONFIG_LWIP_PPP_SUPPORT)
@@ -148,11 +147,15 @@ if(CONFIG_LWIP_DHCPS)
list(APPEND srcs "apps/dhcpserver/dhcpserver.c") list(APPEND srcs "apps/dhcpserver/dhcpserver.c")
endif() endif()
if(CONFIG_LWIP_DHCP_RESTORE_LAST_IP)
list(APPEND srcs "port/esp32/netif/dhcp_state.c")
endif()
idf_component_register(SRCS "${srcs}" idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "${include_dirs}" INCLUDE_DIRS "${include_dirs}"
LDFRAGMENTS linker.lf LDFRAGMENTS linker.lf
REQUIRES vfs esp_wifi REQUIRES vfs esp_wifi
PRIV_REQUIRES esp_eth esp_netif tcpip_adapter nvs_flash openthread) PRIV_REQUIRES esp_netif tcpip_adapter)
# lots of LWIP source files evaluate macros that check address of stack variables # lots of LWIP source files evaluate macros that check address of stack variables
target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-address) target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-address)
@@ -174,3 +177,15 @@ set_source_files_properties(
PROPERTIES COMPILE_FLAGS PROPERTIES COMPILE_FLAGS
-Wno-type-limits -Wno-type-limits
) )
if(CONFIG_OPENTHREAD_ENABLED)
idf_component_optional_requires(PRIVATE openthread)
endif()
if(CONFIG_ETH_ENABLED)
idf_component_optional_requires(PRIVATE esp_eth)
endif()
if(CONFIG_LWIP_DHCP_RESTORE_LAST_IP)
idf_component_optional_requires(PRIVATE nvs_flash)
endif()

View File

@@ -37,8 +37,6 @@ set(extra_components_which_shouldnt_be_included
# efuse and app_update should be removed from G1 build; # efuse and app_update should be removed from G1 build;
# [refactor-todo]: see if the dependency from spi_flash can be made weak # [refactor-todo]: see if the dependency from spi_flash can be made weak
bootloader_support bootloader_support
# console is pulled in by openthread, which should be removed
console
# [refactor-todo]: should cxx be in G1? Can it exist without FreeRTOS? # [refactor-todo]: should cxx be in G1? Can it exist without FreeRTOS?
cxx cxx
# [refactor-todo]: driver is a dependency of esp_pm, esp_timer, spi_flash, vfs, esp_wifi, ${IDF_TARGET} # [refactor-todo]: driver is a dependency of esp_pm, esp_timer, spi_flash, vfs, esp_wifi, ${IDF_TARGET}
@@ -79,9 +77,6 @@ set(extra_components_which_shouldnt_be_included
# esptool_py is a dependency of bootloader, esp_wifi, app_update, partition_table, all of which # esptool_py is a dependency of bootloader, esp_wifi, app_update, partition_table, all of which
# should be removed from G1-only build. # should be removed from G1-only build.
esptool_py esptool_py
# a recent addition to the G1-only build, ieee802154 is a dependency of openthread, to be removed
# once openthread is (easily) removed.
ieee802154
# lwip is a common component due to "sys/socket.h" header. # lwip is a common component due to "sys/socket.h" header.
# [refactor-todo] consider adding a system-level sys/socket.h in newlib instead # [refactor-todo] consider adding a system-level sys/socket.h in newlib instead
lwip lwip
@@ -90,11 +85,8 @@ set(extra_components_which_shouldnt_be_included
mbedtls mbedtls
# nvs_flash is required by: # nvs_flash is required by:
# esp_system — no obvious reason, [refactor-todo] why? # esp_system — no obvious reason, [refactor-todo] why?
# lwip — can be turned into a weak dependency
# esp_wifi, esp_phy — both should be removed # esp_wifi, esp_phy — both should be removed
nvs_flash nvs_flash
# openthread is a dependency of lwip, it is easy to turn it into a conditional one
openthread
# partition_table is pulled in by app_update, esptool_py, bootloader; all to be removed # partition_table is pulled in by app_update, esptool_py, bootloader; all to be removed
partition_table partition_table
# pthread is required by esp_system (for initialization only, can be made a weak dependency) # pthread is required by esp_system (for initialization only, can be made a weak dependency)