Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

leonardo runner - support for macos #87

Merged
merged 7 commits into from
Oct 13, 2020
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion boards/arduino-leonardo/leonardo-runner.sh
Original file line number Diff line number Diff line change
@@ -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
explicite marked this conversation as resolved.
Show resolved Hide resolved

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
explicite marked this conversation as resolved.
Show resolved Hide resolved
fi

if ! command -v avrdude &> /dev/null
then
echo "required avrdude could not be found!"
echo "please install https://command-not-found.com/avrdude"
explicite marked this conversation as resolved.
Show resolved Hide resolved
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 supported OS!"
exit 1
fi
Rahix marked this conversation as resolved.
Show resolved Hide resolved

if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
echo "usage: $0 <application.elf>" >&2
exit 1
Expand Down Expand Up @@ -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"
explicite marked this conversation as resolved.
Show resolved Hide resolved
avrdude -qq -patmega32u4 -cavr109 -P"${ARDUINO_UPLOAD_PORT}" -b57600 -D "-Uflash:w:$1:e"