In #12955 optimization was switched to O2 because with the '-Os' option, the ESP32 hangs sporadically in 'tests/bench*' if interrupts where disabled too early by benchmark tests. Since it hasn't been reproduced since and in #13196 O2 was causing un-explained hardfaults, since the aforementioned issue could not be reproduced we switch back to Os by removing O2, as Os will be used by default.
80 lines
3.0 KiB
Makefile
80 lines
3.0 KiB
Makefile
# check some environment variables first
|
|
ifndef ESP32_SDK_DIR
|
|
$(info ESP32_SDK_DIR should be defined as /path/to/esp-idf directory)
|
|
$(info ESP32_SDK_DIR is set by default to /opt/esp/esp-idf)
|
|
export ESP32_SDK_DIR=/opt/esp/esp-idf
|
|
endif
|
|
|
|
ESP_SDK_DIR = $(ESP32_SDK_DIR)
|
|
|
|
# ESP32 specific flashing options
|
|
FLASH_CHIP = esp32
|
|
FLASH_MODE ?= dout
|
|
FLASH_FREQ = 40m # DO NOT CHANGE
|
|
FLASH_SIZE ?= 4
|
|
BOOTLOADER_POS = 0x1000
|
|
|
|
include $(RIOTCPU)/esp_common/Makefile.include
|
|
|
|
# regular Makefile
|
|
|
|
TARGET_ARCH ?= xtensa-esp32-elf
|
|
|
|
PSEUDOMODULES += esp_eth_hw
|
|
PSEUDOMODULES += esp_gdbstub
|
|
PSEUDOMODULES += esp_hw_counter
|
|
PSEUDOMODULES += esp_i2c_hw
|
|
PSEUDOMODULES += esp_idf_newlib
|
|
PSEUDOMODULES += esp_rtc_timer
|
|
PSEUDOMODULES += esp_rtc_timer_32k
|
|
PSEUDOMODULES += esp_spi_ram
|
|
PSEUDOMODULES += esp_wifi_enterprise
|
|
|
|
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/
|
|
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include
|
|
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/esp32
|
|
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/heap
|
|
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/spi_flash
|
|
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/tcpip_adapter
|
|
INCLUDES += -I$(ESP32_SDK_DIR)/components/
|
|
INCLUDES += -I$(ESP32_SDK_DIR)/components/driver/include
|
|
INCLUDES += -I$(ESP32_SDK_DIR)/components/esp32/include
|
|
INCLUDES += -I$(ESP32_SDK_DIR)/components/heap/include
|
|
INCLUDES += -I$(ESP32_SDK_DIR)/components/soc/esp32/include
|
|
INCLUDES += -I$(ESP32_SDK_DIR)/components/soc/include
|
|
INCLUDES += -I$(RIOTCPU)/$(CPU)
|
|
|
|
INCLUDES += $(if $(filter esp_eth,$(USEMODULE)),-I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/ethernet)
|
|
INCLUDES += $(if $(filter esp_eth,$(USEMODULE)),-I$(ESP32_SDK_DIR)/components/ethernet/include)
|
|
|
|
CFLAGS += -DSDK_NOT_USED -DCONFIG_FREERTOS_UNICORE=1 -DESP_PLATFORM
|
|
CFLAGS += -DLOG_TAG_IN_BRACKETS
|
|
|
|
LINKFLAGS += -L$(RIOTCPU)/$(CPU)/ld/
|
|
LINKFLAGS += -T$(RIOTCPU)/$(CPU)/ld/esp32.ld
|
|
LINKFLAGS += -T$(RIOTCPU)/$(CPU)/ld/esp32.common.ld
|
|
LINKFLAGS += -T$(RIOTCPU)/$(CPU)/ld/esp32.peripherals.ld
|
|
LINKFLAGS += -T$(RIOTCPU)/$(CPU)/ld/esp32.rom.ld
|
|
LINKFLAGS += -T$(RIOTCPU)/$(CPU)/ld/esp32.rom.nanofmt.ld
|
|
LINKFLAGS += -nostdlib -lgcc -Wl,-gc-sections
|
|
|
|
# Baselibs needed when using esp_wifi_any pseudomodule
|
|
_ESP_WIFI_ANY_BASELIBS = -lcore -lrtc -lnet80211 -lpp -lcoexist -lwps -lwpa -lwpa2
|
|
_ESP_WIFI_ANY_BASELIBS += -lphy -lstdc++
|
|
|
|
# Baselibs needed when using esp_now module
|
|
_ESP_NOW_BASELIBS = -lespnow -lmesh
|
|
|
|
# NOTE: These checks can be turned into a normal conditional when #9913 is fixed
|
|
BASELIBS += $(if $(filter esp_wifi_any,$(USEMODULE)),$(_ESP_WIFI_ANY_BASELIBS))
|
|
BASELIBS += $(if $(filter esp_now,$(USEMODULE)),$(_ESP_NOW_BASELIBS))
|
|
|
|
UNDEF += $(if $(filter cpp,$(FEATURES_USED)),$(BINDIR)/esp_cxx/cxa_guard.o)
|
|
BASELIBS += $(if $(filter cpp,$(FEATURES_USED)),-lstdc++)
|
|
|
|
# additional flasher configuration for ESP32 QEMU
|
|
ifneq (,$(filter esp_qemu,$(USEMODULE)))
|
|
FFLAGS += cp $(RIOTCPU)/$(CPU)/bin/rom_0x3ff90000_0x00010000.bin $(BINDIR)/rom1.bin &&
|
|
FFLAGS += cp $(RIOTCPU)/$(CPU)/bin/rom_0x40000000_0x000c2000.bin $(BINDIR)/rom.bin
|
|
endif
|