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
|
|
|
|
2020-09-08 22:28:41 +02:00
|
|
|
TARGET_ARCH_ESP32 ?= xtensa-esp32-elf
|
|
|
|
TARGET_ARCH ?= $(TARGET_ARCH_ESP32)
|
2019-11-28 18:03:43 +01:00
|
|
|
|
2018-10-08 12:20:49 +02:00
|
|
|
PSEUDOMODULES += esp_gdbstub
|
|
|
|
PSEUDOMODULES += esp_hw_counter
|
|
|
|
PSEUDOMODULES += esp_i2c_hw
|
2020-07-12 13:26:07 +02:00
|
|
|
PSEUDOMODULES += esp_jtag
|
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$(RIOTCPU)/$(CPU)
|
|
|
|
|
2020-06-25 10:17:10 +02:00
|
|
|
ifneq (,$(filter esp_eth,$(USEMODULE)))
|
|
|
|
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/ethernet
|
|
|
|
endif
|
2020-03-26 01:41:36 +01:00
|
|
|
|
2019-12-12 13:46:20 +01:00
|
|
|
CFLAGS += -DSDK_NOT_USED -DCONFIG_FREERTOS_UNICORE=1 -DESP_PLATFORM
|
|
|
|
CFLAGS += -DLOG_TAG_IN_BRACKETS
|
2022-01-21 14:04:38 +01:00
|
|
|
CFLAGS += -D_CONST=const
|
2019-11-21 06:55:33 +01:00
|
|
|
|
2022-01-21 19:01:53 +01:00
|
|
|
ifneq (,$(filter pthread,$(USEMODULE)))
|
|
|
|
# The toolchain provides POSIX type definitions for pthread which
|
|
|
|
# conflicts with that in RIOT. With the following CFLAGS/CXXFLAGS skip
|
|
|
|
# the inclusion of the types shipped by the toolchain.
|
|
|
|
CFLAGS += -D_SYS__PTHREADTYPES_H_
|
|
|
|
CXXFLAGS += -D_SYS__PTHREADTYPES_H_
|
|
|
|
endif
|
|
|
|
|
2018-10-08 12:20:49 +02:00
|
|
|
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-08-10 14:45:39 +02:00
|
|
|
# Libraries needed when using esp_wifi_any pseudomodule
|
2020-06-25 10:17:10 +02:00
|
|
|
ifneq (,$(filter esp_wifi_any,$(USEMODULE)))
|
2020-08-10 14:45:39 +02:00
|
|
|
ARCHIVES += -lcore -lrtc -lnet80211 -lpp -lcoexist -lwps -lwpa -lwpa2
|
|
|
|
ARCHIVES += -lphy -lstdc++
|
2020-06-25 10:17:10 +02:00
|
|
|
endif
|
2020-03-09 20:01:03 +01:00
|
|
|
|
2020-08-10 14:45:39 +02:00
|
|
|
# Libraries needed when using esp_now module
|
2020-06-25 10:17:10 +02:00
|
|
|
ifneq (,$(filter esp_now,$(USEMODULE)))
|
2020-08-10 14:45:39 +02:00
|
|
|
ARCHIVES += -lespnow -lmesh
|
2020-06-25 10:17:10 +02:00
|
|
|
endif
|
2020-03-09 20:01:03 +01:00
|
|
|
|
2021-12-07 11:27:51 +01:00
|
|
|
ifneq (,$(filter cpp,$(USEMODULE)))
|
2020-08-10 14:45:39 +02:00
|
|
|
ARCHIVES += -lstdc++
|
2020-06-25 10:17:10 +02:00
|
|
|
endif
|
2021-09-28 00:00:22 +02:00
|
|
|
|
|
|
|
ifneq (,$(filter esp_jtag,$(USEMODULE)))
|
|
|
|
PROGRAMMERS_SUPPORTED += openocd
|
|
|
|
PARTITION_POS = 0x8000
|
|
|
|
OPENOCD_PRE_FLASH_CMDS = -c 'echo "Installing Bootloader at $(BOOTLOADER_POS)"' \
|
|
|
|
-c 'flash write_image erase "$(RIOTCPU)/$(CPU)/bin/bootloader.bin" $(BOOTLOADER_POS) bin' \
|
|
|
|
-c 'echo "Installing partition table at $(PARTITION_POS)"' \
|
|
|
|
-c 'flash write_image erase "$(BINDIR)/partitions.bin" $(PARTITION_POS) bin'
|
2021-09-28 01:13:45 +02:00
|
|
|
IMAGE_OFFSET = 0x10000
|
2021-09-28 01:26:07 +02:00
|
|
|
# Flash checksumming not supported on xtensa
|
|
|
|
OPENOCD_SKIP_VERIFY = yes
|
2021-09-28 22:32:18 +02:00
|
|
|
# Without resets debug target fails with 'Target not examined yet'
|
|
|
|
OPENOCD_DBG_EXTRA_CMD += -c 'reset halt'
|
2021-09-28 00:00:22 +02:00
|
|
|
endif
|