Просмотр исходного кода

kconfig: Remove Wi-Fi on/off as a menuconfig option

This is no longer required since the functions automatically get
pulled in based on the usage. A quick summary of footprint
comparisions before and after these set of patches is shown below:

Hello-World: (simplified for readability)
 old Total image size:~ 104902 bytes (.bin may be padded larger)
 old Total image size:~ 105254 bytes (.bin may be padded larger)
 Per-archive contributions to ELF file:
             Archive File DRAM .data & .bss   IRAM Flash code & rodata   Total
 old              libesp32.a       1973    177   4445       3939     2267   12801
 new              libesp32.a       1973    185   4473       3939     2267   12837

 new             libnvs_flash.a          0     92      0        274        8     374
 new             libstdc++.a          0      0      0         24        0      24

For some reason, nvs_flash.a (~400bytes) gets pulled in (particularly
the nvs_flash_init() function).

Power-Save: (simplified for readability)
 old Total image size:~ 421347 bytes (.bin may be padded larger)
 old Total image size:~ 421235 bytes (.bin may be padded larger)

 old      libtcpip_adapter.a          0     81      0       1947      115       2143
 new      libtcpip_adapter.a          0     69      0       1897      115       2081

The size actually shrinks a bit, since the AP interface function
doesn't get pulled in.
Kedar Sovani 8 лет назад
Родитель
Сommit
ba8cd58b08

+ 4 - 25
components/esp32/Kconfig

@@ -560,15 +560,11 @@ config ESP32_XTAL_FREQ
 
 endmenu
 
-menuconfig WIFI_ENABLED
-    bool "WiFi"
-    default y
-    help
-       Select this option to enable WiFi stack and show the submenu with WiFi configuration choices.
+menu Wi-Fi
 
 config SW_COEXIST_ENABLE
     bool "Software controls WiFi/Bluetooth coexistence"
-    depends on WIFI_ENABLED && BT_ENABLED
+    depends on BT_ENABLED
     default n
     help
         If enabled, WiFi & Bluetooth coexistence is controlled by software rather than hardware.
@@ -578,7 +574,6 @@ config SW_COEXIST_ENABLE
 
 config ESP32_WIFI_STATIC_RX_BUFFER_NUM
     int "Max number of WiFi static RX buffers"
-    depends on WIFI_ENABLED
     range 2 25
     default 10
     help
@@ -590,7 +585,6 @@ config ESP32_WIFI_STATIC_RX_BUFFER_NUM
 
 config ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM
     int "Max number of WiFi dynamic RX buffers"
-    depends on WIFI_ENABLED
     range 0 128
     default 32
     help
@@ -606,7 +600,6 @@ config ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM
 
 choice ESP32_WIFI_TX_BUFFER
     prompt "Type of WiFi TX buffers"
-    depends on WIFI_ENABLED
     default ESP32_WIFI_DYNAMIC_TX_BUFFER
     help
         Select type of WiFi tx buffers and show the submenu with the number of WiFi tx buffers choice. 
@@ -626,13 +619,11 @@ endchoice
 
 config ESP32_WIFI_TX_BUFFER_TYPE
     int
-    depends on WIFI_ENABLED
     default 0 if ESP32_WIFI_STATIC_TX_BUFFER
     default 1 if ESP32_WIFI_DYNAMIC_TX_BUFFER
 
 config ESP32_WIFI_STATIC_TX_BUFFER_NUM
     int "Max number of WiFi static TX buffers"
-    depends on WIFI_ENABLED 
     depends on ESP32_WIFI_STATIC_TX_BUFFER
     range 16 64
     default 32
@@ -646,7 +637,6 @@ config ESP32_WIFI_STATIC_TX_BUFFER_NUM
 
 config ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM
     int "Max number of WiFi dynamic TX buffers"
-    depends on WIFI_ENABLED 
     depends on ESP32_WIFI_DYNAMIC_TX_BUFFER
     range 16 64
     default 32
@@ -659,7 +649,6 @@ config ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM
 
 config ESP32_WIFI_AMPDU_ENABLED
     bool "WiFi AMPDU"
-    depends on WIFI_ENABLED
     default y
     help
         Select this option to enable AMPDU feature
@@ -689,21 +678,14 @@ config ESP32_WIFI_RX_BA_WIN
 
 config ESP32_WIFI_NVS_ENABLED
     bool "WiFi NVS flash"
-    depends on WIFI_ENABLED
     default y
     help
         Select this option to enable WiFi NVS flash
 
