Makefile 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 jw-tbd
  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. jw-tbd: CHIP=esp32s3
  23. jw-tbd: ArduRemoteID-JW_TBD.bin
  24. setup:
  25. @echo "Installing ESP32 support"
  26. $(ARDUINO_CLI) core update-index --config-file arduino-cli.yaml
  27. $(ARDUINO_CLI) core install esp32:esp32@$(ESP32_VER)
  28. headers:
  29. @../scripts/git-version.sh
  30. @cd .. && scripts/regen_headers.sh
  31. romfs_files.h: web/*.html web/js/*.js web/styles/*css web/images/*.jpg public_keys/*.dat
  32. @../scripts/make_romfs.py romfs_files.h web/*.html web/js/*.js web/styles/*css web/images/*.jpg public_keys/*.dat
  33. ArduRemoteID-%.bin: *.cpp *.ino *.h romfs_files.h
  34. @echo "Building $* on $(CHIP)"
  35. @BUILD_FLAGS="-DBOARD_$*"
  36. @rm -rf build build-$*
  37. @$(ARDUINO_CLI) compile -b esp32:esp32:$(CHIP) --export-binaries --build-property build.extra_flags=-DBOARD_$* --build-property upload.maximum_size=$(APP_PARTITION_SIZE)
  38. @cp build/esp32.esp32.$(CHIP)/RemoteIDModule.ino.bin ArduRemoteID_$*_OTA.bin
  39. @echo "Merging $*"
  40. @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
  41. @mv build build-$*
  42. boards:
  43. @echo "Listing boards"
  44. @$(ARDUINO_CLI) board list
  45. checkdev:
  46. @[ "${SERDEV}" ] && echo "Using device $(SERDEV)" || ( echo "Failed to find serial device"; exit 1 )
  47. upload-%: checkdev
  48. @echo "Flashing ArduRemoteID-$*.bin"
  49. $(ESPTOOL) --port $(SERDEV) write_flash 0x0 ArduRemoteID-$*.bin
  50. uploadota-%: checkdev
  51. @echo "Flashing ArduRemoteID-$*_OTA.bin"
  52. $(ESPTOOL) --port $(SERDEV) write_flash 0x10000 ArduRemoteID_$*_OTA.bin
  53. upload: upload-ESP32S3_DEV
  54. clean:
  55. rm -rf ..esp32* *.bin build*