diff --git a/.gitignore b/.gitignore index acf5dd9..ac91477 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,7 @@ *.i*86 *.x86_64 *.hex +*.bin # Debug files *.dSYM/ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6dbeeb0 --- /dev/null +++ b/Makefile @@ -0,0 +1,19 @@ +FQBN := esp32:esp32:esp32 +SOURCE := esp32-env-monitor.ino +TARGET := $(addsuffix .$(subst :,.,$(FQBN)).bin, $(SOURCE)) +ESPTOOL := ~/.arduino15/packages/esp32/tools/esptool_py/2.6.1/esptool.py +PORT := /dev/ttyUSB0 +ADDRESS := 0x10000 + +.PHONY: compile clean upload + +compile: $(TARGET) + +clean: + rm -f $(TARGET) + +upload: $(TARGET) + $(ESPTOOL) --port $(PORT) write_flash $(ADDRESS) $(TARGET) + +$(TARGET): $(SOURCE) + ARDUINO_SKETCHBOOK_DIR=$(CURDIR) arduino-cli compile -b $(FQBN) $(SOURCE) diff --git a/README.md b/README.md index 2c5c7c9..66fad2f 100644 --- a/README.md +++ b/README.md @@ -11,3 +11,10 @@ Air quality and other environment data monitoring for an ESP32 board * Display: Waveshare 1.5 Oled Display (based on a SDD1327 chip) * Temperature, pressure and humidity sensor: BME280 * Air Quality Sensor: SGP30 + +## Compiling and Uploading + +A Makefile is provided to compile and upload to the board. This Makefile uses: + +* [arduino-cli](https://github.com/arduino/arduino-cli) for compilation +* `esptool.py` shipped with the arduino core for uploading (while this [issue](https://github.com/arduino/arduino-cli/issues/163) is not resolved)