Add Makefile

This commit is contained in:
Cedric Girard 2019-05-07 17:12:48 +02:00
parent 7e8227861b
commit 5adbc0c4e2
Signed by: X-dark
GPG Key ID: E7D0E125DB9519E4
3 changed files with 27 additions and 0 deletions

1
.gitignore vendored
View File

@ -36,6 +36,7 @@
*.i*86
*.x86_64
*.hex
*.bin
# Debug files
*.dSYM/

19
Makefile Normal file
View File

@ -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)

View File

@ -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)