diff --git a/cpu/esp32/Makefile.dep b/cpu/esp32/Makefile.dep index 2acb293843..4f9704264c 100644 --- a/cpu/esp32/Makefile.dep +++ b/cpu/esp32/Makefile.dep @@ -111,3 +111,10 @@ else CFLAGS += -DFLASH_MODE_DOUT=1 endif 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/esp32/Makefile.include b/cpu/esp32/Makefile.include index d2bc3ade7a..850a724022 100644 --- a/cpu/esp32/Makefile.include +++ b/cpu/esp32/Makefile.include @@ -147,13 +147,6 @@ ifneq (,$(filter stdio_uart,$(USEMODULE))) LINKFLAGS += -Wl,-wrap,getchar 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 - # The ELFFILE is the base one used for flashing FLASHFILE ?= $(ELFFILE)