-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
55 lines (44 loc) · 1.9 KB
/
Copy pathMakefile
File metadata and controls
55 lines (44 loc) · 1.9 KB
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
# huesmith Makefile
# Shortcuts for common operations.
# Default USB port. Linux: /dev/ttyACM0 or /dev/ttyUSB0. macOS: /dev/cu.usbmodem*
# Override with: make flash PORT=/dev/cu.usbmodem101
PORT ?= /dev/ttyACM0
# huesmith is a library; firmware is built from a binary crate that depends on
# it. Point the flashing targets at your own project (scaffold one as shown in
# the README, then drop in a body from huesmith/examples/):
# make flash PROJECT=path/to/your/project
PROJECT ?=
.PHONY: build check flash monitor clean setup test _need_project
## Compile-check the workspace libraries (huesmith-core + huesmith) for the ESP target
check:
cargo build --release 2>&1 | tail -20
## Run huesmith-core host tests on any OS (auto-detects the host triple;
## huesmith-core/.cargo/config.toml alone only covers macOS arm64)
test:
cd huesmith-core && cargo test --target $$(rustc -vV | sed -n 's/^host: //p')
_need_project:
@test -n "$(PROJECT)" || { \
echo "Set PROJECT to your firmware project, e.g.: make flash PROJECT=path/to/your/project"; \
echo "(scaffold one per the README; huesmith/examples/ has a main.rs per light type)"; \
exit 1; \
}
## Build the flashable firmware for $(PROJECT)
build: _need_project
cd $(PROJECT) && cargo build --release 2>&1 | tail -20
## Build and flash $(PROJECT) to the device, then open the serial monitor
flash: _need_project
cd $(PROJECT) && cargo espflash flash --release --monitor --port $(PORT)
## Open serial monitor only (no flash)
monitor:
espflash monitor --port $(PORT)
## Clean build artifacts (workspace libraries)
clean:
cargo clean
## Install required tools (run once on new machine)
## ESP32-C6/H2 are RISC-V: standard nightly + rust-src is enough (no espup).
setup:
@echo "Installing Rust nightly + ESP flashing tools..."
rustup toolchain install nightly
rustup component add rust-src --toolchain nightly
cargo install ldproxy espflash cargo-espflash
@echo "Done."