Makefile 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. # Makefile using arduino-cli
  2. ARDUINO_HOME=$(HOME)/.arduino15
  3. ESP32_VER=2.0.3
  4. ESP32_TOOLS=$(ARDUINO_HOME)/packages/esp32/hardware/esp32/$(ESP32_VER)/tools
  5. ESPTOOL=$(ESP32_TOOLS)/esptool.py
  6. ESP32_FQBN=esp32:esp32:$(CHIP)
  7. SERDEV := $(wildcard /dev/serial/by-id/usb-Espressif_*)
  8. ARDUINO_CLI=../bin/arduino-cli
  9. APP_PARTITION_SIZE=2031616
  10. # ensure python tools are in $PATH
  11. export PATH := $(HOME)/.local/bin:$(PATH)
  12. .PHONY: headers
  13. all: headers esp32s3dev esp32c3dev bluemark-db200 bluemark-db110
  14. esp32s3dev: CHIP=esp32s3
  15. esp32s3dev: ArduRemoteID-ESP32S3_DEV.bin
  16. esp32c3dev: CHIP=esp32c3
  17. esp32c3dev: ArduRemoteID-ESP32C3_DEV.bin
  18. bluemark-db200: CHIP=esp32c3
  19. bluemark-db200: ArduRemoteID-BLUEMARK_DB200.bin
  20. bluemark-db110: CHIP=esp32c3
  21. bluemark-db110: ArduRemoteID-BLUEMARK_DB110.bin
  22. setup:
  23. @echo "Installing ESP32 support"
  24. $(ARDUINO_CLI) core update-index --config-file arduino-cli.yaml
  25. $(ARDUINO_CLI) core install esp32:esp32@$(ESP32_VER)
  26. headers:
  27. @../scripts/git-version.sh
  28. @cd .. && scripts/regen_headers.sh
  29. romfs_files.h: web/*.html web/js/*.js web/styles/*css web/images/*.jpg public_keys/*.dat
  30. @../scripts/make_romfs.py romfs_files.h web/*.html web/js/*.js web/styles/*css web/images/*.jpg public_keys/*.dat
  31. ArduRemoteID-%.bin: *.cpp *.ino *.h romfs_files.h
  32. @echo "Building $* on $(CHIP)"
  33. @BUILD_FLAGS="-DBOARD_$*"
  34. @rm -rf build build-$*
  35. @$(ARDUINO_CLI) compile -b esp32:esp32:$(CHIP) --export-binaries --build-property build.extra_flags=-DBOARD_$* --build-property upload.maximum_size=$(APP_PARTITION_SIZE)
  36. @cp build/esp32.esp32.$(CHIP)/RemoteIDModule.ino.bin ArduRemoteID_$*_OTA.bin
  37. @echo "Merging $*"
  38. @python3 $(ESPTOOL) --chip $(CHIP) merge_bin -o ArduRemoteID-$*.bin --flash_size 4MB 0x0 build/esp32.esp32.$(CHIP)/RemoteIDModule.ino.bootloader.bin 0x8000 build/esp32.esp32.$(CHIP)/RemoteIDModule.ino.partitions.bin 0xe000 $(ESP32_TOOLS)/partitions/boot_app0.bin 0x10000 build/esp32.esp32.$(CHIP)/RemoteIDModule.ino.bin
  39. @mv build build-$*
  40. boards:
  41. @echo "Listing boards"
  42. @$(ARDUINO_CLI) board list
  43. checkdev:
  44. @[ "${SERDEV}" ] && echo "Using device $(SERDEV)" || ( echo "Failed to find serial device"; exit 1 )
  45. upload-%: checkdev
  46. @echo "Flashing ArduRemoteID-$*.bin"
  47. $(ESPTOOL) --port $(SERDEV) write_flash 0x0 ArduRemoteID-$*.bin
  48. uploadota-%: checkdev
  49. @echo "Flashing ArduRemoteID-$*_OTA.bin"
  50. $(ESPTOOL) --port $(SERDEV) write_flash 0x10000 ArduRemoteID_$*_OTA.bin
  51. upload: upload-ESP32S3_DEV
  52. clean:
  53. rm -rf ..esp32* *.bin build*