diff --git a/cpu/esp_common/Makefile.dep b/cpu/esp_common/Makefile.dep index 4ac30362bd..4bb829937f 100644 --- a/cpu/esp_common/Makefile.dep +++ b/cpu/esp_common/Makefile.dep @@ -85,10 +85,3 @@ ifneq (,$(filter esp_wifi_any,$(USEMODULE))) USEMODULE += netopt USEMODULE += xtimer endif - -ifneq (,$(filter esp_idf_heap,$(USEMODULE))) - LINKFLAGS += -Wl,-wrap,_malloc_r - LINKFLAGS += -Wl,-wrap,_calloc_r - LINKFLAGS += -Wl,-wrap,_realloc_r - LINKFLAGS += -Wl,-wrap,_free_r -endif diff --git a/cpu/esp_common/Makefile.include b/cpu/esp_common/Makefile.include index 41757bdab6..7b7987525c 100644 --- a/cpu/esp_common/Makefile.include +++ b/cpu/esp_common/Makefile.include @@ -88,10 +88,14 @@ LINKFLAGS += -L$(ESP_SDK_DIR)/components/$(CPU)/lib endif LINKFLAGS += -nostdlib -Wl,-gc-sections -Wl,-static -ifeq (,$(filter esp_idf_heap,$(USEMODULE))) - # use the wrapper functions for calloc to add correct overflow detection missing - # in the newlib's version. - LINKFLAGS += -Wl,-wrap=_calloc_r +# use the wrapper functions for calloc to add correct overflow detection missing +# in the newlib's version. +LINKFLAGS += -Wl,-wrap,_calloc_r + +ifneq (,$(filter esp_idf_heap,$(USEMODULE))) + LINKFLAGS += -Wl,-wrap,_malloc_r + LINKFLAGS += -Wl,-wrap,_realloc_r + LINKFLAGS += -Wl,-wrap,_free_r endif # LINKFLAGS += -Wl,--verbose