Makefile 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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 mro-rid jwrid-esp32s3 bluemark-db202 bluemark-db210 bluemark-db203 holybro-RemoteID
  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. jwrid-esp32s3: CHIP=esp32s3
  25. jwrid-esp32s3: ArduRemoteID-JWRID_ESP32S3.bin
  26. mro-rid: CHIP=esp32c3
  27. mro-rid: ArduRemoteID-MRO_RID.bin
  28. bluemark-db202: CHIP=esp32c3
  29. bluemark-db202: ArduRemoteID-BLUEMARK_DB202.bin
  30. bluemark-db210: CHIP=esp32s3
  31. bluemark-db210: ArduRemoteID-BLUEMARK_DB210.bin
  32. bluemark-db203: CHIP=esp32c3
  33. bluemark-db203: ArduRemoteID-BLUEMARK_DB203.bin
  34. holybro-RemoteID: CHIP=esp32c3
  35. holybro-RemoteID: ArduRemoteID-Holybro_RemoteID.bin
  36. setup:
  37. @echo "Installing ESP32 support"
  38. $(ARDUINO_CLI) core update-index --config-file arduino-cli.yaml
  39. $(ARDUINO_CLI) core install esp32:esp32@$(ESP32_VER)
  40. $(ARDUINO_CLI) lib install "Adafruit NeoPixel"
  41. gitversion:
  42. @../scripts/git-version.sh
  43. headers: gitversion
  44. @cd .. && scripts/regen_headers.sh
  45. romfs_files.h: web/*.html web/js/*.js web/styles/*css web/images/*.jpg web/images/*.png public_keys/*.dat
  46. @../scripts/make_romfs.py romfs_files.h web/*.html web/js/*.js web/styles/*css web/images/*.jpg web/images/*.png public_keys/*.dat
  47. ArduRemoteID-%.bin: gitversion *.cpp *.ino *.h romfs_files.h
  48. @echo "Building $* on $(CHIP)"
  49. @BUILD_FLAGS="-DBOARD_$*"
  50. @rm -rf build build-$*
  51. @$(ARDUINO_CLI) compile -b esp32:esp32:$(CHIP) --export-binaries --build-property build.extra_flags="-DBOARD_$* -DESP32" --build-property upload.maximum_size=$(APP_PARTITION_SIZE)
  52. @cp build/esp32.esp32.$(CHIP)/RemoteIDModule.ino.bin ArduRemoteID_$*_OTA.bin
  53. @echo "Merging $*"
  54. @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
  55. @mv build build-$*
  56. boards:
  57. @echo "Listing boards"
  58. @$(ARDUINO_CLI) board list
  59. checkdev:
  60. @[ "${SERDEV}" ] && echo "Using device $(SERDEV)" || ( echo "Failed to find serial device"; exit 1 )
  61. upload-%: checkdev
  62. @echo "Flashing ArduRemoteID-$*.bin"
  63. @python3 $(ESPTOOL) --port $(SERDEV) write_flash 0x0 ArduRemoteID-$*.bin
  64. uploadota-%: checkdev
  65. @echo "Flashing ArduRemoteID-$*_OTA.bin"
  66. @python3 $(ESPTOOL) --port $(SERDEV) write_flash 0x10000 ArduRemoteID_$*_OTA.bin
  67. upload: upload-ESP32S3_DEV
  68. submodule_update:
  69. git submodule update --recursive --force --init
  70. clean:
  71. rm -rf ..esp32* *.bin build* romfs_files.h