Browse Source

Improved build system and upload process.

* The Sublime Text project now includes a `make upload` build system.
    * `make upload` now attempts to automatically detect the device, and the
      upload process will fail if it cannot be found.
master
Ian Burgmyer 4 years ago
parent
commit
737e520725
  1. 9
      Makefile
  2. 7
      Template.sublime-project

9
Makefile

@ -13,6 +13,8 @@ RM = rm
BIN = bin
SRC = ${PROJECT_NAME}
TARGET=$(shell ${ARDUINO-CLI} board list | grep arduino:avr:leonardo | awk '{print $$1}')
# credit: kenorb
# https://stackoverflow.com/questions/18136918/how-to-get-current-relative-directory-of-your-makefile
CWD := $(abspath $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST))))))
@ -45,4 +47,9 @@ compile:
upload: compile
cd ${CWD}
${ARDUINO-CLI} upload --fqbn arduino:avr:leonardo --input-dir ${BIN} -p ${TARGET} ${PROJECT_NAME}
@if [ "$(strip ${TARGET})" = "" ]; then\
echo Arduboy could not be found. Is it plugged in and turned on\?;\
exit 1;\
else\
${ARDUINO-CLI} upload --fqbn arduino:avr:leonardo --input-dir ${BIN} -p ${TARGET} ${PROJECT_NAME};\
fi

7
Template.sublime-project vendored

@ -4,5 +4,12 @@
{
"path": "."
}
],
"build_systems":
[
{
"name": "Make - Upload",
"cmd": [ "make", "upload" ]
}
]
}

Loading…
Cancel
Save