Merge branch 'feature/config_spi_flash_params_menuconfig' into 'master'

Feature/config spi flash params menuconfig

Simple menuconfig option for flash speed and access mode.

See merge request !59
This commit is contained in:
Angus Gratton 2016-09-07 10:16:59 +08:00
commit 1a6e63feef
2 changed files with 52 additions and 2 deletions

View File

@ -46,4 +46,52 @@ config ESPTOOLPY_COMPRESSED
decompress it on the fly before flashing it. For most payloads, this should result in a
speed increase.
choice ESPTOOLPY_FLASHMODE
prompt "Flash SPI mode"
default ESPTOOLPY_FLASHMODE_QIO
help
Mode the flash chip is flashed in, as well as the default mode for the
binary to run in.
config ESPTOOLPY_FLASHMODE_QIO
bool "QIO"
config ESPTOOLPY_FLASHMODE_QOUT
bool "QOUT"
config ESPTOOLPY_FLASHMODE_DIO
bool "DIO"
config ESPTOOLPY_FLASHMODE_DOUT
bool "DOUT"
endchoice
config ESPTOOLPY_FLASHMODE
string
default "qio" if ESPTOOLPY_FLASHMODE_QIO
default "qout" if ESPTOOLPY_FLASHMODE_QOUT
default "dio" if ESPTOOLPY_FLASHMODE_DIO
default "dout" if ESPTOOLPY_FLASHMODE_DOUT
choice ESPTOOLPY_FLASHFREQ
prompt "Flash SPI speed"
default ESPTOOLPY_FLASHFREQ_40M
help
The SPI flash frequency to be used.
config ESPTOOLPY_FLASHFREQ_80M
bool "80 MHz"
config ESPTOOLPY_FLASHFREQ_40M
bool "40 MHz"
config ESPTOOLPY_FLASHFREQ_26M
bool "26 MHz"
config ESPTOOLPY_FLASHFREQ_20M
bool "20 MHz"
endchoice
config ESPTOOLPY_FLASHFREQ
string
default "80m" if ESPTOOLPY_FLASHFREQ_80M
default "40m" if ESPTOOLPY_FLASHFREQ_40M
default "26m" if ESPTOOLPY_FLASHFREQ_26M
default "20m" if ESPTOOLPY_FLASHFREQ_20M
endmenu

View File

@ -2,6 +2,8 @@
# components have their own flash targets that can use these variables.
ESPPORT ?= $(CONFIG_ESPTOOLPY_PORT)
ESPBAUD ?= $(CONFIG_ESPTOOLPY_BAUD)
ESPFLASHMODE ?= $(CONFIG_ESPTOOLPY_FLASHMODE)
ESPFLASHFREQ ?= $(CONFIG_ESPTOOLPY_FLASHFREQ)
PYTHON ?= $(call dequote,$(CONFIG_PYTHON))
@ -12,12 +14,12 @@ PYTHON ?= $(call dequote,$(CONFIG_PYTHON))
ESPTOOLPY := $(PYTHON) $(IDF_PATH)/bin/esptool.py --chip esp32
ESPTOOLPY_SERIAL := $(ESPTOOLPY) --port $(ESPPORT) --baud $(ESPBAUD)
ESPTOOLPY_WRITE_FLASH=$(ESPTOOLPY_SERIAL) write_flash $(if $(CONFIG_ESPTOOLPY_COMPRESSED),-z)
ESPTOOLPY_WRITE_FLASH=$(ESPTOOLPY_SERIAL) write_flash $(if $(CONFIG_ESPTOOLPY_COMPRESSED),-z) --flash_mode $(ESPFLASHMODE) --flash_freq $(ESPFLASHFREQ)
ESPTOOL_ALL_FLASH_ARGS += $(CONFIG_APP_OFFSET) $(APP_BIN)
$(APP_BIN): $(APP_ELF)
$(Q) $(ESPTOOLPY) elf2image -o $@ $<
$(Q) $(ESPTOOLPY) elf2image --flash_mode $(ESPFLASHMODE) --flash_freq $(ESPFLASHFREQ) -o $@ $<
flash: all_binaries
@echo "Flashing project app to $(CONFIG_APP_OFFSET)..."