diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | Makefile | 33 | ||||
-rw-r--r-- | linux-compatible-tty.conf | 20 |
3 files changed, 54 insertions, 1 deletions
@@ -1 +1 @@ -build-leonardo +/build diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..28c58e7 --- /dev/null +++ b/Makefile @@ -0,0 +1,33 @@ +#DEVICE := /dev/ttyACM1 +# FreeBSD (via Linuxator). +# This requires installation of the linux-compatible-tty.conf devd script. +# Without this, `arduino-cli upload` will not work. +# You can however manually invoke avrdude on FreeBSD if everything fails. +DEVICE := /dev/ttyACM0 + +FQBN := arduino:avr:leonardo + +ARDUINO_CLI := arduino-cli +#ARDUINO_CLI := ~/arduino-ide_2.2.1_Linux_64bit/resources/app/lib/backend/resources/arduino-cli + +all: compile + +install-deps: + $(ARDUINO_CLI) core install arduino:avr + $(ARDUINO_CLI) lib install DistanceSensor + $(ARDUINO_CLI) lib install MIDIUSB + @echo 'You have to install https://github.com/tttapa/Control-Surface manually.' + +# For the legacy arduino-build that runs natively on FreeBSD. +# Not all libraries are compatible, though. +# Especially Control-Surface apparently needs a v2 core. +# arduino-builder -compile -hardware /usr/local/arduino/hardware -tools /usr/local/arduino/hardware/tools/ -tools /usr/local/arduino/tools-builder/ -core-api-version 10618 -libraries ~/Arduino/libraries -fqbn arduino:avr:leonardo -prefs "compiler.cpp.extra_flags=-DARDUINO_API_VERSION=1" -verbose shmotbox.ino +compile: + $(ARDUINO_CLI) compile --fqbn $(FQBN) . + +# You may have to run this as root, but this will require installing +# the arduino:avr core into the root account as well. +# It therefore makes sense to have $(DEVICE) accessible as a regular user. +# On FreeBSD you have to be in the dialer group. +upload: + $(ARDUINO_CLI) upload -p $(DEVICE) --fqbn $(FQBN) . diff --git a/linux-compatible-tty.conf b/linux-compatible-tty.conf new file mode 100644 index 0000000..086aa50 --- /dev/null +++ b/linux-compatible-tty.conf @@ -0,0 +1,20 @@ +# This FreeBSD devd-script creates Linux-like TTY device nodes under /compat/ubuntu/dev/. +# This fixes `arduino-cli upload`. + +notify 100 { + match "system" "DEVFS"; + match "subsystem" "CDEV"; + match "type" "CREATE"; + match "cdev" "cuaU[0-9]+"; + + action "ln -s $cdev /compat/ubuntu/dev/`echo $cdev | sed 's/^cuaU/ttyACM/'`"; +}; + +notify 100 { + match "system" "DEVFS"; + match "subsystem" "CDEV"; + match "type" "DESTROY"; + match "cdev" "cuaU[0-9]+"; + + action "rm /compat/ubuntu/dev/`echo $cdev | sed 's/^cuaU/ttyACM/'`"; +}; |