esp32: compile PHY-related code only when WiFi is enabled

Fixes https://github.com/espressif/esp-idf/issues/230, https://github.com/espressif/esp-idf/issues/237
This commit is contained in:
Ivan Grokhotkov 2017-01-16 02:33:16 +08:00
parent 786573fb2d
commit f20135af54
2 changed files with 10 additions and 5 deletions

View file

@ -71,9 +71,11 @@ static bool app_cpu_started = false;
#endif //!CONFIG_FREERTOS_UNICORE #endif //!CONFIG_FREERTOS_UNICORE
static void do_global_ctors(void); static void do_global_ctors(void);
static void do_phy_init();
static void main_task(void* args); static void main_task(void* args);
extern void app_main(void); extern void app_main(void);
#if CONFIG_ESP32_PHY_AUTO_INIT
static void do_phy_init();
#endif
extern int _bss_start; extern int _bss_start;
extern int _bss_end; extern int _bss_end;
@ -264,6 +266,7 @@ static void main_task(void* args)
vTaskDelete(NULL); vTaskDelete(NULL);
} }
#if CONFIG_ESP32_PHY_AUTO_INIT
static void do_phy_init() static void do_phy_init()
{ {
esp_phy_calibration_mode_t calibration_mode = PHY_RF_CAL_PARTIAL; esp_phy_calibration_mode_t calibration_mode = PHY_RF_CAL_PARTIAL;
@ -297,3 +300,5 @@ static void do_phy_init()
esp_phy_release_init_data(init_data); esp_phy_release_init_data(init_data);
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_ESP32_PHY_AUTO_INIT

View file

@ -23,10 +23,12 @@
#include "esp_err.h" #include "esp_err.h"
#include "esp_phy_init.h" #include "esp_phy_init.h"
#include "esp_system.h" #include "esp_system.h"
#include "phy.h"
#include "esp_log.h" #include "esp_log.h"
#include "nvs.h" #include "nvs.h"
#include "sdkconfig.h" #include "sdkconfig.h"
#ifdef CONFIG_WIFI_ENABLED
#include "phy.h"
#include "phy_init_data.h" #include "phy_init_data.h"
static const char* TAG = "phy_init"; static const char* TAG = "phy_init";
@ -219,6 +221,4 @@ static esp_err_t store_cal_data_to_nvs_handle(nvs_handle handle,
return err; return err;
} }
void register_chipv7_phy_stub() #endif // CONFIG_WIFI_ENABLED
{
}