2022-05-22 21:55:22 -06:00
|
|
|
FQBN_qtpy = adafruit:samd:adafruit_qtpy_m0
|
|
|
|
FQBN_xiao = Seeeduino:samd:seeed_XIAO_m0
|
2022-04-19 22:16:12 -06:00
|
|
|
UF2_MOUNT = /mnt/chromeos/removable/Arduino
|
2024-01-08 15:01:43 -07:00
|
|
|
ARDUINO_DIR = /usr/share/arduino
|
2022-04-19 22:16:12 -06:00
|
|
|
BUILDER = flatpak run --command ${ARDUINO_DIR}/arduino-builder cc.arduino.arduinoide
|
|
|
|
|
2024-01-08 15:01:43 -07:00
|
|
|
default: vail-adapter.qtpy.uf2 vail-adapter.xiao.uf2
|
|
|
|
install: vail-adapter.xiao.uf2
|
2022-04-19 22:16:12 -06:00
|
|
|
./install.sh $< $(UF2_MOUNT)
|
|
|
|
|
2022-05-22 21:55:22 -06:00
|
|
|
clean:
|
2024-01-08 15:01:43 -07:00
|
|
|
rm -rf build/
|
2022-05-22 21:55:22 -06:00
|
|
|
|
2022-04-19 22:16:12 -06:00
|
|
|
# uf2conv.py is covered by an MIT license.
|
|
|
|
build/uf2conv.py: build/uf2families.json
|
|
|
|
mkdir -p build
|
|
|
|
curl -L https://raw.githubusercontent.com/microsoft/uf2/master/utils/$(@F) > $@
|
|
|
|
chmod +x $@
|
|
|
|
build/uf2families.json:
|
|
|
|
mkdir -p build
|
|
|
|
curl -L https://raw.githubusercontent.com/microsoft/uf2/master/utils/$(@F) > $@
|
|
|
|
|
2022-05-22 21:55:22 -06:00
|
|
|
%.xiao.uf2: %.xiao.bin build/uf2conv.py
|
|
|
|
build/uf2conv.py -b 0x2000 -c -o $@ $<
|
|
|
|
|
|
|
|
%.qtpy.uf2: %.qtpy.bin build/uf2conv.py
|
2022-04-19 22:16:12 -06:00
|
|
|
build/uf2conv.py -b 0x2000 -c -o $@ $<
|
|
|
|
|
2024-01-08 15:01:43 -07:00
|
|
|
%.qtpy.bin: FQBN = adafruit:samd:adafruit_qtpy_m0
|
|
|
|
%.xiao.bin: FQBN = Seeeduino:samd:seeed_XIAO_m0
|
|
|
|
vail-adapter.%.bin: vail-adapter.ino *.cpp *.h core-%/.done
|
|
|
|
mkdir -p build/cache
|
2022-04-19 22:16:12 -06:00
|
|
|
arduino-builder \
|
2024-01-08 15:01:43 -07:00
|
|
|
-build-cache build/cache \
|
|
|
|
-build-path build/ \
|
2022-04-19 22:16:12 -06:00
|
|
|
-core-api-version 10813 \
|
|
|
|
-fqbn $(FQBN) \
|
2024-01-08 15:01:43 -07:00
|
|
|
-tools $(ARDUINO_DIR)/tools \
|
|
|
|
-tools core-$*/ArduinoCore*/ \
|
2022-04-19 22:16:12 -06:00
|
|
|
-hardware $(ARDUINO_DIR)/hardware \
|
2024-01-08 15:01:43 -07:00
|
|
|
-hardware core-$*/ArduinoCore* \
|
2022-04-19 22:16:12 -06:00
|
|
|
-built-in-libraries $(ARDUINO_DIR)/libraries \
|
2024-01-08 15:01:43 -07:00
|
|
|
-built-in-libraries core-$*/ArduinoCore*/ \
|
2022-04-19 22:16:12 -06:00
|
|
|
-compile \
|
|
|
|
$<
|
2024-01-08 15:01:43 -07:00
|
|
|
mv build/vail-adapter.ino.bin $@
|
|
|
|
|
|
|
|
core-xiao/.done:
|
|
|
|
mkdir -p $(dir $@)
|
|
|
|
curl -L https://github.com/Seeed-Studio/ArduinoCore-samd/releases/download/v1.8.5/ArduinoCore-samd-1.8.5.tar.bz2 | tar xj -C $(dir $@)
|
|
|
|
touch $@
|
|
|
|
|
2022-04-19 22:16:12 -06:00
|
|
|
|
|
|
|
upload: vail-adapter.ino
|
|
|
|
arduino --upload --board $(FQBN) $<
|