From 665ddf72fdbdc5a099c17e6291b3f12b741567b4 Mon Sep 17 00:00:00 2001 From: Jan Paw Date: Sat, 10 Oct 2020 21:29:39 +0200 Subject: [PATCH 1/7] leonardo runner - support for macos --- boards/arduino-leonardo/leonardo-runner.sh | 35 +++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/boards/arduino-leonardo/leonardo-runner.sh b/boards/arduino-leonardo/leonardo-runner.sh index be1ca342cc..8f968550c5 100755 --- a/boards/arduino-leonardo/leonardo-runner.sh +++ b/boards/arduino-leonardo/leonardo-runner.sh @@ -1,6 +1,39 @@ #!/usr/bin/env sh set -e +LINUX_OS="LINUX" +MAC_OS="MAC" +UNKNOWN_OS="UNKNOWN" + +case "$(uname -s)" in + Linux*) OS=$LINUX_OS;; + Darwin*) OS=$MAC_OS;; + *) OS=$UNKNOWN_OS +esac + +if ! command -v numfmt &> /dev/null +then + echo "required numfmt could not be found!" + echo "please install https://command-not-found.com/numfmt" + exit 1 +fi + +if ! command -v avrdude &> /dev/null +then + echo "required avrdude could not be found!" + echo "please install https://command-not-found.com/avrdude" + exit 1 +fi + +if [ $OS = $LINUX_OS ]; then + ARDUINO_UPLOAD_PORT="/dev/ttyACM0" +elif [ $OS = $MAC_OS ]; then + ARDUINO_UPLOAD_PORT="/dev/cu.usbmodem146201" +else + echo "Not supporte OS!" + exit 1 +fi + if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then echo "usage: $0 " >&2 exit 1 @@ -28,4 +61,4 @@ read -r printf "Attempting to flash ...\n" printf "\n" -avrdude -qq -C/etc/avrdude.conf -patmega32u4 -cavr109 -P/dev/ttyACM0 -b57600 -D "-Uflash:w:$1:e" +avrdude -qq -patmega32u4 -cavr109 -P"${ARDUINO_UPLOAD_PORT}" -b57600 -D "-Uflash:w:$1:e" From 6c448d24e1f9cf582ea86da961e01709f0884ca7 Mon Sep 17 00:00:00 2001 From: Jan Paw Date: Sat, 10 Oct 2020 21:31:18 +0200 Subject: [PATCH 2/7] typo --- boards/arduino-leonardo/leonardo-runner.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/arduino-leonardo/leonardo-runner.sh b/boards/arduino-leonardo/leonardo-runner.sh index 8f968550c5..e384146bd3 100755 --- a/boards/arduino-leonardo/leonardo-runner.sh +++ b/boards/arduino-leonardo/leonardo-runner.sh @@ -30,7 +30,7 @@ if [ $OS = $LINUX_OS ]; then elif [ $OS = $MAC_OS ]; then ARDUINO_UPLOAD_PORT="/dev/cu.usbmodem146201" else - echo "Not supporte OS!" + echo "Not supported OS!" exit 1 fi From ce13bc34affef3fdff858c8bbfd88952eb502d78 Mon Sep 17 00:00:00 2001 From: Jan Paw Date: Sun, 11 Oct 2020 19:08:06 +0200 Subject: [PATCH 3/7] Update boards/arduino-leonardo/leonardo-runner.sh Co-authored-by: Rahix --- boards/arduino-leonardo/leonardo-runner.sh | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/boards/arduino-leonardo/leonardo-runner.sh b/boards/arduino-leonardo/leonardo-runner.sh index e384146bd3..6c5146a19f 100755 --- a/boards/arduino-leonardo/leonardo-runner.sh +++ b/boards/arduino-leonardo/leonardo-runner.sh @@ -1,14 +1,10 @@ #!/usr/bin/env sh set -e -LINUX_OS="LINUX" -MAC_OS="MAC" -UNKNOWN_OS="UNKNOWN" - case "$(uname -s)" in - Linux*) OS=$LINUX_OS;; - Darwin*) OS=$MAC_OS;; - *) OS=$UNKNOWN_OS + Linux*) OS="Linux";; + Darwin*) OS="Mac";; + *) OS="Unknown";; esac if ! command -v numfmt &> /dev/null From 8e5e836f98e4d5581513a77040652e8e557af74f Mon Sep 17 00:00:00 2001 From: Jan Paw Date: Sun, 11 Oct 2020 19:08:20 +0200 Subject: [PATCH 4/7] Update boards/arduino-leonardo/leonardo-runner.sh Co-authored-by: Rahix --- boards/arduino-leonardo/leonardo-runner.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/boards/arduino-leonardo/leonardo-runner.sh b/boards/arduino-leonardo/leonardo-runner.sh index 6c5146a19f..63191db38e 100755 --- a/boards/arduino-leonardo/leonardo-runner.sh +++ b/boards/arduino-leonardo/leonardo-runner.sh @@ -9,9 +9,9 @@ esac if ! command -v numfmt &> /dev/null then - echo "required numfmt could not be found!" - echo "please install https://command-not-found.com/numfmt" - exit 1 + echo "numfmt is needed for human-readable sizes." >&2 + echo "please install https://command-not-found.com/numfmt" >&2 + alias numfmt=true fi if ! command -v avrdude &> /dev/null From 38929efd0a46de42a545f25f646e712b902aefad Mon Sep 17 00:00:00 2001 From: Jan Paw Date: Sun, 11 Oct 2020 19:08:28 +0200 Subject: [PATCH 5/7] Update boards/arduino-leonardo/leonardo-runner.sh Co-authored-by: Rahix --- boards/arduino-leonardo/leonardo-runner.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/boards/arduino-leonardo/leonardo-runner.sh b/boards/arduino-leonardo/leonardo-runner.sh index 63191db38e..a50f2d445f 100755 --- a/boards/arduino-leonardo/leonardo-runner.sh +++ b/boards/arduino-leonardo/leonardo-runner.sh @@ -16,8 +16,8 @@ fi if ! command -v avrdude &> /dev/null then - echo "required avrdude could not be found!" - echo "please install https://command-not-found.com/avrdude" + echo "required avrdude could not be found!" >&2 + echo "please install https://command-not-found.com/avrdude" >&2 exit 1 fi From 0151b6e3ad39be0ee28617b471accf6a8c543814 Mon Sep 17 00:00:00 2001 From: Jan Paw Date: Sun, 11 Oct 2020 19:16:52 +0200 Subject: [PATCH 6/7] arduino leonardo port renam --- boards/arduino-leonardo/leonardo-runner.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/boards/arduino-leonardo/leonardo-runner.sh b/boards/arduino-leonardo/leonardo-runner.sh index a50f2d445f..9decf7f4b3 100755 --- a/boards/arduino-leonardo/leonardo-runner.sh +++ b/boards/arduino-leonardo/leonardo-runner.sh @@ -21,13 +21,13 @@ then exit 1 fi -if [ $OS = $LINUX_OS ]; then - ARDUINO_UPLOAD_PORT="/dev/ttyACM0" -elif [ $OS = $MAC_OS ]; then - ARDUINO_UPLOAD_PORT="/dev/cu.usbmodem146201" +if [ $OS = "Linux" ]; then + SERIAL_PORT="/dev/ttyACM0" +elif [ $OS = "Mac" ]; then + SERIAL_PORT="/dev/cu.usbmodem146201" else - echo "Not supported OS!" - exit 1 + echo "unsupported OS, things might not work" >&2 + SERIAL_PORT="/dev/ttyACM0" fi if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then @@ -57,4 +57,4 @@ read -r printf "Attempting to flash ...\n" printf "\n" -avrdude -qq -patmega32u4 -cavr109 -P"${ARDUINO_UPLOAD_PORT}" -b57600 -D "-Uflash:w:$1:e" +avrdude -qq -patmega32u4 -cavr109 -P"${SERIAL_PORT}" -b57600 -D "-Uflash:w:$1:e" From a8570b489c951b3cb5abfbf415372538cacdad2c Mon Sep 17 00:00:00 2001 From: Jan Paw Date: Mon, 12 Oct 2020 21:57:27 +0200 Subject: [PATCH 7/7] uno an pro-micro runner update --- boards/arduino-uno/uno-runner.sh | 31 ++++++++++++++++++- boards/sparkfun-pro-micro/pro-micro-runner.sh | 31 ++++++++++++++++++- 2 files changed, 60 insertions(+), 2 deletions(-) diff --git a/boards/arduino-uno/uno-runner.sh b/boards/arduino-uno/uno-runner.sh index db3f6942b7..b76daf5053 100755 --- a/boards/arduino-uno/uno-runner.sh +++ b/boards/arduino-uno/uno-runner.sh @@ -1,6 +1,35 @@ #!/usr/bin/env sh set -e +case "$(uname -s)" in + Linux*) OS="Linux";; + Darwin*) OS="Mac";; + *) OS="Unknown";; +esac + +if ! command -v numfmt &> /dev/null +then + echo "numfmt is needed for human-readable sizes." >&2 + echo "please install https://command-not-found.com/numfmt" >&2 + alias numfmt=true +fi + +if ! command -v avrdude &> /dev/null +then + echo "required avrdude could not be found!" >&2 + echo "please install https://command-not-found.com/avrdude" >&2 + exit 1 +fi + +if [ $OS = "Linux" ]; then + SERIAL_PORT="/dev/ttyACM0" +elif [ $OS = "Mac" ]; then + SERIAL_PORT="/dev/cu.usbmodem146201" +else + echo "unsupported OS, things might not work" >&2 + SERIAL_PORT="/dev/ttyACM0" +fi + if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then echo "usage: $0 " >&2 exit 1 @@ -26,4 +55,4 @@ printf "\n" printf "Attempting to flash ...\n" printf "\n" -avrdude -q -C/etc/avrdude.conf -patmega328p -carduino -P/dev/ttyACM0 -D "-Uflash:w:$1:e" +avrdude -q -patmega328p -carduino -P"${SERIAL_PORT}" -D "-Uflash:w:$1:e" diff --git a/boards/sparkfun-pro-micro/pro-micro-runner.sh b/boards/sparkfun-pro-micro/pro-micro-runner.sh index be1ca342cc..5383e5f68b 100755 --- a/boards/sparkfun-pro-micro/pro-micro-runner.sh +++ b/boards/sparkfun-pro-micro/pro-micro-runner.sh @@ -1,6 +1,35 @@ #!/usr/bin/env sh set -e +case "$(uname -s)" in + Linux*) OS="Linux";; + Darwin*) OS="Mac";; + *) OS="Unknown";; +esac + +if ! command -v numfmt &> /dev/null +then + echo "numfmt is needed for human-readable sizes." >&2 + echo "please install https://command-not-found.com/numfmt" >&2 + alias numfmt=true +fi + +if ! command -v avrdude &> /dev/null +then + echo "required avrdude could not be found!" >&2 + echo "please install https://command-not-found.com/avrdude" >&2 + exit 1 +fi + +if [ $OS = "Linux" ]; then + SERIAL_PORT="/dev/ttyACM0" +elif [ $OS = "Mac" ]; then + SERIAL_PORT="/dev/cu.usbmodem146201" +else + echo "unsupported OS, things might not work" >&2 + SERIAL_PORT="/dev/ttyACM0" +fi + if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then echo "usage: $0 " >&2 exit 1 @@ -28,4 +57,4 @@ read -r printf "Attempting to flash ...\n" printf "\n" -avrdude -qq -C/etc/avrdude.conf -patmega32u4 -cavr109 -P/dev/ttyACM0 -b57600 -D "-Uflash:w:$1:e" +avrdude -qq -patmega32u4 -cavr109 -P"${SERIAL_PORT}" -b57600 -D "-Uflash:w:$1:e"