-config PHY_ENABLED
-	bool
-	default y if WIFI_ENABLED || BT_ENABLED
-
 menu PHY
-	visible if PHY_ENABLED
 	
 config ESP32_PHY_CALIBRATION_AND_DATA_STORAGE
     bool "Do phy calibration and store calibration data in NVS"
-    depends on PHY_ENABLED
     default y
     help
         If this option is enabled, NVS will be initialized and calibration data will be loaded from there.
@@ -714,7 +696,6 @@ config ESP32_PHY_CALIBRATION_AND_DATA_STORAGE
 
 config ESP32_PHY_INIT_DATA_IN_PARTITION
     bool "Use a partition to store PHY init data"
-    depends on PHY_ENABLED
     default n
     help
         If enabled, PHY init data will be loaded from a partition.
@@ -733,15 +714,13 @@ config ESP32_PHY_MAX_WIFI_TX_POWER
     int "Max WiFi TX power (dBm)"
     range 0 20
     default 20
-    depends on PHY_ENABLED && WIFI_ENABLED
     help
         Set maximum transmit power for WiFi radio. Actual transmit power for high
         data rates may be lower than this setting.
 
 config ESP32_PHY_MAX_TX_POWER
 	int
-	depends on PHY_ENABLED
-	default 20 if !WIFI_ENABLED
-	default ESP32_PHY_MAX_WIFI_TX_POWER if WIFI_ENABLED
+	default ESP32_PHY_MAX_WIFI_TX_POWER
 
 endmenu
+endmenu

+ 1 - 7
components/esp32/component.mk

@@ -7,13 +7,7 @@ CFLAGS += -DBOOTLOADER_BUILD
 #endif
 
 COMPONENT_SRCDIRS := . hwcrypto
-LIBS := core rtc
-ifdef CONFIG_PHY_ENABLED # BT || WIFI
-LIBS += phy coexist
-endif
-ifdef CONFIG_WIFI_ENABLED
-LIBS += net80211 pp wpa smartconfig coexist wps wpa2
-endif
+LIBS := core rtc net80211 pp wpa smartconfig coexist wps wpa2 phy coexist
 
 LINKER_SCRIPTS += esp32.common.ld esp32.rom.ld esp32.peripherals.ld
 

+ 1 - 4
components/esp32/include/esp_wifi.h

@@ -144,7 +144,7 @@ typedef struct {
 extern const wpa_crypto_funcs_t g_wifi_default_wpa_crypto_funcs;
 
 #define WIFI_INIT_CONFIG_MAGIC    0x1F2F3F4F
-#ifdef CONFIG_WIFI_ENABLED
+
 #define WIFI_INIT_CONFIG_DEFAULT() { \
     .event_handler = &esp_event_send, \
     .wpa_crypto_funcs = g_wifi_default_wpa_crypto_funcs, \
@@ -160,9 +160,6 @@ extern const wpa_crypto_funcs_t g_wifi_default_wpa_crypto_funcs;
     .rx_ba_win = CONFIG_ESP32_WIFI_RX_BA_WIN,\
     .magic = WIFI_INIT_CONFIG_MAGIC\
 };
-#else
-#define WIFI_INIT_CONFIG_DEFAULT() {0}; _Static_assert(0, "please enable wifi in menuconfig to use esp_wifi.h");
-#endif
 
 /**
   * @brief  Init WiFi

+ 0 - 2
components/esp32/phy_init.c

@@ -32,7 +32,6 @@
 #include "nvs_flash.h"
 #include "sdkconfig.h"
 
-#ifdef CONFIG_PHY_ENABLED
 #include "phy.h"
 #include "phy_init_data.h"
 #include "esp_coexist.h"
@@ -298,4 +297,3 @@ void esp_phy_load_cal_and_init(void)
     free(cal_data); // PHY maintains a copy of calibration data, so we can free this
 }
 
-#endif // CONFIG_PHY_ENABLED

+ 1 - 2
components/freertos/Kconfig

@@ -96,8 +96,7 @@ config FREERTOS_WATCHPOINT_END_OF_STACK
 
 config FREERTOS_THREAD_LOCAL_STORAGE_POINTERS
     int "Number of thread local storage pointers"
-    range 0 256 if !(WIFI_ENABLED || ETHERNET)
-    range 1 256 if WIFI_ENABLED || ETHERNET
+    range 1 256
     default 1
     help
         FreeRTOS has the ability to store per-thread pointers in the task