2018-10-08 12:20:49 +02:00
|
|
|
# check some environment variables first
|
|
|
|
ifndef ESP32_SDK_DIR
|
2019-12-12 13:46:20 +01:00
|
|
|
$(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
|
2018-10-08 12:20:49 +02:00
|
|
|
endif
|
|
|
|
|
2019-12-12 13:46:20 +01:00
|
|
|
ESP_SDK_DIR = $(ESP32_SDK_DIR)
|
2018-10-08 12:20:49 +02:00
|
|
|
|
2019-12-12 13:46:20 +01:00
|
|
|
# With the '-Os' option, the ESP32 hangs sporadically in 'tests/bench*' if
|
|
|
|
# interrupts are disabled too early by benchmark tests.
|
|
|
|
CFLAGS_OPT ?= -O2
|
2018-10-08 12:20:49 +02:00
|
|
|
|
2019-12-12 13:46:20 +01:00
|
|
|
# ESP32 specific flashing options
|
|
|
|
FLASH_CHIP = esp32
|
|
|
|
FLASH_MODE ?= dout
|
|
|
|
FLASH_FREQ = 40m # DO NOT CHANGE
|
|
|
|
FLASH_SIZE ?= 4
|
|
|
|
BOOTLOADER_POS = 0x1000
|
2018-10-08 12:20:49 +02:00
|
|
|
|
2019-12-12 13:46:20 +01:00
|
|
|
include $(RIOTCPU)/esp_common/Makefile.include
|
2019-11-21 10:15:18 +01:00
|
|
|
|
2019-12-12 13:46:20 +01:00
|
|
|
# regular Makefile
|
2019-11-21 10:15:18 +01:00
|
|
|
|
2019-12-12 13:46:20 +01:00
|
|
|
TARGET_ARCH ?= xtensa-esp32-elf
|
2019-11-28 18:03:43 +01:00
|
|
|
|
2018-10-08 12:20:49 +02:00
|
|
|
PSEUDOMODULES += esp_eth_hw
|
|
|
|
PSEUDOMODULES += esp_gdbstub
|
|
|
|
PSEUDOMODULES += esp_hw_counter
|
|
|
|
PSEUDOMODULES += esp_i2c_hw
|
|
|
|
PSEUDOMODULES += esp_idf_newlib
|
2019-08-08 17:12:53 +02:00
|
|
|
PSEUDOMODULES += esp_rtc_timer
|
2020-01-09 17:00:23 +01:00
|
|
|
PSEUDOMODULES += esp_rtc_timer_32k
|
2018-10-08 12:20:49 +02:00
|
|
|
PSEUDOMODULES += esp_spi_ram
|
2019-08-16 15:47:12 +02:00
|
|
|
PSEUDOMODULES += esp_wifi_enterprise
|
2018-10-08 12:20:49 +02:00
|
|
|
|
|
|
|
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)
|
|
|
|
|
2019-12-12 13:46:20 +01:00
|
|
|
CFLAGS += -DSDK_NOT_USED -DCONFIG_FREERTOS_UNICORE=1 -DESP_PLATFORM
|
|
|
|
CFLAGS += -DLOG_TAG_IN_BRACKETS
|
2019-11-21 06:55:33 +01:00
|
|
|
|
2019-12-12 13:46:20 +01:00
|
|
|
ifneq (,$(filter esp_now esp_wifi,$(USEMODULE)))
|
|
|
|
BASELIBS += -lcore -lrtc -lnet80211 -lpp -lcoexist
|
|
|
|
BASELIBS += -lwps -lwpa -lwpa2 -lphy -lstdc++
|
2019-12-15 23:50:35 +01:00
|
|
|
endif
|
|
|
|
|
2019-12-12 13:46:20 +01:00
|
|
|
ifneq (,$(filter esp_now,$(USEMODULE)))
|
|
|
|
BASELIBS += -lespnow -lmesh
|
2018-10-08 12:20:49 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
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
|
2019-08-06 07:58:10 +02:00
|
|
|
LINKFLAGS += -nostdlib -lgcc -Wl,-gc-sections
|
2019-08-06 07:39:33 +02:00
|
|
|
|
2020-03-09 19:44:40 +01:00
|
|
|
# NOTE: This check can be turned into a normal conditional after #9913 is fixed
|
|
|
|
UNDEF += $(if $(filter cpp,$(FEATURES_USED)),$(BINDIR)/esp_cxx/cxa_guard.o)
|
|
|
|
BASELIBS += $(if $(filter cpp,$(FEATURES_USED)),-lstdc++)
|
2019-08-21 22:55:08 +02:00
|
|
|
|
2019-12-12 13:46:20 +01:00
|
|
|
# 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
|
2018-10-08 12:20:49 +02:00
|
|
|
endif
|