Skip to content

Commit 93fc6e2

Browse files
committed
Add Makefile to easy esptool-based flashing
Try `make help` to see available targets and their descriptions.
1 parent 233599e commit 93fc6e2

File tree

2 files changed

+66
-1
lines changed

2 files changed

+66
-1
lines changed

make/targets/ESP8266.make

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ $(ESP_ZIP): $(USER1_BIN) $(USER2_BIN)
9999
$(Q)rm -rf build/$(basename $(ESP_ZIP))
100100
$(Q)mkdir -p build/$(basename $(ESP_ZIP))
101101
$(Q)cp $(USER1_BIN) $(USER2_BIN) scripts/wiflash.sh $(BLANK) \
102-
$(INIT_DATA) $(BOOTLOADER) targets/esp8266/README_flash.txt \
102+
$(INIT_DATA) $(BOOTLOADER) \
103+
targets/esp8266/README_flash.txt \
104+
targets/esp8266/Makefile \
103105
build/$(basename $(ESP_ZIP))
104106
$(Q)tar -C build -zcf $(ESP_ZIP) ./$(basename $(ESP_ZIP))
105107

targets/esp8266/Makefile

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
## How to flash Espruino esp8266
2+
## =============================
3+
##
4+
## *** Flash Tool
5+
##
6+
## Windows, Linux and MacOSX:
7+
##
8+
## esptool.py - serial flash tool
9+
## https://github.com/themadinventor/esptool
10+
##
11+
## Linux and MacOSX:
12+
##
13+
## wififlash.sh - script to update flash espruino via wifi for 4MB esp8266 (e.g. esp-12)
14+
## ./scripts/wiflash <esp8266 hostname or ip>:88 espruino_esp8266_user1.bin espruino_esp8266_user2.bin
15+
##
16+
##
17+
## The following targets are available (use esptool.py):
18+
##
19+
20+
21+
PORT=/dev/wchusbserial*
22+
23+
.PHONY: erase flash-esp-512k flash-esp-1MB flash-esp-2MB flash-esp-4MB flash-esp-4MB-1024
24+
25+
erase: ## Erase flash before updating to a new version
26+
esptool.py --port ${PORT} --baud 115200 erase_flash
27+
28+
flash-esp-512k: ## Flash a 512KB esp8266 (e.g. esp-01) using the serial port use:
29+
esptool.py --port ${PORT} --baud 115200 write_flash \
30+
--flash_freq 40m --flash_mode qio --flash_size 4m \
31+
0x0000 "boot_v1.6.bin" 0x1000 espruino_esp8266_user1.bin \
32+
0x7C000 esp_init_data_default.bin 0x7E000 blank.bin
33+
34+
flash-esp-1MB: ## Flash a 1MB esp8266 using the serial port use:
35+
esptool.py --port ${PORT} --baud 115200 write_flash \
36+
--flash_freq 40m --flash_mode qio --flash_size 4m \
37+
0x0000 "boot_v1.6.bin" 0x1000 espruino_esp8266_user1.bin \
38+
0xFC000 esp_init_data_default.bin 0xFE000 blank.bin
39+
40+
flash-esp-2MB: ## Flash a 2MB esp8266 using the serial port use:
41+
esptool.py --port ${PORT} --baud 115200 write_flash \
42+
--flash_freq 40m --flash_mode qio --flash_size 4m \
43+
0x0000 "boot_v1.6.bin" 0x1000 espruino_esp8266_user1.bin \
44+
0x1FC000 esp_init_data_default.bin 0x1FE000 blank.bin
45+
46+
flash-esp-4MB: ## Flash a 4MB esp8266 (e.g. esp-12) using the serial port use:
47+
esptool.py --port ${PORT} --baud 115200 write_flash \
48+
--flash_freq 80m --flash_mode qio --flash_size 32m \
49+
0x0000 "boot_v1.6.bin" 0x1000 espruino_esp8266_user1.bin \
50+
0x3FC000 esp_init_data_default.bin 0x3FE000 blank.bin
51+
52+
flash-esp-4MB-1024: ## Flash a 4MB eps866 with Flash map 4MB:1024/1024 (BOARD=ESP8266_4MB)
53+
esptool.py --port ${PORT} --baud 460800 write_flash \
54+
--flash_freq 80m --flash_mode qio --flash_size 4MB-c1 \
55+
0x0000 "boot_v1.6.bin" 0x1000 espruino_esp8266_user1.bin \
56+
0x3FC000 esp_init_data_default.bin 0x3FE000 blank.bin
57+
58+
.DEFAULT_GOAL := help
59+
.PHONY: help
60+
help:
61+
@grep -E '^##.*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = "## "}; {printf "%s\n", $$2}'
62+
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
63+
@echo

0 commit comments

Comments
 (0)