Makefile 2.5 KB

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