Makefile 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. ArduRemoteID-%.bin: *.cpp *.ino *.h
  30. @echo "Building $* on $(CHIP)"
  31. @BUILD_FLAGS="-DBOARD_$*"
  32. @rm -rf build build-$*
  33. @$(ARDUINO_CLI) compile -b esp32:esp32:$(CHIP) --export-binaries --build-property build.extra_flags=-DBOARD_$* --build-property upload.maximum_size=$(APP_PARTITION_SIZE) .
  34. @echo "Merging $*"
  35. @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
  36. @mv build build-$*
  37. boards:
  38. @echo "Listing boards"
  39. @$(ARDUINO_CLI) board list
  40. checkdev:
  41. @[ "${SERDEV}" ] && echo "Using device $(SERDEV)" || ( echo "Failed to find serial device"; exit 1 )
  42. upload-%: checkdev
  43. @echo "Flashing ArduRemoteID-$*.bin"
  44. $(ESPTOOL) --port $(SERDEV) write_flash 0x0 ArduRemoteID-$*.bin
  45. upload: upload-ESP32S3_DEV
  46. clean:
  47. rm -rf ..esp32* *.bin build*