mirror of
https://github.com/espressif/esp-idf
synced 2025-03-09 17:19:09 -04:00
feat(wifi): avoid compiling components related to wifi when wifi is not supported
This commit is contained in:
parent
9240757145
commit
a34f1eb6f9
@ -4,6 +4,22 @@ if(${idf_target} STREQUAL "linux")
|
|||||||
return() # This component is not supported by the POSIX/Linux simulator
|
return() # This component is not supported by the POSIX/Linux simulator
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if( NOT CONFIG_ESP_WIFI_ENABLED
|
||||||
|
AND NOT CONFIG_ESP_HOST_WIFI_ENABLED
|
||||||
|
AND NOT CMAKE_BUILD_EARLY_EXPANSION )
|
||||||
|
# No local wifi: provide only netif bindings
|
||||||
|
set(srcs
|
||||||
|
"src/wifi_default.c"
|
||||||
|
"src/wifi_netif.c"
|
||||||
|
"src/wifi_default_ap.c")
|
||||||
|
|
||||||
|
# This component provides "esp_wifi" "wifi_apps/nan_app" headers if WiFi not enabled
|
||||||
|
# (implementation supported optionally in a managed component esp_wifi_remote)
|
||||||
|
idf_component_register(SRCS "${srcs}"
|
||||||
|
INCLUDE_DIRS "include" "wifi_apps/nan_app/include")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
if(CONFIG_ESP_WIFI_ENABLED OR CONFIG_ESP_HOST_WIFI_ENABLED)
|
if(CONFIG_ESP_WIFI_ENABLED OR CONFIG_ESP_HOST_WIFI_ENABLED)
|
||||||
|
|
||||||
if(CONFIG_APP_NO_BLOBS)
|
if(CONFIG_APP_NO_BLOBS)
|
||||||
@ -42,19 +58,10 @@ if(CONFIG_ESP_WIFI_ENABLED OR CONFIG_ESP_HOST_WIFI_ENABLED)
|
|||||||
if(CONFIG_ESP_WIFI_ENABLE_ROAMING_APP)
|
if(CONFIG_ESP_WIFI_ENABLE_ROAMING_APP)
|
||||||
list(APPEND srcs "wifi_apps/roaming_app/src/roaming_app.c")
|
list(APPEND srcs "wifi_apps/roaming_app/src/roaming_app.c")
|
||||||
endif()
|
endif()
|
||||||
set(local_include_dirs include/local)
|
|
||||||
else()
|
|
||||||
# No local wifi: provide only netif bindings
|
|
||||||
set(srcs
|
|
||||||
"src/wifi_default.c"
|
|
||||||
"src/wifi_netif.c"
|
|
||||||
"src/wifi_default_ap.c")
|
|
||||||
set(local_include_dirs)
|
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
idf_component_register(SRCS "${srcs}"
|
idf_component_register(SRCS "${srcs}"
|
||||||
INCLUDE_DIRS "include" "wifi_apps/include" "wifi_apps/nan_app/include" ${local_include_dirs}
|
INCLUDE_DIRS "include" "include/local" "wifi_apps/include" "wifi_apps/nan_app/include"
|
||||||
|
|
||||||
REQUIRES esp_event esp_phy esp_netif
|
REQUIRES esp_event esp_phy esp_netif
|
||||||
PRIV_REQUIRES driver esptool_py esp_pm esp_timer nvs_flash
|
PRIV_REQUIRES driver esptool_py esp_pm esp_timer nvs_flash
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
menu "Wi-Fi"
|
menu "Wi-Fi"
|
||||||
# TODO: Disable WIFI support on ESP32-H2 (WIFI-5796)
|
visible if (SOC_WIFI_SUPPORTED || SOC_WIRELESS_HOST_SUPPORTED)
|
||||||
# visible if SOC_WIFI_SUPPORTED
|
|
||||||
|
|
||||||
config ESP_WIFI_ENABLED
|
config ESP_WIFI_ENABLED
|
||||||
bool
|
bool
|
||||||
|
@ -17,7 +17,7 @@ extern "C" {
|
|||||||
// Number of maximum wifi connection may be undefined if we have no native wifi support on this target
|
// Number of maximum wifi connection may be undefined if we have no native wifi support on this target
|
||||||
// and at the same time there's no native interface injected by the wifi_remote component.
|
// and at the same time there's no native interface injected by the wifi_remote component.
|
||||||
// In this case, we just let the header compilable, since no wifi API could be used (let's make a sanity check)
|
// In this case, we just let the header compilable, since no wifi API could be used (let's make a sanity check)
|
||||||
#if !CONFIG_SOC_WIFI_SUPPORTED && !CONFIG_ESP_WIFI_REMOTE_ENABLED
|
#if !CONFIG_SOC_WIFI_SUPPORTED && !CONFIG_ESP_WIFI_REMOTE_ENABLED && !CONFIG_ESP_HOST_WIFI_ENABLED
|
||||||
#define ESP_WIFI_MAX_CONN_NUM (15)
|
#define ESP_WIFI_MAX_CONN_NUM (15)
|
||||||
typedef struct wifi_sta_list_t wifi_sta_list_t;
|
typedef struct wifi_sta_list_t wifi_sta_list_t;
|
||||||
#else
|
#else
|
||||||
|
@ -4,6 +4,15 @@ if(${target} STREQUAL "linux")
|
|||||||
return() # This component is not supported by the POSIX/Linux simulator
|
return() # This component is not supported by the POSIX/Linux simulator
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if( NOT CONFIG_ESP_WIFI_ENABLED
|
||||||
|
AND NOT CONFIG_ESP_HOST_WIFI_ENABLED
|
||||||
|
AND NOT CMAKE_BUILD_EARLY_EXPANSION )
|
||||||
|
# This component provides only "esp_provisioning" headers if WiFi not enabled
|
||||||
|
# (implementation supported optionally in a managed component esp_wifi_remote)
|
||||||
|
idf_component_register(INCLUDE_DIRS include)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
set(srcs "src/wifi_config.c"
|
set(srcs "src/wifi_config.c"
|
||||||
"src/wifi_scan.c"
|
"src/wifi_scan.c"
|
||||||
"src/wifi_ctrl.c"
|
"src/wifi_ctrl.c"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
menu "Wi-Fi Provisioning Manager"
|
menu "Wi-Fi Provisioning Manager"
|
||||||
|
visible if (SOC_WIFI_SUPPORTED || SOC_WIRELESS_HOST_SUPPORTED)
|
||||||
config WIFI_PROV_SCAN_MAX_ENTRIES
|
config WIFI_PROV_SCAN_MAX_ENTRIES
|
||||||
int "Max Wi-Fi Scan Result Entries"
|
int "Max Wi-Fi Scan Result Entries"
|
||||||
default 16
|
default 16
|
||||||
|
@ -6,7 +6,9 @@ else()
|
|||||||
set(linker_fragments linker.lf)
|
set(linker_fragments linker.lf)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT CONFIG_ESP_WIFI_ENABLED AND NOT CONFIG_ESP_HOST_WIFI_ENABLED AND NOT CMAKE_BUILD_EARLY_EXPANSION)
|
if( NOT CONFIG_ESP_WIFI_ENABLED
|
||||||
|
AND NOT CONFIG_ESP_HOST_WIFI_ENABLED
|
||||||
|
AND NOT CMAKE_BUILD_EARLY_EXPANSION )
|
||||||
# This component provides only "esp_supplicant" headers if WiFi not enabled
|
# This component provides only "esp_supplicant" headers if WiFi not enabled
|
||||||
# (implementation supported optionally in a managed component esp_wifi_remote)
|
# (implementation supported optionally in a managed component esp_wifi_remote)
|
||||||
idf_component_register(INCLUDE_DIRS esp_supplicant/include)
|
idf_component_register(INCLUDE_DIRS esp_supplicant/include)
|
||||||
|
@ -4,7 +4,7 @@ menu "Example Connection Configuration"
|
|||||||
|
|
||||||
config EXAMPLE_CONNECT_WIFI
|
config EXAMPLE_CONNECT_WIFI
|
||||||
bool "connect using WiFi interface"
|
bool "connect using WiFi interface"
|
||||||
depends on !IDF_TARGET_LINUX && (SOC_WIFI_SUPPORTED || ESP_WIFI_REMOTE_ENABLED)
|
depends on !IDF_TARGET_LINUX && (SOC_WIFI_SUPPORTED || ESP_WIFI_REMOTE_ENABLED || ESP_HOST_WIFI_ENABLED)
|
||||||
default y if SOC_WIFI_SUPPORTED
|
default y if SOC_WIFI_SUPPORTED
|
||||||
help
|
help
|
||||||
Protocol examples can use Wi-Fi and/or Ethernet to connect to the network.
|
Protocol examples can use Wi-Fi and/or Ethernet to connect to the network.
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
idf_component_register(SRCS "cmd_wifi.c"
|
if(CONFIG_ESP_WIFI_ENABLED OR CONFIG_ESP_HOST_WIFI_ENABLED)
|
||||||
|
set(srcs "cmd_wifi.c")
|
||||||
|
else()
|
||||||
|
set(srcs)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
idf_component_register(SRCS "${srcs}"
|
||||||
INCLUDE_DIRS .
|
INCLUDE_DIRS .
|
||||||
REQUIRES console esp_wifi)
|
REQUIRES console esp_wifi)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||||
*/
|
*/
|
||||||
@ -24,11 +24,6 @@
|
|||||||
#include "esp_event.h"
|
#include "esp_event.h"
|
||||||
#include "cmd_wifi.h"
|
#include "cmd_wifi.h"
|
||||||
|
|
||||||
/**
|
|
||||||
* This component will be supported using esp_wifi_remote
|
|
||||||
*/
|
|
||||||
#if CONFIG_SOC_WIFI_SUPPORTED
|
|
||||||
|
|
||||||
#define JOIN_TIMEOUT_MS (10000)
|
#define JOIN_TIMEOUT_MS (10000)
|
||||||
|
|
||||||
static EventGroupHandle_t wifi_event_group;
|
static EventGroupHandle_t wifi_event_group;
|
||||||
@ -139,5 +134,3 @@ void register_wifi(void)
|
|||||||
|
|
||||||
ESP_ERROR_CHECK( esp_console_cmd_register(&join_cmd) );
|
ESP_ERROR_CHECK( esp_console_cmd_register(&join_cmd) );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // CONFIG_SOC_WIFI_SUPPORTED
|
|
||||||
|
@ -102,7 +102,7 @@ void app_main(void)
|
|||||||
#if SOC_DEEP_SLEEP_SUPPORTED
|
#if SOC_DEEP_SLEEP_SUPPORTED
|
||||||
register_system_deep_sleep();
|
register_system_deep_sleep();
|
||||||
#endif
|
#endif
|
||||||
#if SOC_WIFI_SUPPORTED
|
#if (CONFIG_ESP_WIFI_ENABLED || CONFIG_ESP_HOST_WIFI_ENABLED)
|
||||||
register_wifi();
|
register_wifi();
|
||||||
#endif
|
#endif
|
||||||
register_nvs();
|
register_nvs();
|
||||||
|
@ -97,7 +97,7 @@ void app_main(void)
|
|||||||
#if SOC_DEEP_SLEEP_SUPPORTED
|
#if SOC_DEEP_SLEEP_SUPPORTED
|
||||||
register_system_deep_sleep();
|
register_system_deep_sleep();
|
||||||
#endif
|
#endif
|
||||||
#if SOC_WIFI_SUPPORTED
|
#if (CONFIG_ESP_WIFI_ENABLED || CONFIG_ESP_HOST_WIFI_ENABLED)
|
||||||
register_wifi();
|
register_wifi();
|
||||||
#endif
|
#endif
|
||||||
register_nvs();
|
register_nvs();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user