-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
96 lines (75 loc) · 2.36 KB
/
Makefile
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# ESP32 Makefile
# Define your project name here
PROJECT_NAME = WifiTester
# Define your build environment (e.g., Arduino or PlatformIO)
BUILD_ENV = platformio
# Serial port for uploading (you may need to adjust this)
UPLOAD_PORT = /dev/ttyUSB0
# Serial baud rate (you may need to adjust this)
UPLOAD_SPEED = 115200
# Define the ESP32 board model (e.g., esp32, esp32dev, etc.)
BOARD = esp32dev
# Location of the Littlefs filesystem directory
Littlefs_DIR = data
# Location of PlatformIO build directory
BUILD_DIR = .pio/build/$(BOARD)
# Define the default target (upload)
.DEFAULT_GOAL := upload
# Targets
all: build
build:
ifeq ($(BUILD_ENV), platformio)
pio run -e $(BOARD)
else
@echo "Unsupported build environment: $(BUILD_ENV)"
endif
flash: build
ifeq ($(BUILD_ENV), platformio)
pio run -t upload --upload-port=$(UPLOAD_PORT) -e $(BOARD)
else
@echo "Unsupported build environment: $(BUILD_ENV)"
endif
clean:
ifeq ($(BUILD_ENV), platformio)
pio run -t clean
else
@echo "Unsupported build environment: $(BUILD_ENV)"
endif
fs:
ifeq ($(BUILD_ENV), platformio)
pio run -t buildfs -e $(BOARD)
else
@echo "Unsupported build environment: $(BUILD_ENV)"
endif
uploadfs: fs
ifeq ($(BUILD_ENV), platformio)
pio run -t uploadfs -e $(BOARD)
else
@echo "Unsupported build environment: $(BUILD_ENV)"
endif
monitor:
ifeq ($(BUILD_ENV), platformio)
pio device monitor --port $(UPLOAD_PORT) --baud $(UPLOAD_SPEED)
else
@echo "Unsupported build environment: $(BUILD_ENV)"
endif
reupload: uploadfs monitor
reload: flash monitor
start: uploadfs flash monitor
shell:
nix-shell
help:
@echo "Usage:"
@echo " make - Build and upload firmware to ESP32"
@echo " make build - Build the project"
@echo " make flash - Upload firmware to ESP32"
@echo " make clean - Clean build files"
@echo " make fs - Build Littlefs filesystem image"
@echo " make uploadfs - Upload Littlefs filesystem image"
@echo " make monitor - Monitor serial output"
@echo " make start - Upload filesystem and firmware, then monitor serial output"
@echo " make reupload - Upload filesystem, then monitor serial output"
@echo " make reload - Upload firmware, then monitor serial output"
@echo " make help - Display this help message"
@echo " make shell - Enter Nix shell"
.PHONY: all build upload clean fs uploadfs monitor help