mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
esp_wifi: move unused wifi log to noload section to save binary size
This commit is contained in:
parent
702418e062
commit
4702feeeeb
@ -311,7 +311,13 @@ SECTIONS
|
||||
. = ALIGN(4);
|
||||
} >default_rodata_seg
|
||||
|
||||
_flash_rodata_align = ALIGNOF(.flash.rodata);
|
||||
.flash.rodata_noload (NOLOAD) :
|
||||
{
|
||||
. = ALIGN (4);
|
||||
mapping[rodata_noload]
|
||||
} > default_rodata_seg
|
||||
|
||||
_flash_rodata_align = ALIGNOF(.flash.rodata_noload);
|
||||
|
||||
.flash.text :
|
||||
{
|
||||
|
@ -345,6 +345,12 @@ SECTIONS
|
||||
. = ALIGN(4);
|
||||
} > default_rodata_seg
|
||||
|
||||
.flash.rodata_noload (NOLOAD) :
|
||||
{
|
||||
. = ALIGN (4);
|
||||
mapping[rodata_noload]
|
||||
} > default_rodata_seg
|
||||
|
||||
/* Marks the end of IRAM code segment */
|
||||
.iram0.text_end (NOLOAD) :
|
||||
{
|
||||
|
@ -325,7 +325,13 @@ SECTIONS
|
||||
. = ALIGN(4);
|
||||
} >default_rodata_seg
|
||||
|
||||
_flash_rodata_align = ALIGNOF(.flash.rodata);
|
||||
.flash.rodata_noload (NOLOAD) :
|
||||
{
|
||||
. = ALIGN (4);
|
||||
mapping[rodata_noload]
|
||||
} > default_rodata_seg
|
||||
|
||||
_flash_rodata_align = ALIGNOF(.flash.rodata_noload);
|
||||
|
||||
.flash.text :
|
||||
{
|
||||
|
@ -363,7 +363,13 @@ SECTIONS
|
||||
. = ALIGN(4);
|
||||
} > default_rodata_seg
|
||||
|
||||
_flash_rodata_align = ALIGNOF(.flash.rodata);
|
||||
.flash.rodata_noload (NOLOAD) :
|
||||
{
|
||||
. = ALIGN (4);
|
||||
mapping[rodata_noload]
|
||||
} > default_rodata_seg
|
||||
|
||||
_flash_rodata_align = ALIGNOF(.flash.rodata_noload);
|
||||
|
||||
/* Marks the end of IRAM code segment */
|
||||
.iram0.text_end (NOLOAD) :
|
||||
|
@ -218,83 +218,6 @@ menu "Wi-Fi"
|
||||
help
|
||||
Set the number of WiFi management short buffer.
|
||||
|
||||
config ESP32_WIFI_DEBUG_LOG_ENABLE
|
||||
bool "Enable WiFi debug log"
|
||||
default n
|
||||
help
|
||||
Select this option to enable WiFi debug log
|
||||
|
||||
choice ESP32_WIFI_DEBUG_LOG_LEVEL
|
||||
depends on ESP32_WIFI_DEBUG_LOG_ENABLE
|
||||
prompt "WiFi debug log level"
|
||||
default ESP32_WIFI_DEBUG_LOG_DEBUG
|
||||
help
|
||||
The WiFi log is divided into the following levels: ERROR,WARNING,INFO,DEBUG,VERBOSE.
|
||||
The ERROR,WARNING,INFO levels are enabled by default, and the DEBUG,VERBOSE levels can be enabled here.
|
||||
|
||||
config ESP32_WIFI_DEBUG_LOG_DEBUG
|
||||
bool "WiFi Debug Log Debug"
|
||||
config ESP32_WIFI_DEBUG_LOG_VERBOSE
|
||||
bool "WiFi Debug Log Verbose"
|
||||
endchoice
|
||||
|
||||
choice ESP32_WIFI_DEBUG_LOG_MODULE
|
||||
depends on ESP32_WIFI_DEBUG_LOG_ENABLE
|
||||
prompt "WiFi debug log module"
|
||||
default ESP32_WIFI_DEBUG_LOG_MODULE_WIFI
|
||||
help
|
||||
The WiFi log module contains three parts: WIFI,COEX,MESH. The WIFI module indicates the logs related to
|
||||
WiFi, the COEX module indicates the logs related to WiFi and BT(or BLE) coexist, the MESH module indicates
|
||||
the logs related to Mesh. When ESP32_WIFI_LOG_MODULE_ALL is enabled, all modules are selected.
|
||||
|
||||
config ESP32_WIFI_DEBUG_LOG_MODULE_ALL
|
||||
bool "WiFi Debug Log Module All"
|
||||
config ESP32_WIFI_DEBUG_LOG_MODULE_WIFI
|
||||
bool "WiFi Debug Log Module WiFi"
|
||||
config ESP32_WIFI_DEBUG_LOG_MODULE_COEX
|
||||
bool "WiFi Debug Log Module Coex"
|
||||
config ESP32_WIFI_DEBUG_LOG_MODULE_MESH
|
||||
bool "WiFi Debug Log Module Mesh"
|
||||
endchoice
|
||||
|
||||
config ESP32_WIFI_DEBUG_LOG_SUBMODULE
|
||||
depends on ESP32_WIFI_DEBUG_LOG_ENABLE
|
||||
bool "WiFi debug log submodule"
|
||||
default n
|
||||
help
|
||||
Enable this option to set the WiFi debug log submodule.
|
||||
Currently the log submodule contains the following parts: INIT,IOCTL,CONN,SCAN.
|
||||
The INIT submodule indicates the initialization process.The IOCTL submodule indicates the API calling
|
||||
process.
|
||||
The CONN submodule indicates the connecting process.The SCAN submodule indicates the scaning process.
|
||||
|
||||
config ESP32_WIFI_DEBUG_LOG_SUBMODULE_ALL
|
||||
depends on ESP32_WIFI_DEBUG_LOG_SUBMODULE
|
||||
bool "WiFi Debug Log Submodule All"
|
||||
default n
|
||||
help
|
||||
When this option is enabled, all debug submodules are selected.
|
||||
|
||||
config ESP32_WIFI_DEBUG_LOG_SUBMODULE_INIT
|
||||
depends on ESP32_WIFI_DEBUG_LOG_SUBMODULE && (!ESP32_WIFI_DEBUG_LOG_SUBMODULE_ALL)
|
||||
bool "WiFi Debug Log Submodule Init"
|
||||
default n
|
||||
|
||||
config ESP32_WIFI_DEBUG_LOG_SUBMODULE_IOCTL
|
||||
depends on ESP32_WIFI_DEBUG_LOG_SUBMODULE && (!ESP32_WIFI_DEBUG_LOG_SUBMODULE_ALL)
|
||||
bool "WiFi Debug Log Submodule Ioctl"
|
||||
default n
|
||||
|
||||
config ESP32_WIFI_DEBUG_LOG_SUBMODULE_CONN
|
||||
depends on ESP32_WIFI_DEBUG_LOG_SUBMODULE && (!ESP32_WIFI_DEBUG_LOG_SUBMODULE_ALL)
|
||||
bool "WiFi Debug Log Submodule Conn"
|
||||
default n
|
||||
|
||||
config ESP32_WIFI_DEBUG_LOG_SUBMODULE_SCAN
|
||||
depends on ESP32_WIFI_DEBUG_LOG_SUBMODULE && (!ESP32_WIFI_DEBUG_LOG_SUBMODULE_ALL)
|
||||
bool "WiFi Debug Log Submodule Scan"
|
||||
default n
|
||||
|
||||
config ESP32_WIFI_IRAM_OPT
|
||||
bool "WiFi IRAM speed optimization"
|
||||
default n if (BT_ENABLED && ESP32_SPIRAM_SUPPORT)
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit f522a17117a0d64fce697d2b26c6e4a8c1781b1b
|
||||
Subproject commit 1b54038e45596e23bed19ccb41d519065f0174ed
|
@ -43,6 +43,26 @@ entries:
|
||||
entries:
|
||||
wifi_slp_rx_iram -> iram0_text
|
||||
|
||||
[sections:wifi_log_error]
|
||||
entries:
|
||||
.rodata_wlog_error+
|
||||
|
||||
[sections:wifi_log_warning]
|
||||
entries:
|
||||
.rodata_wlog_warning+
|
||||
|
||||
[sections:wifi_log_info]
|
||||
entries:
|
||||
.rodata_wlog_info+
|
||||
|
||||
[sections:wifi_log_debug]
|
||||
entries:
|
||||
.rodata_wlog_debug+
|
||||
|
||||
[sections:wifi_log_verbose]
|
||||
entries:
|
||||
.rodata_wlog_verbose+
|
||||
|
||||
[scheme:wifi_default]
|
||||
entries:
|
||||
wifi_slp_iram -> flash_text
|
||||
@ -50,6 +70,26 @@ entries:
|
||||
wifi_slp_rx_iram -> flash_text
|
||||
wifi_iram -> flash_text
|
||||
wifi_rx_iram -> flash_text
|
||||
if LOG_MAXIMUM_LEVEL <= 0:
|
||||
wifi_log_error -> rodata_noload
|
||||
else:
|
||||
wifi_log_error -> flash_rodata
|
||||
if LOG_MAXIMUM_LEVEL <= 1:
|
||||
wifi_log_warning -> rodata_noload
|
||||
else:
|
||||
wifi_log_warning -> flash_rodata
|
||||
if LOG_MAXIMUM_LEVEL <= 2:
|
||||
wifi_log_info -> rodata_noload
|
||||
else:
|
||||
wifi_log_info -> flash_rodata
|
||||
if LOG_MAXIMUM_LEVEL <= 3:
|
||||
wifi_log_debug -> rodata_noload
|
||||
else:
|
||||
wifi_log_debug -> flash_rodata
|
||||
if LOG_MAXIMUM_LEVEL <= 4:
|
||||
wifi_log_verbose -> rodata_noload
|
||||
else:
|
||||
wifi_log_verbose -> flash_rodata
|
||||
|
||||
[mapping:wifi_default]
|
||||
archive: *
|
||||
|
@ -80,51 +80,24 @@ static void __attribute__((constructor)) s_set_default_wifi_log_level(void)
|
||||
esp_log_level_set("ESPNOW", CONFIG_LOG_DEFAULT_LEVEL);
|
||||
}
|
||||
|
||||
static void esp_wifi_set_debug_log(void)
|
||||
static void esp_wifi_set_log_level(void)
|
||||
{
|
||||
/* set WiFi log level and module */
|
||||
#if CONFIG_ESP32_WIFI_DEBUG_LOG_ENABLE
|
||||
uint32_t g_wifi_log_level = WIFI_LOG_INFO;
|
||||
uint32_t g_wifi_log_module = 0;
|
||||
uint32_t g_wifi_log_submodule = 0;
|
||||
#if CONFIG_ESP32_WIFI_DEBUG_LOG_DEBUG
|
||||
g_wifi_log_level = WIFI_LOG_DEBUG;
|
||||
wifi_log_level_t wifi_log_level = WIFI_LOG_INFO;
|
||||
/* set WiFi log level */
|
||||
#if CONFIG_LOG_MAXIMUM_LEVEL == 0
|
||||
wifi_log_level = WIFI_LOG_NONE;
|
||||
#elif CONFIG_LOG_MAXIMUM_LEVEL == 1
|
||||
wifi_log_level = WIFI_LOG_ERROR;
|
||||
#elif CONFIG_LOG_MAXIMUM_LEVEL == 2
|
||||
wifi_log_level = WIFI_LOG_WARNING;
|
||||
#elif CONFIG_LOG_MAXIMUM_LEVEL == 3
|
||||
wifi_log_level = WIFI_LOG_INFO;
|
||||
#elif CONFIG_LOG_MAXIMUM_LEVEL == 4
|
||||
wifi_log_level = WIFI_LOG_DEBUG;
|
||||
#elif CONFIG_LOG_MAXIMUM_LEVEL == 5
|
||||
wifi_log_level = WIFI_LOG_VERBOSE;
|
||||
#endif
|
||||
#if CONFIG_ESP32_WIFI_DEBUG_LOG_VERBOSE
|
||||
g_wifi_log_level = WIFI_LOG_VERBOSE;
|
||||
#endif
|
||||
#if CONFIG_ESP32_WIFI_DEBUG_LOG_MODULE_ALL
|
||||
g_wifi_log_module = WIFI_LOG_MODULE_ALL;
|
||||
#endif
|
||||
#if CONFIG_ESP32_WIFI_DEBUG_LOG_MODULE_WIFI
|
||||
g_wifi_log_module = WIFI_LOG_MODULE_WIFI;
|
||||
#endif
|
||||
#if CONFIG_ESP32_WIFI_DEBUG_LOG_MODULE_COEX
|
||||
g_wifi_log_module = WIFI_LOG_MODULE_COEX;
|
||||
#endif
|
||||
#if CONFIG_ESP32_WIFI_DEBUG_LOG_MODULE_MESH
|
||||
g_wifi_log_module = WIFI_LOG_MODULE_MESH;
|
||||
#endif
|
||||
#if CONFIG_ESP32_WIFI_DEBUG_LOG_SUBMODULE_ALL
|
||||
g_wifi_log_submodule |= WIFI_LOG_SUBMODULE_ALL;
|
||||
#endif
|
||||
#if CONFIG_ESP32_WIFI_DEBUG_LOG_SUBMODULE_INIT
|
||||
g_wifi_log_submodule |= WIFI_LOG_SUBMODULE_INIT;
|
||||
#endif
|
||||
#if CONFIG_ESP32_WIFI_DEBUG_LOG_SUBMODULE_IOCTL
|
||||
g_wifi_log_submodule |= WIFI_LOG_SUBMODULE_IOCTL;
|
||||
#endif
|
||||
#if CONFIG_ESP32_WIFI_DEBUG_LOG_SUBMODULE_CONN
|
||||
g_wifi_log_submodule |= WIFI_LOG_SUBMODULE_CONN;
|
||||
#endif
|
||||
#if CONFIG_ESP32_WIFI_DEBUG_LOG_SUBMODULE_SCAN
|
||||
g_wifi_log_submodule |= WIFI_LOG_SUBMODULE_SCAN;
|
||||
#endif
|
||||
esp_wifi_internal_set_log_level(g_wifi_log_level);
|
||||
esp_wifi_internal_set_log_mod(g_wifi_log_module, g_wifi_log_submodule, true);
|
||||
|
||||
#endif /* CONFIG_ESP32_WIFI_DEBUG_LOG_ENABLE*/
|
||||
|
||||
esp_wifi_internal_set_log_level(wifi_log_level);
|
||||
}
|
||||
|
||||
esp_err_t esp_wifi_deinit(void)
|
||||
@ -267,13 +240,13 @@ esp_err_t esp_wifi_init(const wifi_init_config_t *config)
|
||||
#if CONFIG_SW_COEXIST_ENABLE
|
||||
coex_init();
|
||||
#endif
|
||||
esp_wifi_set_log_level();
|
||||
esp_err_t result = esp_wifi_init_internal(config);
|
||||
if (result == ESP_OK) {
|
||||
#if CONFIG_MAC_BB_PD
|
||||
esp_mac_bb_pd_mem_init();
|
||||
esp_wifi_internal_set_mac_sleep(true);
|
||||
#endif
|
||||
esp_wifi_set_debug_log();
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
s_wifi_mac_time_update_cb = esp_wifi_internal_update_mac_time;
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user