forked from SmingHub/Sming
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Rename Host `flasher` -> `vflash` * dos2unix on esptool/component.mk * Fix `make flashfs` to ensure output directory exists * Move `flashfs` target back into app.mk * Rename `WriteFlashChunks` to `WriteFlash` and fix usage
- Loading branch information
Showing
7 changed files
with
106 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,64 @@ | ||
# We don't build a component | ||
COMPONENT_TARGETS := | ||
|
||
## Flash parameters | ||
|
||
CONFIG_VARS += SPI_SPEED SPI_MODE SPI_SIZE | ||
|
||
# SPI_SPEED = 40, 26, 20, 80 | ||
SPI_SPEED ?= 40 | ||
# SPI_MODE: qio, qout, dio, dout | ||
SPI_MODE ?= qio | ||
# SPI_SIZE: 512K, 256K, 1M, 2M, 4M | ||
SPI_SIZE ?= 512K | ||
|
||
ifeq ($(SPI_SPEED), 26) | ||
flashimageoptions := -ff 26m | ||
else ifeq ($(SPI_SPEED), 20) | ||
flashimageoptions := -ff 20m | ||
else ifeq ($(SPI_SPEED), 80) | ||
flashimageoptions := -ff 80m | ||
else | ||
flashimageoptions := -ff 40m | ||
endif | ||
|
||
ifeq ($(SPI_MODE), qout) | ||
flashimageoptions += -fm qout | ||
else ifeq ($(SPI_MODE), dio) | ||
flashimageoptions += -fm dio | ||
else ifeq ($(SPI_MODE), dout) | ||
flashimageoptions += -fm dout | ||
else | ||
flashimageoptions += -fm qio | ||
endif | ||
|
||
ifeq ($(SPI_SIZE), 256K) | ||
flashimageoptions += -fs 2m | ||
else ifeq ($(SPI_SIZE), 1M) | ||
flashimageoptions += -fs 8m | ||
INIT_BIN_ADDR := 0x0fc000 | ||
BLANK_BIN_ADDR := 0x0fe000 | ||
else ifeq ($(SPI_SIZE), 2M) | ||
flashimageoptions += -fs 16m | ||
INIT_BIN_ADDR := 0x1fc000 | ||
BLANK_BIN_ADDR := 0x1fe000 | ||
else ifeq ($(SPI_SIZE), 4M) | ||
flashimageoptions += -fs 32m | ||
INIT_BIN_ADDR := 0x3fc000 | ||
BLANK_BIN_ADDR := 0x3fe000 | ||
else | ||
flashimageoptions += -fs 4m | ||
INIT_BIN_ADDR := 0x07c000 | ||
BLANK_BIN_ADDR := 0x04b000 | ||
endif | ||
|
||
ESPTOOL := $(ESPTOOL) -p $(COM_PORT) -b $(COM_SPEED_ESPTOOL) | ||
|
||
# Write data to flash | ||
# $1 -> Start offset | ||
# $2 -> File containing data to write | ||
define WriteFlashChunk | ||
$(info WriteFlash $1 -> $2) | ||
$(ESPTOOL) write_flash $(flashimageoptions) $1 $2 | ||
endef | ||
|
||
|
||
# Write one or more chunks to flash | ||
# $1 -> List of `Offset=File` chunks | ||
define WriteFlashChunks | ||
$(info WriteFlash $1) | ||
$(ESPTOOL) write_flash $(flashimageoptions) $(subst =, ,$1) | ||
endef | ||
|
||
ERASE_FLASH := $(ESPTOOL) erase_flash | ||
# We don't build a component | ||
COMPONENT_TARGETS := | ||
|
||
## Flash parameters | ||
|
||
CONFIG_VARS += SPI_SPEED SPI_MODE SPI_SIZE | ||
|
||
# SPI_SPEED = 40, 26, 20, 80 | ||
SPI_SPEED ?= 40 | ||
# SPI_MODE: qio, qout, dio, dout | ||
SPI_MODE ?= qio | ||
# SPI_SIZE: 512K, 256K, 1M, 2M, 4M | ||
SPI_SIZE ?= 512K | ||
|
||
ifeq ($(SPI_SPEED), 26) | ||
flashimageoptions := -ff 26m | ||
else ifeq ($(SPI_SPEED), 20) | ||
flashimageoptions := -ff 20m | ||
else ifeq ($(SPI_SPEED), 80) | ||
flashimageoptions := -ff 80m | ||
else | ||
flashimageoptions := -ff 40m | ||
endif | ||
|
||
ifeq ($(SPI_MODE), qout) | ||
flashimageoptions += -fm qout | ||
else ifeq ($(SPI_MODE), dio) | ||
flashimageoptions += -fm dio | ||
else ifeq ($(SPI_MODE), dout) | ||
flashimageoptions += -fm dout | ||
else | ||
flashimageoptions += -fm qio | ||
endif | ||
|
||
ifeq ($(SPI_SIZE), 256K) | ||
flashimageoptions += -fs 2m | ||
else ifeq ($(SPI_SIZE), 1M) | ||
flashimageoptions += -fs 8m | ||
INIT_BIN_ADDR := 0x0fc000 | ||
BLANK_BIN_ADDR := 0x0fe000 | ||
else ifeq ($(SPI_SIZE), 2M) | ||
flashimageoptions += -fs 16m | ||
INIT_BIN_ADDR := 0x1fc000 | ||
BLANK_BIN_ADDR := 0x1fe000 | ||
else ifeq ($(SPI_SIZE), 4M) | ||
flashimageoptions += -fs 32m | ||
INIT_BIN_ADDR := 0x3fc000 | ||
BLANK_BIN_ADDR := 0x3fe000 | ||
else | ||
flashimageoptions += -fs 4m | ||
INIT_BIN_ADDR := 0x07c000 | ||
BLANK_BIN_ADDR := 0x04b000 | ||
endif | ||
|
||
ESPTOOL := $(ESPTOOL) -p $(COM_PORT) -b $(COM_SPEED_ESPTOOL) | ||
|
||
# Write file contents to Flash | ||
# $1 -> List of `Offset=File` chunks | ||
define WriteFlash | ||
$(info WriteFlash $1) | ||
$(ESPTOOL) write_flash $(flashimageoptions) $(subst =, ,$1) | ||
endef | ||
|
||
ERASE_FLASH := $(ESPTOOL) erase_flash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters