Add Arduino rewrite of firmware

This commit is contained in:
2024-10-04 00:03:50 +03:00
parent 52bb9fbf9c
commit 5fdc005613
9 changed files with 641 additions and 561 deletions

View File

@@ -1,23 +1,21 @@
NAME=esp8266-1m-20210618-v1.16.bin
SKETCH_FOLDER := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
UPLOAD_PORT ?= /dev/ttyUSB0
flash:
wget -c http://micropython.org/resources/firmware/${NAME}
esptool.py -p /dev/ttyUSB0 write_flash --flash_size=1MB 0 ${NAME}
all: $(SKETCH_FOLDER)/build/firmware.ino.bin
erase:
esptool.py -p /dev/ttyUSB0 erase_flash
$(SKETCH_FOLDER)/cities.h: cities.py
python3 cities.py > $(SKETCH_FOLDER)/cities.h
upload:
ampy -p /dev/ttyUSB0 put picoweb.py
ampy -p /dev/ttyUSB0 put timezone.py
ampy -p /dev/ttyUSB0 put main.py
$(SKETCH_FOLDER)/build/firmware.ino.bin: $(SKETCH_FOLDER)/firmware.ino $(SKETCH_FOLDER)/cities.h
arduino-cli compile -e -b esp8266:esp8266:generic $(SKETCH_FOLDER)
deps:
arduino-cli core install \
--additional-urls=http://arduino.esp8266.com/stable/package_esp8266com_index.json esp8266:esp8266
arduino-cli lib install wifimanager ESP8266TimerInterrupt ezTime
flash: $(SKETCH_FOLDER)/firmware.ino.bin
arduino-cli upload -b esp8266:esp8266:generic -p $(UPLOAD_PORT) $(SKETCH_FOLDER)
console:
echo "Ctrl-A + Ctrl-Q to close Picocom"
picocom -b115200 /dev/ttyUSB0
clone_read:
esptool.py -p /dev/ttyUSB0 read_flash 0 0x100000 clone.bin
clone_write:
esptool.py -p /dev/ttyUSB0 write_flash --flash_size=1MB 0 clone.bin
picocom -b 9600 $(UPLOAD_PORT)