1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/cpu/esp32/Makefile.dep
Gunar Schorcht b2b17c5912 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.
2019-08-06 18:17:59 +02:00

121 lines
3.3 KiB
Makefile

# additional modules dependencies
ifneq (,$(filter cpp,$(FEATURES_USED)))
USEMODULE += pthread
BASELIBS += -lstdc++
endif
ifneq (,$(filter esp_eth,$(USEMODULE)))
USEMODULE += esp_idf_eth
USEMODULE += esp_idf_eth_phy
USEMODULE += gnrc
USEMODULE += netdev_eth
USEMODULE += netopt
USEMODULE += riot_freertos
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/ethernet
INCLUDES += -I$(ESP32_SDK_DIR)/components/ethernet/include
endif
ifneq (,$(filter esp_now,$(USEMODULE)))
$(eval GNRC_NETIF_NUMOF=$(shell echo $$(($(GNRC_NETIF_NUMOF)+1))))
USEMODULE += esp_wifi_any
USEMODULE += gnrc
USEMODULE += netopt
endif
ifneq (,$(filter esp_wifi,$(USEMODULE)))
$(eval GNRC_NETIF_NUMOF=$(shell echo $$(($(GNRC_NETIF_NUMOF)+1))))
USEMODULE += esp_wifi_any
USEMODULE += gnrc
USEMODULE += netopt
USEMODULE += netdev_eth
endif
ifneq (,$(filter esp_wifi_any,$(USEMODULE)))
# add additional modules used for any WiFi interface
USEMODULE += esp_idf_heap
USEMODULE += esp_idf_wpa_supplicant_crypto
USEMODULE += esp_idf_wpa_supplicant_port
USEMODULE += esp_idf_nvs_flash
USEMODULE += riot_freertos
# crypto and hashes produce symbol conflicts with esp_idf_wpa_supplicant_crypto
DISABLE_MODULE += crypto
DISABLE_MODULE += hashes
endif
ifneq (,$(filter esp_idf_nvs_flash,$(USEMODULE)))
# add additional modules required by esp_idf_nvs_flash
USEMODULE += mtd
USEMODULE += pthread
endif
ifneq (,$(filter riot_freertos,$(USEMODULE)))
# add additional modules required by riot_freertos
USEMODULE += xtimer
endif
ifneq (,$(filter periph_i2c,$(USEMODULE)))
ifneq (,$(filter esp_i2c_hw,$(USEMODULE)))
USEMODULE += core_thread_flags
USEMODULE += xtimer
USEMODULE += periph_i2c_hw
else
# PLEASE NOTE: because of the very poor and faulty hardware implementation
# we use software implementation by default for the moment (if module
# esp_i2c_hw is not explicitly used)
USEMODULE += esp_i2c_sw
USEMODULE += periph_i2c_sw
endif
endif
ifneq (, $(filter esp_spi_ram, $(DISABLE_MODULE)))
USEMODULE := $(filter-out esp_spi_ram, $(USEMODULE))
endif
# each device has SPI flash memory, but must be explicitly enabled
ifneq (,$(filter esp_spiffs,$(USEMODULE)))
USEMODULE += spiffs
endif
ifneq (,$(filter mtd,$(USEMODULE)))
USEMODULE += esp_idf_spi_flash
endif
ifneq (,$(filter ndn-riot,$(USEPKG)))
USEMODULE += crypto
USEMODULE += cipher_modes
endif
ifneq (,$(filter shell,$(USEMODULE)))
USEMODULE += ps
USEMODULE += xtimer
endif
# if SPI RAM is enabled, ESP-IDF heap and quot flash mode have to be used
ifneq (,$(filter esp_spi_ram,$(USEMODULE)))
USEMODULE += esp_idf_heap
export FLASH_MODE = qout
CFLAGS += -DFLASH_MODE_QOUT=1
else
ifeq ($(FLASH_MODE), qio)
CFLAGS += -DFLASH_MODE_QIO=1
endif
ifeq ($(FLASH_MODE), qout)
CFLAGS += -DFLASH_MODE_QOUT=1
endif
ifeq ($(FLASH_MODE), dio)
CFLAGS += -DFLASH_MODE_DIO=1
endif
ifeq ($(FLASH_MODE), dout)
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