build: add check and install targets
This commit is contained in:
parent
186a8294e1
commit
9010b9b0f7
3 changed files with 17 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
*.mpy
|
||||||
15
Makefile
15
Makefile
|
|
@ -1,12 +1,27 @@
|
||||||
VENV = poetry run
|
VENV = poetry run
|
||||||
ESP_TOOL = $(VENV) esptool.py
|
ESP_TOOL = $(VENV) esptool.py
|
||||||
|
MPYCROSS = $(VENV) mpy-cross
|
||||||
|
AMPY = $(VENV) ampy
|
||||||
|
|
||||||
# Downloaded from https://micropython.org/download/ESP8266_GENERIC/
|
# Downloaded from https://micropython.org/download/ESP8266_GENERIC/
|
||||||
MICRO_PYTHON_FIRMWARE = ESP8266_GENERIC-20240222-v1.22.2.bin
|
MICRO_PYTHON_FIRMWARE = ESP8266_GENERIC-20240222-v1.22.2.bin
|
||||||
ESP_PORT = /dev/ttyUSB0
|
ESP_PORT = /dev/ttyUSB0
|
||||||
|
|
||||||
|
src/%.mpy: src/%.py
|
||||||
|
$(MPYCROSS) $<
|
||||||
|
|
||||||
|
check: src/*.mpy
|
||||||
|
$(VENV) python3 -m py_compile src/*.py
|
||||||
|
|
||||||
erase_flash:
|
erase_flash:
|
||||||
$(ESP_TOOL) --port $(ESP_PORT) erase_flash
|
$(ESP_TOOL) --port $(ESP_PORT) erase_flash
|
||||||
|
|
||||||
flash_esp: erase_flash
|
flash_esp: erase_flash
|
||||||
$(ESP_TOOL) --port $(ESP_PORT) --baud 460800 write_flash --flash_size=detect 0 $(MICRO_PYTHON_FIRMWARE)
|
$(ESP_TOOL) --port $(ESP_PORT) --baud 460800 write_flash --flash_size=detect 0 $(MICRO_PYTHON_FIRMWARE)
|
||||||
|
|
||||||
|
install: check src/*.mpy
|
||||||
|
@echo $(filter-out check,$?)
|
||||||
|
@for f in $(filter-out check,$?); do \
|
||||||
|
echo Uploading $$f; \
|
||||||
|
$(AMPY) --port $(ESP_PORT) put $$f; \
|
||||||
|
done
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ python = "^3.12"
|
||||||
[tool.poetry.group.dev.dependencies]
|
[tool.poetry.group.dev.dependencies]
|
||||||
adafruit-ampy = "^1.1.0"
|
adafruit-ampy = "^1.1.0"
|
||||||
esptool = "^4.7.0"
|
esptool = "^4.7.0"
|
||||||
|
mpy-cross = "^1.22.2"
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core"]
|
requires = ["poetry-core"]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue