2020-12-01 10:22:26 +01:00
|
|
|
ifneq (,$(filter esp_log_colored,$(USEMODULE)))
|
|
|
|
BOOTLOADER_COLOR = _colors
|
|
|
|
endif
|
|
|
|
ifneq (,$(filter esp_log_startup,$(USEMODULE)))
|
|
|
|
BOOTLOADER_INFO = _info
|
|
|
|
endif
|
|
|
|
|
|
|
|
BOOTLOADER_BIN = bootloader$(BOOTLOADER_COLOR)$(BOOTLOADER_INFO).bin
|
|
|
|
|
|
|
|
ESPTOOL ?= $(RIOTTOOLS)/esptool/esptool.py
|
|
|
|
|
|
|
|
# flasher configuration
|
|
|
|
ifneq (,$(filter esp_qemu,$(USEMODULE)))
|
2021-02-23 10:53:49 +01:00
|
|
|
FLASHER =
|
|
|
|
FFLAGS =
|
|
|
|
FLASHDEPS += esp-qemu
|
2020-12-01 10:22:26 +01:00
|
|
|
else
|
|
|
|
PROGRAMMER_SPEED ?= 460800
|
|
|
|
FLASHER = $(ESPTOOL)
|
|
|
|
FFLAGS += --chip $(FLASH_CHIP) --port $(PROG_DEV) --baud $(PROGRAMMER_SPEED)
|
|
|
|
FFLAGS += --before default_reset write_flash -z
|
|
|
|
FFLAGS += --flash_mode $(FLASH_MODE) --flash_freq $(FLASH_FREQ)
|
|
|
|
FFLAGS += $(BOOTLOADER_POS) $(RIOTCPU)/$(CPU)/bin/$(BOOTLOADER_BIN)
|
|
|
|
FFLAGS += 0x8000 $(BINDIR)/partitions.bin
|
2021-04-11 02:37:56 +02:00
|
|
|
FFLAGS += 0x10000 $(FLASHFILE)
|
2020-12-01 10:22:26 +01:00
|
|
|
endif
|
|
|
|
|
2021-04-11 02:37:56 +02:00
|
|
|
.PHONY: esp-qemu
|
2021-02-23 10:53:49 +01:00
|
|
|
|
|
|
|
esp-qemu:
|
|
|
|
$(Q)dd if=/dev/zero bs=1M count=$(FLASH_SIZE) | \
|
|
|
|
tr "\\000" "\\377" > tmp.bin && cat tmp.bin | \
|
|
|
|
head -c $$(($(BOOTLOADER_POS))) | \
|
|
|
|
cat - $(RIOTCPU)/$(CPU)/bin/$(BOOTLOADER_BIN) tmp.bin | \
|
|
|
|
head -c $$((0x8000)) | \
|
|
|
|
cat - $(BINDIR)/partitions.bin tmp.bin | \
|
|
|
|
head -c $$((0x10000)) | \
|
2021-04-11 02:37:56 +02:00
|
|
|
cat - $(FLASHFILE) tmp.bin | \
|
2021-02-23 10:53:49 +01:00
|
|
|
head -c $(FLASH_SIZE)MB > $(BINDIR)/$(CPU)flash.bin && rm tmp.bin
|
|
|
|
ifeq (esp32,$(CPU_FAM))
|
|
|
|
$(Q)cp $(RIOTCPU)/$(CPU)/bin/rom_0x3ff90000_0x00010000.bin $(BINDIR)/rom1.bin
|
|
|
|
$(Q)cp $(RIOTCPU)/$(CPU)/bin/rom_0x40000000_0x000c2000.bin $(BINDIR)/rom.bin
|
|
|
|
endif
|
|
|
|
|
2020-12-01 10:22:26 +01:00
|
|
|
# reset tool configuration
|
|
|
|
RESET ?= $(RIOTTOOLS)/esptool/espreset.py
|
|
|
|
RESET_FLAGS ?= --port $(PROG_DEV)
|