mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
a9dea12eb8
If esp_idf_heap is not used, implement calloc through a custom wrapper function on top of malloc to add overflow detection, which is not present in the newlib forks with xtensa support yet.
108 lines
3.1 KiB
Makefile
108 lines
3.1 KiB
Makefile
# Default compile configurations
|
|
|
|
# FLASH_MODE=[ dout | dio | qout | qio ]
|
|
# use flash mode dout by default to keep GPIO9 and GPIO10 free for use
|
|
FLASH_MODE ?= dout
|
|
|
|
# ESP* pseudomodules
|
|
|
|
PSEUDOMODULES += esp_gdb
|
|
PSEUDOMODULES += esp_i2c_sw
|
|
PSEUDOMODULES += esp_log_colored
|
|
PSEUDOMODULES += esp_log_tagged
|
|
PSEUDOMODULES += esp_log_startup
|
|
PSEUDOMODULES += esp_qemu
|
|
PSEUDOMODULES += esp_spiffs
|
|
PSEUDOMODULES += esp_wifi_any
|
|
PSEUDOMODULES += esp_wifi_ap
|
|
|
|
# Common includes
|
|
|
|
INCLUDES += -I$(RIOTBOARD)/common/$(CPU)/include
|
|
INCLUDES += -I$(RIOTCPU)/esp_common
|
|
INCLUDES += -I$(RIOTCPU)/esp_common/include
|
|
INCLUDES += -I$(RIOTCPU)/esp_common/include/freertos
|
|
INCLUDES += -I$(RIOTCPU)/esp_common/vendor/
|
|
INCLUDES += -I$(RIOTCPU)/esp_common/vendor/esp
|
|
|
|
# Flags
|
|
|
|
CFLAGS += -Wno-unused-parameter -Wformat=0
|
|
CFLAGS += -mlongcalls -mtext-section-literals -fstrict-volatile-bitfields
|
|
CFLAGS += -fdata-sections -ffunction-sections -fzero-initialized-in-bss
|
|
|
|
OPTIONAL_CFLAGS_BLACKLIST += -Wformat-overflow
|
|
OPTIONAL_CFLAGS_BLACKLIST += -Wformat-truncation
|
|
OPTIONAL_CFLAGS_BLACKLIST += -gz
|
|
|
|
ASFLAGS += --longcalls --text-section-literals
|
|
|
|
CFLAGS_DBG ?= -ggdb -g3
|
|
|
|
# override default CFLAGS_OPT in case module esp_gdb is enabled
|
|
ifneq (,$(filter esp_gdb,$(USEMODULE)))
|
|
CFLAGS_OPT ?= -Og
|
|
else
|
|
CFLAGS_OPT ?= -Os
|
|
endif
|
|
|
|
CFLAGS += $(CFLAGS_OPT) $(CFLAGS_DBG)
|
|
|
|
# add -DQEMU for qemu
|
|
ifneq (,$(filter esp_qemu,$(USEMODULE)))
|
|
CFLAGS += -DQEMU
|
|
endif
|
|
|
|
# use 32 priority levels if any WiFi interface or the ETH interface is used
|
|
ifneq (,$(filter esp_wifi_any esp_eth,$(USEMODULE)))
|
|
CFLAGS += -DSCHED_PRIO_LEVELS=32
|
|
endif
|
|
|
|
# The threads for handling the ESP hardware have the priorities from 2 to 4.
|
|
# The priority of lwIP TCPIP thread should be lower than these priorities.
|
|
ifneq (,$(filter lwip,$(USEMODULE)))
|
|
CFLAGS += -DTCPIP_THREAD_PRIO=5
|
|
endif
|
|
|
|
# if SPI RAM is enabled, the qout flash mode has to be used
|
|
_FLASH_MODE_PREV := $(FLASH_MODE)
|
|
ifneq (,$(filter esp_spi_ram,$(USEMODULE)))
|
|
FLASH_MODE = qout
|
|
else
|
|
FLASH_MODE = $(_FLASH_MODE_PREV)
|
|
endif
|
|
|
|
# set CFLAG for the correspondant FLASH_MODE
|
|
CFLAGS += $(if $(findstring qout,$(FLASH_MODE)),-DFLASH_MODE_QOUT=1)
|
|
CFLAGS += $(if $(findstring qio,$(FLASH_MODE)),-DFLASH_MODE_QIO=1)
|
|
CFLAGS += $(if $(findstring dio,$(FLASH_MODE)),-DFLASH_MODE_DIO=1)
|
|
CFLAGS += $(if $(findstring dout,$(FLASH_MODE)),-DFLASH_MODE_DOUT=1)
|
|
|
|
ARCHIVES += -lhal -lg -lc
|
|
|
|
LINKFLAGS += $(CFLAGS_OPT) $(CFLAGS_DBG)
|
|
LINKFLAGS += -L$(ESP_SDK_DIR)/components/$(CPU)
|
|
LINKFLAGS += -L$(ESP_SDK_DIR)/components/$(CPU)/lib
|
|
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
|
|
endif
|
|
|
|
# LINKFLAGS += -Wl,--verbose
|
|
# LINKFLAGS += -Wl,--print-gc-sections
|
|
|
|
# increase the test timeout for file system tests that use the SPI flash drive
|
|
ifneq (,$(filter spiffs littlefs,$(USEMODULE)))
|
|
RIOT_TEST_TIMEOUT = 20
|
|
$(call target-export-variables,test,RIOT_TEST_TIMEOUT)
|
|
endif
|
|
|
|
# All ESP are flashed using esptool
|
|
PROGRAMMER ?= esptool
|
|
|
|
# Add esptool in the list supported programmers
|
|
PROGRAMMERS_SUPPORTED += esptool
|