2023-03-01 05:18:26 +08:00
|
|
|
RM = rm -rf
|
|
|
|
MKBUILD = test -d build || mkdir build
|
|
|
|
ifeq ($(OS),Windows_NT)
|
|
|
|
RM = cmd /C del /Q /F /S
|
|
|
|
MKBUILD = if not exist build mkdir build
|
|
|
|
endif
|
2024-02-14 19:38:42 +08:00
|
|
|
.PHONY: build
|
2023-03-01 05:18:26 +08:00
|
|
|
|
|
|
|
all example:
|
|
|
|
true
|
|
|
|
|
2023-12-06 17:10:46 +08:00
|
|
|
build build/firmware.uf2: pico-sdk main.c net.c
|
2023-03-01 05:18:26 +08:00
|
|
|
$(MKBUILD)
|
|
|
|
cd build && cmake -G "Unix Makefiles" .. && make
|
2023-01-03 00:24:27 +08:00
|
|
|
|
|
|
|
pico-sdk:
|
2023-02-16 22:23:52 +08:00
|
|
|
git clone --depth 1 -b 1.5.0 https://github.com/raspberrypi/pico-sdk $@
|
2023-01-03 00:24:27 +08:00
|
|
|
cd $@ && git submodule update --init
|
|
|
|
|
2023-12-06 17:10:46 +08:00
|
|
|
flash: build/firmware.uf2
|
|
|
|
picotool load $< -f
|
|
|
|
|
2023-03-01 05:18:26 +08:00
|
|
|
# Automated remote test. Requires env variable VCON_API_KEY set. See https://vcon.io/automated-firmware-tests/
|
2023-01-21 09:36:25 +08:00
|
|
|
DEVICE_URL ?= https://dash.vcon.io/api/v3/devices/3
|
2023-03-01 05:18:26 +08:00
|
|
|
update: build/firmware.uf2
|
|
|
|
curl --fail-with-body -su :$(VCON_API_KEY) $(DEVICE_URL)/ota?uf2=1 --data-binary @$<
|
2023-01-21 09:36:25 +08:00
|
|
|
|
2023-03-01 05:18:26 +08:00
|
|
|
test: update
|
|
|
|
curl --fail-with-body -su :$(VCON_API_KEY) $(DEVICE_URL)/tx?t=5 | tee /tmp/output.txt
|
|
|
|
grep 'READY, IP:' /tmp/output.txt # Check for network init
|
2023-05-27 01:43:36 +08:00
|
|
|
# grep 'MQTT connected' /tmp/output.txt # Check for MQTT connection success
|
2023-01-21 09:36:25 +08:00
|
|
|
|
2023-01-03 00:24:27 +08:00
|
|
|
clean:
|
2023-03-01 05:18:26 +08:00
|
|
|
$(RM) pico-sdk build
|