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.
This commit is contained in:
Kedar Sovani 2017-08-08 10:23:52 +05:30
parent a24130b390
commit ba8cd58b08
5 changed files with 7 additions and 40 deletions

View file

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

View file

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

View file

@ -144,7 +144,7 @@ typedef struct {
extern const wpa_crypto_funcs_t g_wifi_default_wpa_crypto_funcs; extern const wpa_crypto_funcs_t g_wifi_default_wpa_crypto_funcs;
#define WIFI_INIT_CONFIG_MAGIC 0x1F2F3F4F #define WIFI_INIT_CONFIG_MAGIC 0x1F2F3F4F
#ifdef CONFIG_WIFI_ENABLED
#define WIFI_INIT_CONFIG_DEFAULT() { \ #define WIFI_INIT_CONFIG_DEFAULT() { \
.event_handler = &esp_event_send, \ .event_handler = &esp_event_send, \
.wpa_crypto_funcs = g_wifi_default_wpa_crypto_funcs, \ .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,\ .rx_ba_win = CONFIG_ESP32_WIFI_RX_BA_WIN,\
.magic = WIFI_INIT_CONFIG_MAGIC\ .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 * @brief Init WiFi

View file

@ -32,7 +32,6 @@
#include "nvs_flash.h" #include "nvs_flash.h"
#include "sdkconfig.h" #include "sdkconfig.h"
#ifdef CONFIG_PHY_ENABLED
#include "phy.h" #include "phy.h"
#include "phy_init_data.h" #include "phy_init_data.h"
#include "esp_coexist.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 free(cal_data); // PHY maintains a copy of calibration data, so we can free this
} }
#endif // CONFIG_PHY_ENABLED

View file

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