mirror of
https://github.com/espressif/esp-idf.git
synced 2026-05-04 20:05:25 +02:00
bootloader, menuconfig: add flash size setting support
This commit is contained in:
committed by
Angus Gratton
parent
7104284e31
commit
42827ff869
@@ -94,4 +94,31 @@ config ESPTOOLPY_FLASHFREQ
|
||||
default "26m" if ESPTOOLPY_FLASHFREQ_26M
|
||||
default "20m" if ESPTOOLPY_FLASHFREQ_20M
|
||||
|
||||
|
||||
choice ESPTOOLPY_FLASHSIZE
|
||||
prompt "Flash size"
|
||||
default ESPTOOLPY_FLASHSIZE_2MB
|
||||
help
|
||||
SPI flash size, in megabytes
|
||||
|
||||
config ESPTOOLPY_FLASHSIZE_1MB
|
||||
bool "1 MB"
|
||||
config ESPTOOLPY_FLASHSIZE_2MB
|
||||
bool "2 MB"
|
||||
config ESPTOOLPY_FLASHSIZE_4MB
|
||||
bool "4 MB"
|
||||
config ESPTOOLPY_FLASHSIZE_8MB
|
||||
bool "8 MB"
|
||||
config ESPTOOLPY_FLASHSIZE_16MB
|
||||
bool "16 MB"
|
||||
endchoice
|
||||
|
||||
config ESPTOOLPY_FLASHSIZE
|
||||
string
|
||||
default "1MB" if ESPTOOLPY_FLASHSIZE_1MB
|
||||
default "2MB" if ESPTOOLPY_FLASHSIZE_2MB
|
||||
default "4MB" if ESPTOOLPY_FLASHSIZE_4MB
|
||||
default "8MB" if ESPTOOLPY_FLASHSIZE_8MB
|
||||
default "16MB" if ESPTOOLPY_FLASHSIZE_16MB
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -4,6 +4,7 @@ ESPPORT ?= $(CONFIG_ESPTOOLPY_PORT)
|
||||
ESPBAUD ?= $(CONFIG_ESPTOOLPY_BAUD)
|
||||
ESPFLASHMODE ?= $(CONFIG_ESPTOOLPY_FLASHMODE)
|
||||
ESPFLASHFREQ ?= $(CONFIG_ESPTOOLPY_FLASHFREQ)
|
||||
ESPFLASHSIZE ?= $(CONFIG_ESPTOOLPY_FLASHSIZE)
|
||||
|
||||
PYTHON ?= $(call dequote,$(CONFIG_PYTHON))
|
||||
|
||||
@@ -15,13 +16,15 @@ ESPTOOLPY_SRC := $(COMPONENT_PATH)/esptool/esptool.py
|
||||
ESPTOOLPY := $(PYTHON) $(ESPTOOLPY_SRC) --chip esp32
|
||||
ESPTOOLPY_SERIAL := $(ESPTOOLPY) --port $(ESPPORT) --baud $(ESPBAUD)
|
||||
|
||||
ESPTOOL_FLASH_OPTIONS := --flash_mode $(ESPFLASHMODE) --flash_freq $(ESPFLASHFREQ) --flash_size $(ESPFLASHSIZE)
|
||||
|
||||
# the no-stub argument is temporary until esptool.py fully supports compressed uploads
|
||||
ESPTOOLPY_WRITE_FLASH=$(ESPTOOLPY_SERIAL) write_flash $(if $(CONFIG_ESPTOOLPY_COMPRESSED),-z) --flash_mode $(ESPFLASHMODE) --flash_freq $(ESPFLASHFREQ)
|
||||
ESPTOOLPY_WRITE_FLASH=$(ESPTOOLPY_SERIAL) write_flash $(if $(CONFIG_ESPTOOLPY_COMPRESSED),-z) $(ESPTOOL_FLASH_OPTIONS)
|
||||
|
||||
ESPTOOL_ALL_FLASH_ARGS += $(CONFIG_APP_OFFSET) $(APP_BIN)
|
||||
|
||||
$(APP_BIN): $(APP_ELF) $(ESPTOOLPY_SRC)
|
||||
$(Q) $(ESPTOOLPY) elf2image --flash_mode $(ESPFLASHMODE) --flash_freq $(ESPFLASHFREQ) -o $@ $<
|
||||
$(Q) $(ESPTOOLPY) elf2image $(ESPTOOL_FLASH_OPTIONS) -o $@ $<
|
||||
|
||||
flash: all_binaries $(ESPTOOLPY_SRC)
|
||||
@echo "Flashing binaries to serial port $(ESPPORT) (app at offset $(CONFIG_APP_OFFSET))..."
|
||||
|
||||
Reference in New Issue
Block a user