diff --git a/cpu/esp8266/Makefile.include b/cpu/esp8266/Makefile.include index 5a60188521..2b194a9ad7 100644 --- a/cpu/esp8266/Makefile.include +++ b/cpu/esp8266/Makefile.include @@ -156,6 +156,9 @@ LINKFLAGS += -T$(RIOTCPU)/$(CPU)/ld/esp8266.rom.ld LINKFLAGS += -T$(RIOTCPU)/$(CPU)/ld/esp8266.riot-os.ld LINKFLAGS += -T$(RIOTCPU)/$(CPU)/ld/esp8266.peripherals.ld +LINKFLAGS += -Wl,-wrap=pp_attach +LINKFLAGS += -Wl,-wrap=pm_attach + ifneq (, $(filter esp_idf_heap, $(USEMODULE))) LINKFLAGS += -Wl,-wrap=_malloc_r LINKFLAGS += -Wl,-wrap=_calloc_r diff --git a/cpu/esp8266/startup.c b/cpu/esp8266/startup.c index 25243da0f6..a1649b595e 100644 --- a/cpu/esp8266/startup.c +++ b/cpu/esp8266/startup.c @@ -124,3 +124,19 @@ void esp_riot_start(void) /* does not return */ kernel_init(); } + +void __wrap_pp_attach(void) +{ +#ifdef MODULE_ESP_WIFI_ANY + extern void __real_pp_attach(void); + __real_pp_attach(); +#endif +} + +void __wrap_pm_attach(void) +{ +#ifdef MODULE_ESP_WIFI_ANY + extern void __real_pm_attach(void); + __real_pm_attach(); +#endif +} diff --git a/cpu/esp8266/vendor/esp-idf/esp8266/source/startup.c b/cpu/esp8266/vendor/esp-idf/esp8266/source/startup.c index 1de8843be8..cda4651146 100644 --- a/cpu/esp8266/vendor/esp-idf/esp8266/source/startup.c +++ b/cpu/esp8266/vendor/esp-idf/esp8266/source/startup.c @@ -77,9 +77,11 @@ static void user_init_entry(void *param) esp_phy_load_cal_and_init(0); +#ifdef MODULE_ESP_WIFI_ANY if (wifi_timer_init() != 0) { assert(0); } +#endif esp_wifi_set_rx_pbuf_mem_type(WIFI_RX_PBUF_DRAM);