-
Notifications
You must be signed in to change notification settings - Fork 2
/
esp32.mk
71 lines (54 loc) · 2.33 KB
/
esp32.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# default options (settable by user)
SERIAL_PORT ?= /dev/ttyUSB0
FS_DIR ?= data
SPIFFS_IMAGE ?= spiffs.img
LITTLEFS_IMAGE ?= littlefs.img
# menus
JTAGADAPTER ?= default
PSRAM ?= disabled
PARTITIONSCHEME ?= default
CPUFREQ ?= 240
FLASHMODE ?= qio
FLASHFREQ ?= 80
FLASHSIZE ?= 4M
UPLOADSPEED ?= 921600
LOOPCORE ?= 1
EVENTSCORE ?= 1
DEBUGLEVEL ?= none
ERASEFLASH ?= none
VENDOR := esp32
PROCESSOR_FAMILY := esp32
build.tarch := xtensa
build.target := esp32
-include hardware.mk
# this is required for recipel.hooks.prebuild.4.pattern (but shouldn't be)
tools.esptool_py.cmd := $(call os-override,tools.esptool_py.cmd)
SUFFIX_EEP := partitions.bin
-include build-targets.mk
serial.port = $(SERIAL_PORT)
ota: network_cmd = $(tools.$(upload.tool).network_cmd)
ota: serial.port = $(OTA_HOST)
ota: network.port = $(OTA_PORT)
ota: network.password = $(OTA_PASSWORD)
ota: prebuild $(SKETCH_BIN)
$(tools.$(upload.tool).upload.network_pattern)
BUILD_EXTRAS := $(SPIFFS_IMAGE) $(LITTLEFS_IMAGE)
PARTITIONS := $(build.path)/partitions.csv
SPIFFS_PART := $(shell sed -ne "/^spiffs/p" $(PARTITIONS))
FS_START := $(shell echo $(SPIFFS_PART) | cut -f4 -d, -)
FS_SIZE := $(shell echo $(SPIFFS_PART) | cut -f5 -d, -)
FS_PAGESIZE := 256
FS_BLOCKSIZE := 4096
$(SPIFFS_IMAGE): $(wildcard $(FS_DIR)/*)
$(runtime.tools.mkspiffs.path)/$(runtime.tools.mkspiffs.cmd) -c $(FS_DIR) -b $(FS_BLOCKSIZE) -p $(FS_PAGESIZE) -s $(FS_SIZE) $@
spiffs: $(SPIFFS_IMAGE)
upload-spiffs: cmd = $(tools.$(upload.tool).cmd)
upload-spiffs: $(SPIFFS_IMAGE)
$(runtime.tools.$(upload.tool).path)/$(cmd) --chip esp32 --port $(serial.port) --before default_reset --after hard_reset write_flash -z --flash_mode $(build.flash_mode) --flash_freq $(build.flash_freq) --flash_size detect $(FS_START) $(SPIFFS_IMAGE)
$(LITTLEFS_IMAGE): $(wildcard $(FS_DIR)/*)
$(runtime.tools.mklittlefs.path)/$(runtime.tools.mklittlefs.cmd) -c $(FS_DIR) -b $(FS_BLOCKSIZE) -p $(FS_PAGESIZE) -s $(FS_SIZE) $@
littlefs: $(LITTLEFS_IMAGE)
upload-littlefs: cmd = $(tools.$(upload.tool).cmd)
upload-littlefs: $(LITTLEFS_IMAGE)
$(runtime.tools.$(upload.tool).path)/$(cmd) --chip esp32 --port $(serial.port) --before default_reset --after hard_reset write_flash -z --flash_mode $(build.flash_mode) --flash_freq $(build.flash_freq) --flash_size detect $(FS_START) $(LITTLEFS_IMAGE)
.PHONY: upload spiffs upload-spiffs littlefs upload-littlefs ota