summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven <steven.vasilogianis@gmail.com>2021-09-30 15:16:44 -0400
committerSteven <steven.vasilogianis@gmail.com>2021-09-30 15:16:44 -0400
commit4d2c1e3093706bb59f08304fa3b96b7e650bec99 (patch)
tree693df94ab028ef91eb832f451ee3b33723b0c687
parentef6b9e4c2107c256fbde1107499aea590fbdd60c (diff)
fixed makefile for ota
-rw-r--r--src/main/Makefile26
1 files changed, 9 insertions, 17 deletions
diff --git a/src/main/Makefile b/src/main/Makefile
index f77db85..8b136e6 100644
--- a/src/main/Makefile
+++ b/src/main/Makefile
@@ -92,12 +92,12 @@ ifndef SERIAL_DEV
92 endif 92 endif
93endif 93endif
94 94
95BUILD_DIR := $(subst :,.,build/$(FQBN)) 95BUILD_DIR != arduino-cli compile -b $(FQBN) --show-properties | sed -ne 's/^build.path=//p'
96 96
97SRC := $(wildcard *.ino) 97SRC := main.ino
98HDRS := $(wildcard *.h) 98HDRS := $(wildcard *.h)
99BIN := $(BUILD_DIR)/$(SRC).bin 99BIN := $(BUILD_DIR)/main.ino.bin
100ELF := $(BUILD_DIR)/$(SRC).elf 100ELF := $(BUILD_DIR)/main.ino.elf
101 101
102$(info FQBN is [${FQBN}]) 102$(info FQBN is [${FQBN}])
103$(info IOT_NAME is [${IOT_NAME}]) 103$(info IOT_NAME is [${IOT_NAME}])
@@ -134,20 +134,12 @@ upload:
134 arduino-cli upload -b $(FQBN) -p $(SERIAL_DEV) $(VFLAG); \ 134 arduino-cli upload -b $(FQBN) -p $(SERIAL_DEV) $(VFLAG); \
135 fi 135 fi
136 136
137PLAT_PATH != arduino-cli compile -b "$(FQBN)" --show-properties | grep '^runtime.platform.path' | awk -F= '{print $$2}'
138PY_PATH != arduino-cli compile -b "$(FQBN)" --show-properties | grep '^runtime.tools.python3.path' | awk -F= '{print $$2}'
139IOT_IP != getent ahostsv4 esp8266-mush.local | (read ip _; echo $$ip)
140
137ota: 141ota:
138 @PLAT_PATH=`arduino-cli compile -b $(FQBN) --show-properties | grep '^runtime.platform.path' | awk -F= '{print $$2}'` ; \ 142 "$(PY_PATH)/python3" "$(PLAT_PATH)/tools/espota.py" -i "$(IOT_IP)" -p "$(OTA_PORT)" --auth="$(OTA_PASS)" -f "$(BIN)"
139 PY_PATH=`arduino-cli compile -b $(FQBN) --show-properties | grep '^runtime.tools.python3.path' | awk -F= '{print $$2}'` ; \
140 IOT_IP=`avahi-browse _arduino._tcp --resolve --parsable --terminate|grep -i ';$(IOT_NAME);'|grep ';$(OTA_PORT);'| awk -F\; '{print $$8}'|head -1`; \
141 BINFILE=$(wildcard $(BUILD_DIR)/$(SRC)*bin); \
142 echo "PLAT_PATH is [$$PLAT_PATH]" ; \
143 echo "PY_PATH: is [$$PY_PATH]" ; \
144 echo "IOT_IP: is [$$IOT_IP]" ; \
145 echo "BINFILE: is [$$BINFILE]" ; \
146 if [ "$$IOT_IP" = "" ] ; \
147 then echo "Unable to find device IP. Check that the IOT_NAME environment variable is correctly set. Use 'make find' to search devices"; \
148 else echo "---> Uploading Over The Air"; \
149 $$PY_PATH/python3 $$PLAT_PATH/tools/espota.py -i $$IOT_IP -p $(OTA_PORT) --auth=$(OTA_PASS) -f $$BINFILE ;\
150 fi
151 143
152clean: 144clean:
153 @echo "---> Cleaning the build directory" 145 @echo "---> Cleaning the build directory"