From b2b17c591210df291894b926b3765935191a4725 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Tue, 6 Aug 2019 18:17:45 +0200 Subject: [PATCH] cpu/esp32: fix conditional linker options for esp_idf_heap Module esp_idf_heap is enabled in cpu/esp32/Makefile.dep depending on other modules. Since cpu/esp32/Makefile.dep is read after cpu/esp32/Makefile.include, the conditional definition of the linker options for the wrapper functions had to be moved from cpu/esp32/Makefile.include to cpu/esp32/Makefile.dep. --- cpu/esp32/Makefile.dep | 7 +++++++ cpu/esp32/Makefile.include | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) 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)