2023-02-28 18:18:26 -03: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 11:38:42 +00:00
|
|
|
.PHONY: build
|
2023-02-28 18:18:26 -03:00
|
|
|
|
|
|
|
all example:
|
|
|
|
true
|
|
|
|
|
2023-12-06 09:10:46 +00:00
|
|
|
build build/firmware.uf2: pico-sdk main.c net.c
|
2023-02-28 18:18:26 -03:00
|
|
|
$(MKBUILD)
|
2024-11-11 10:30:11 -03:00
|
|
|
cd build && cmake -DPICO_BOARD=pico2 -G "Unix Makefiles" .. && make
|
2023-01-02 16:24:27 +00:00
|
|
|
|
|
|
|
pico-sdk:
|
2024-11-11 10:30:11 -03:00
|
|
|
git clone --depth 1 -b 2.0.0 https://github.com/raspberrypi/pico-sdk $@
|
2023-01-02 16:24:27 +00:00
|
|
|
cd $@ && git submodule update --init
|
|
|
|
|
2023-12-06 09:10:46 +00:00
|
|
|
flash: build/firmware.uf2
|
|
|
|
picotool load $< -f
|
|
|
|
|
2023-02-28 18:18:26 -03:00
|
|
|
# Automated remote test. Requires env variable VCON_API_KEY set. See https://vcon.io/automated-firmware-tests/
|
2024-11-11 10:30:11 -03:00
|
|
|
DEVICE_URL ?= https://dash.vcon.io/api/v3/devices/??
|
|
|
|
# stdio has to be changed from USB to UART in CMakeLists.txt
|
2023-02-28 18:18:26 -03:00
|
|
|
update: build/firmware.uf2
|
|
|
|
curl --fail-with-body -su :$(VCON_API_KEY) $(DEVICE_URL)/ota?uf2=1 --data-binary @$<
|
2023-01-21 01:36:25 +00:00
|
|
|
|
2023-02-28 18:18:26 -03: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-26 14:43:36 -03:00
|
|
|
# grep 'MQTT connected' /tmp/output.txt # Check for MQTT connection success
|
2023-01-21 01:36:25 +00:00
|
|
|
|
2023-01-02 16:24:27 +00:00
|
|
|
clean:
|
2023-02-28 18:18:26 -03:00
|
|
|
$(RM) pico-sdk build
|