1
0

snapshot sketch and infrastructure from the Kaleidoscope example

This commit is contained in:
Jesse Vincent 2017-02-19 17:04:09 -08:00
parent 12f774d34c
commit a0e03fa82c
7 changed files with 592 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
*~
.#*
/output/

View File

@ -0,0 +1,3 @@
# -*- mode: sh -*-
DEFAULT_SKETCH=Model01-Firmware

31
.travis.yml Normal file
View File

@ -0,0 +1,31 @@
language: c
before_install:
- pushd ..
- wget http://downloads.arduino.cc/arduino-1.6.11-linux64.tar.xz
- tar xf arduino-1.6.11-linux64.tar.xz
- popd
install:
- pushd ..
- mkdir -p arduino-local/hardware/keyboardio
- git clone https://github.com/keyboardio/Arduino-Boards arduino-local/hardware/keyboardio/avr
- cd arduino-local/hardware/keyboardio/avr
- git submodule sync --recursive
- git submodule update --init --recursive
- popd
script:
- make ARDUINO_PATH=../arduino-1.6.11 ARDUINO_LOCAL_LIB_PATH=../arduino-local build-all
notifications:
irc:
channels:
- "chat.freenode.net#keyboardio"
use_notice: true
skip_join: true
template:
- "%{repository_name}/%{branch} %{commit} by %{author}: %{commit_subject} %{build_url} %{message}"
email:
on_success: change
on_failure: change
slack:
secure: geVAHVhYQ5bY7ja5vx1Tgxc5y64WLuXVEWKmw4LqiThFYCjtpdWkHGiZJfhUwkVI11u5w8w1FUmrB7ZP4EUGoXhCK/z1mvVMVJ9+fS+WoaqcTHFJi0hGbvXaFPD7QA+ef7TLrFcU643kf6KHN/P+dVVndLyhctXZqOZHHwXmKZNMt8qM5Gh5h41HOi0YjT9yFafSU0qf5jphF5qvjlxKsVJF+WxtMSU4xMYxzq7rf80bPi2pu4ijgqR5+Haaa71DJ1V2TA4wZ+BFTBo2YUJIGZ8qDlqmb7RdF/u72G/8HbT/Hzj55blrpBXU/BPkokGOPJlIGHPV76ESpJI0ZUILRifmkZY6ylMjl/hutDYPNjhMq8Z/UKSLN6pJQAq0PjqAoHCtPsXTbRMT0lhVt2itkCPwAXVgszTrE6INsNylY/soaDu66Sjmz2zQH8sC6hbL8SrZ0xGs1Q+e3q5WMETPIAS9f4n2YCxkIz4ORoL9IrOXUcebVNriiWKzOBt6bleWPJlGc6yVYkkUhvURH+jEp6v2Y5SqsaJVTD3I5Gq/H/0PJBtPdzu470yQ3/FD4g6M0AmWx8DCuvl1O295QOZbUtujpIowTm7PynFrAgW3ptSidjzWjzZaHc0iQJBiNi86dg3GomoEEOPzx8hnX7fhFgsR+Ixqfzx0srrQYqleQGY=
cache:
ccache: true

10
Makefile Normal file
View File

@ -0,0 +1,10 @@
# default action for `make` is `build`
build:
astyle:
find . -type f -name \*.cpp |xargs -n 1 astyle --style=google
find . -type f -name \*.ino |xargs -n 1 astyle --style=google
find . -type f -name \*.h |xargs -n 1 astyle --style=google
%:
@tools/kaleidoscope-builder $@

148
Model01-Firmware.ino Normal file
View File

@ -0,0 +1,148 @@
// -*- mode: c++ -*-
// Copyright 2016 Keyboardio, inc. <jesse@keyboard.io>
// See "LICENSE" for license details
#define DEBUG_SERIAL false
#include "Kaleidoscope-MouseKeys.h"
#include "Kaleidoscope-Macros.h"
#include "Kaleidoscope-LEDControl.h"
#include "Kaleidoscope-Numlock.h"
#include "Kaleidoscope.h"
#include "LED-Off.h"
#include "Kaleidoscope-LEDEffect-SolidColor.h"
#include "Kaleidoscope-LEDEffect-Breathe.h"
#include "Kaleidoscope-LEDEffect-Chase.h"
#include "Kaleidoscope-LEDEffect-Rainbow.h"
#include "Kaleidoscope-Model01-TestMode.h"
uint8_t primary_keymap = 0;
uint8_t temporary_keymap = 0;
#define NUMPAD_KEYMAP 2
#define COLEMAK KEYMAP ( \
___, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext, ___, Key_6, Key_7, Key_8, Key_9, Key_0, Key_ToggleNumlock, \
Key_Backtick, Key_Q, Key_W, Key_F, Key_P, Key_G, Key_Tab, Key_Enter, Key_J, Key_L, Key_U, Key_Y, Key_Semicolon, Key_Equals, \
Key_PageUp, Key_A, Key_R, Key_S, Key_T, Key_D, Key_H, Key_N, Key_E, Key_I, Key_O, Key_Quote, \
Key_PageDn, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Esc, ___, Key_K, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus,\
Key_LCtrl, Key_Backspace, Key_LGUI, Key_LShift, Key_RShift, Key_RAlt, Key_Space, Key_RCtrl,\
Key_Keymap1_Momentary, Key_Keymap1_Momentary,\
)
#define DVORAK KEYMAP ( \
___, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext, ___, Key_6, Key_7, Key_8, Key_9, Key_0, Key_ToggleNumlock, \
Key_Backtick, Key_Quote, Key_Comma, Key_Period, Key_P, Key_Y, Key_Tab, Key_Enter, Key_F, Key_G, Key_C, Key_R, Key_L, Key_Slash, \
Key_PageUp, Key_A, Key_O, Key_E, Key_U, Key_I, Key_D, Key_H, Key_T, Key_N, Key_S, Key_Minus, \
Key_PageDn, Key_Semicolon, Key_Q, Key_J, Key_K, Key_X, Key_Esc, ___, Key_B, Key_M, Key_W, Key_V, Key_Z, Key_Equals, \
Key_LCtrl, Key_Backspace, Key_LGUI, Key_LShift, Key_RShift, Key_RAlt, Key_Space, Key_RCtrl, \
Key_KeymapNext_Momentary, Key_KeymapNext_Momentary \
)
#define GENERIC_FN2 KEYMAP_STACKED ( \
___, Key_F1, Key_F2, Key_F3, Key_F4, Key_F5, XXX, \
Key_Tab, Key_mouseBtnM, Key_mouseUp, ___, Key_mouseWarpNW, Key_mouseWarpNE, Key_nextTrack, \
Key_Home, Key_mouseL, Key_mouseDn, Key_mouseR, Key_mouseWarpSW, Key_mouseWarpSE, \
Key_End, Key_Z, Key_X, Key_C, Key_V, Key_mouseWarpEnd, ___, \
Key_LCtrl, Key_mouseBtnL, Key_LGUI, Key_LShift, \
___,\
\
XXX, Key_F6, Key_F7, Key_F8, Key_F9, ___, ___,\
Key_Delete, Key_playPause, Key_LCurlyBracket, Key_RCurlyBracket, Key_LSquareBracket, Key_RSquareBracket, Key_sleep,\
Key_LArrow, Key_DnArrow, Key_UpArrow, Key_RArrow, Key_F11, Key_F12,\
___, Key_volumeDown, Key_volumeUp, Key_BacklightDn, Key_BacklightUp, Key_Backslash, Key_Pipe,\
Key_RShift, Key_RAlt, Key_mouseBtnR, Key_RCtrl,\
___\
)
#define MALTRON KEYMAP ( \
___, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext, ___, Key_6, Key_7, Key_8, Key_9, Key_0, Key_ToggleNumlock, \
Key_Backtick, Key_Q, Key_P, Key_Y, Key_C, Key_B, Key_Tab, Key_Enter, Key_V, Key_M, Key_U, Key_Z, Key_L, Key_Equals, \
Key_PageUp, Key_A, Key_N, Key_I, Key_S, Key_F, Key_D, Key_T, Key_H, Key_O, Key_R, Key_Quote, \
Key_PageDn, Key_Comma, Key_Period, Key_J, Key_G, Key_Slash, Key_Esc, ___, Key_Semicolon, Key_W, Key_K, Key_Minus, Key_X, Key_LSquareBracket, \
Key_E, Key_Backspace, Key_LGUI, Key_LShift, Key_RShift, Key_RAlt, Key_Space, Key_RCtrl, \
Key_KeymapNext_Momentary, Key_KeymapNext_Momentary \
)
#define NUMPAD KEYMAP (\
___, ___, ___, ___, ___, ___, ___, ___, ___, Key_Keypad7, Key_Keypad8, Key_Keypad9, Key_KeypadMinus, ___, \
___, ___, ___, ___, ___, ___, ___, ___, ___, Key_Keypad4, Key_Keypad5, Key_Keypad6, Key_KeypadPlus, ___, \
___, ___, ___, ___, ___, ___, ___, Key_Keypad1, Key_Keypad2, Key_Keypad3, Key_Equals, Key_Quote, \
___, ___, ___, ___, ___, ___, ___, ___, ___, Key_Keypad0, Key_KeypadDot, Key_KeypadMultiply, Key_KeypadSlash, Key_Enter, \
Key_LCtrl, Key_Backspace, Key_LGUI, Key_LShift, Key_RShift, Key_RAlt, Key_Space, Key_RCtrl, \
Key_Keymap1_Momentary, Key_Keymap1_Momentary \
)
#define QWERTY KEYMAP ( \
___, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext, ___, Key_6, Key_7, Key_8, Key_9, Key_0, Key_ToggleNumlock, \
Key_Backtick, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Tab, Key_Enter, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_Equals, \
Key_PageUp, Key_A, Key_S, Key_D, Key_F, Key_G, Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Quote, \
Key_PageDn, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Esc, ___, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus, \
Key_LCtrl, Key_Backspace, Key_LGUI, Key_LShift, Key_RShift, Key_RAlt, Key_Space, Key_RCtrl, \
Key_KeymapNext_Momentary, Key_KeymapNext_Momentary \
)
#define WORKMAN KEYMAP ( \
___, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext, ___, Key_6, Key_7, Key_8, Key_9, Key_0, Key_ToggleNumlock, \
Key_Backtick, Key_Q, Key_D, Key_R, Key_W, Key_B, Key_Tab, Key_Enter, Key_J, Key_F, Key_U, Key_P, Key_Semicolon, Key_Equals, \
Key_PageUp, Key_A, Key_S, Key_H, Key_T, Key_G, Key_Y, Key_N, Key_E, Key_O, Key_I, Key_Quote, \
Key_PageDn, Key_Z, Key_X, Key_M, Key_C, Key_V, Key_Esc, ___, Key_K, Key_L, Key_Comma, Key_Period, Key_Slash, Key_Minus, \
Key_LCtrl, Key_Backspace, Key_LGUI, Key_LShift, Key_RShift, Key_RAlt, Key_Space, Key_RCtrl, \
Key_KeymapNext_Momentary, Key_KeymapNext_Momentary \
)
const Key keymaps[][ROWS][COLS] PROGMEM = {
QWERTY,
GENERIC_FN2,
NUMPAD
};
static LEDSolidColor solidRed (60, 0, 0);
static LEDSolidColor solidOrange (60, 20, 0);
static LEDSolidColor solidYellow (40, 35, 0);
static LEDSolidColor solidGreen (0, 100, 0);
static LEDSolidColor solidBlue (0, 15, 100);
static LEDSolidColor solidIndigo (0, 0, 100);
static LEDSolidColor solidViolet (70, 0, 60);
const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) {
if (macroIndex == TOGGLENUMLOCK && key_toggled_on(keyState)) {
return NumLock.toggle (Macros.row, Macros.col, NUMPAD_KEYMAP);
}
if (macroIndex == 1 && key_toggled_on(keyState)) {
Serial.print("Keyboard.IO keyboard driver v0.00");
return MACRO(I(25),
D(LShift), T(M), U(LShift), T(O), T(D), T(E), T(L),
T(Space),
W(100),
T(0), T(1),
END);
}
return MACRO_NONE;
}
void setup() {
Kaleidoscope.setup(KEYMAP_SIZE);
Kaleidoscope.use(&TestMode,
&LEDControl, &LEDOff,
&solidRed, &solidOrange, &solidYellow, &solidGreen, &solidBlue, &solidIndigo, &solidViolet,
&LEDBreatheEffect, &LEDRainbowEffect, &LEDChaseEffect, &NumLock,
&Macros,
&MouseKeys,
NULL);
LEDOff.activate();
}
void loop() {
Kaleidoscope.loop();
}

312
tools/kaleidoscope-builder Executable file
View File

@ -0,0 +1,312 @@
#! /bin/sh
set -e
firmware_size () {
## This is a terrible hack, please don't hurt me. - algernon
MAX_PROG_SIZE=28672
output="$($@ | grep "\\(Program\\|Data\\):" | sed -e 's,^, - ,' && echo)"
PROGSIZE="$(echo "${output}" | grep Program: | cut -d: -f2 | awk '{print $1}')"
PERCENT="$(echo ${PROGSIZE} ${MAX_PROG_SIZE} | awk "{ printf \"%02.01f\", \$1 / \$2 * 100 }")"
echo "${output}" | sed -e "s,\(Program:.*\)(\([0-9\.]*%\) Full),\1(${PERCENT}% Full),"
}
find_sketch () {
if [ -e "${SOURCEDIR}/.kaleidoscope-builder.conf" ]; then
. "${SOURCEDIR}/.kaleidoscope-builder.conf"
fi
SKETCH="${SKETCH:-${DEFAULT_SKETCH}}"
LIBRARY="${LIBRARY:-${SKETCH}}"
for path in "hardware/keyboardio/avr/libraries/Kaleidoscope-${LIBRARY}/examples/${SKETCH}" \
"examples/${LIBRARY}" \
"src"; do
if [ -f "${path}/${SKETCH}.ino" ]; then
echo "${path}"
return
fi
done
exit 1
}
prepare_to_flash () {
if [ ! -e "${HEX_FILE_PATH}" ]; then
compile
fi
echo "Press ENTER when ready..."
read a
}
flash () {
prepare_to_flash
reset_device
sleep 3s
flash_over_usb
}
flash_over_usb () {
avrdude -q -q -p${MCU} -cavr109 -D -P ${DEVICE_PORT_BOOTLOADER} -b57600 "-Uflash:w:${HEX_FILE_PATH}:i"
}
program() {
prepare_to_flash
flash_with_programmer
}
flash_with_programmer() {
avrdude -v \
-p${MCU} \
-cusbtiny \
-D \
-B 1 \
"-Uflash:w:${HEX_FILE_PATH}:i"
}
hex_with_bootloader () {
if [ ! -e "${HEX_FILE_PATH}" ]; then
compile
fi
cat ${HEX_FILE_PATH} | awk '/^:00000001FF/ == 0' > ${HEX_FILE_WITH_BOOTLOADER_PATH}
echo "Using ${BOOTLOADER_PATH}"
${MD5} ${BOOTLOADER_PATH}
cat ${BOOTLOADER_PATH} >> ${HEX_FILE_WITH_BOOTLOADER_PATH}
cat <<EOF
Combined firmware and bootloader are now at ${HEX_FILE_WITH_BOOTLOADER_PATH}
Make sure you have the bootloader version you expect.
And TEST THIS ON REAL HARDWARE BEFORE YOU GIVE IT TO ANYONE
EOF
}
build () {
compile $@
size $@
}
compile () {
install -d "${OUTPUT_PATH}"
echo "Building ${OUTPUT_DIR}/${SKETCH} (${LIB_VERSION}) ..."
${compile_HOOKS}
if [ -d "${ARDUINO_LOCAL_LIB_PATH}/libraries" ]; then
local_LIBS="-libraries \"${ARDUINO_LOCAL_LIB_PATH}/libraries\""
fi
${ARDUINO_BUILDER} \
-compile \
-hardware "${ARDUINO_PATH}/hardware" \
-hardware "${BOARD_HARDWARE_PATH}" \
${ARDUINO_TOOLS_PARAM} \
-tools "${ARDUINO_PATH}/tools-builder" \
-fqbn "${FQBN}" \
${local_LIBS} \
-libraries "${BOARD_HARDWARE_PATH}/.." \
-libraries "${ROOT}" \
${EXTRA_BUILDER_ARGS} \
-build-path "${BUILD_PATH}" \
-ide-version "${ARDUINO_IDE_VERSION}" \
-warnings all \
${ARDUINO_VERBOSE} \
-prefs "compiler.cpp.extra_flags=-std=c++11 -Woverloaded-virtual -Wno-unused-parameter -Wno-unused-variable -Wno-ignored-qualifiers" \
${ARDUINO_AVR_GCC_PREFIX_PARAM} \
"$(find_sketch)/${SKETCH}.ino"
cp "${BUILD_PATH}/${SKETCH}.ino.hex" "${HEX_FILE_PATH}"
cp "${BUILD_PATH}/${SKETCH}.ino.elf" "${ELF_FILE_PATH}"
ln -sf "${OUTPUT_FILE_PREFIX}.hex" "${OUTPUT_PATH}/${SKETCH}-latest.hex"
ln -sf "${OUTPUT_FILE_PREFIX}.elf" "${OUTPUT_PATH}/${SKETCH}-latest.elf"
rm -rf "${BUILD_PATH}"
}
_find_all () {
for plugin in hardware/keyboardio/avr/libraries/Kaleidoscope-*/examples/* \
examples/* \
src/*.ino; do
if [ -d "$(dirname ${plugin})" ] || [ -f "${plugin}" ]; then
p="$(basename "${plugin}" .ino)"
if [ "${p}" != '*' ]; then
echo "${p}"
fi
fi
done | sort
}
build_all () {
plugins="$(_find_all)"
for plugin in ${plugins}; do
export SKETCH="${plugin}"
export LIBRARY="${plugin}"
$0 ${plugin} build
done
}
size () {
if [ ! -e "${HEX_FILE_PATH}" ]; then
compile
fi
echo "- Size: firmware/${LIBRARY}/${OUTPUT_FILE_PREFIX}.elf"
firmware_size "${AVR_SIZE}" -C --mcu="${MCU}" "${ELF_FILE_PATH}"
echo
}
size_map () {
if [ ! -e "${HEX_FILE_PATH}" ]; then
compile
fi
"${AVR_NM}" --size-sort -C -r -l "${ELF_FILE_PATH}"
}
decompile () {
if [ ! -e "${HEX_FILE_PATH}" ]; then
compile
fi
"${AVR_OBJDUMP}" -d "${ELF_FILE_PATH}"
}
clean () {
rm -rf "${OUTPUT_PATH}"
}
reset_device () {
${RESET_DEVICE}
}
usage () {
cat <<EOF
Usage: $0 SKETCH commands...
Runs all of the commands in the context of the Sketch.
Available commands:
help
This help screen.
compile
Compiles the sketch.
size
Reports the size of the compiled sketch.
build
Runs compile and report-size.
clean
Cleans up the output directory.
size-map
Displays the size map for the sketch.
decomple
Decompile the sketch.
reset-device
Reset the device.
flash
Flashes the firmware using avrdude.
build-all
Build all Sketches we can find.
EOF
}
help () {
usage
}
if [ $# -lt 1 ]; then
usage
exit 1
fi
## Parse the command-line
## - anything that has a =, is an env var
## - from the remaining stuff, the first one is the Library/Sketch
## - everything else are commands
##
## - if there is only one argument, that's a command
ROOT="$(cd $(dirname $0)/..; pwd)"
export ROOT
export SOURCEDIR="$(pwd)"
if [ -e "${HOME}/.kaleidoscope-builder.conf" ]; then
. "${HOME}/.kaleidoscope-builder.conf"
fi
if [ -e "${SOURCEDIR}/.kaleidoscope-builder.conf" ]; then
. "${SOURCEDIR}/.kaleidoscope-builder.conf"
fi
. ${ROOT}/tools/settings.sh
cmds=""
## Export vars
for i in $(seq 1 $#); do
v="$1"
shift
case "${v}" in
*=*)
export ${v}
;;
*)
cmds="${cmds} ${v}"
;;
esac
done
set -- ${cmds}
if [ $# -eq 1 ]; then
cmd="$(echo $1 | tr '-' '_')"
${cmd}
exit $?
fi
SKETCH="$1"
shift
if [ "${SKETCH}" = "default" ]; then
SKETCH="${DEFAULT_SKETCH}"
fi
cmds=""
for i in $(seq 1 $#); do
cmds="${cmds} $(echo $1 | tr '-' '_')"
shift
done
LIBRARY="${SKETCH}"
export SKETCH
export LIBRARY
for cmd in ${cmds}; do
${cmd}
done

85
tools/settings.sh Normal file
View File

@ -0,0 +1,85 @@
## NEEDS: LIBRARY, SKETCH, ROOT, SOURCEDIR
## Should be included when the current directory is the dir of the Sketch.
case "$0" in
*/settings.sh)
echo "This file must be included, never run directly!" >&2
exit 1
;;
esac
SKETCH="${SKETCH:-${DEFAULT_SKETCH}}"
LIBRARY="${LIBRARY:-${SKETCH}}"
if [ -z "${SKETCH}" ] || [ -z "${LIBRARY}" ] || [ -z "${ROOT}" ] || [ -z "${SOURCEDIR}" ]; then
echo "SKETCH, LIBRARY, SOURCEDIR, and ROOT need to be set before including this file!" >&2
exit 1
fi
BOARD="${BOARD:-model01}"
MCU="${MCU:-atmega32u4}"
FQBN="${FQBN:-keyboardio:avr:${BOARD}}"
DEVICE_PORT="$(ls /dev/ttyACM* 2>/dev/null || echo '')"
DEVICE_PORT_BOOTLOADER="$(ls /dev/ttyACM* 2>/dev/null || echo '')"
RESET_DEVICE="stty -F ${DEVICE_PORT} 1200 hupcl"
ARDUINO_PATH="${ARDUINO_PATH:-/usr/local/arduino}"
ARDUINO_LOCAL_LIB_PATH="${ARDUINO_LOCAL_LIB_PATH:-${HOME}/Arduino}"
ARDUINO_TOOLS_PATH="${ARDUINO_TOOLS_PATH:-${ARDUINO_PATH}/hardware/tools}"
ARDUINO_BUILDER="${ARDUINO_BUILDER:-${ARDUINO_PATH}/arduino-builder}"
ARDUINO_IDE_VERSION="100607"
BOARD_HARDWARE_PATH="${BOARD_HARDWARE_PATH:-${ARDUINO_LOCAL_LIB_PATH}/hardware}"
BOOTLOADER_PATH="${BOARD_HARDWARE_PATH}/keyboardio/avr/bootloaders/caterina/Caterina.hex"
AVR_SIZE="${AVR_SIZE:-${ARDUINO_TOOLS_PATH}/avr/bin/avr-size}"
AVR_NM="${AVR_NM:-${ARDUINO_TOOLS_PATH}/avr/bin/avr-nm}"
AVR_OBJDUMP="${AVR_OBJDUMP:-${ARDUINO_TOOLS_PATH}/avr/bin/avr-objdump}"
MD5="md5sum"
BUILD_PATH="${BUILD_PATH:-$(mktemp -d 2>/dev/null || mktemp -d -t 'build')}"
OUTPUT_DIR="${OUTPUT_DIR:-output/${LIBRARY}}"
OUTPUT_PATH="${OUTPUT_PATH:-${SOURCEDIR}/${OUTPUT_DIR}}"
GIT_VERSION="$(cd $(find_sketch); git describe --abbrev=4 --dirty --always)"
LIB_VERSION="$(cd $(find_sketch); (grep version= ../../library.properties 2>/dev/null || echo version=0.0.0) | cut -d= -f2)-g${GIT_VERSION}"
OUTPUT_FILE_PREFIX="${SKETCH}-${LIB_VERSION}"
HEX_FILE_PATH="${OUTPUT_PATH}/${OUTPUT_FILE_PREFIX}.hex"
HEX_FILE_WITH_BOOTLOADER_PATH="${OUTPUT_PATH}/${OUTPUT_FILE_PREFIX}-with-bootloader.hex"
ELF_FILE_PATH="${OUTPUT_PATH}/${OUTPUT_FILE_PREFIX}.elf"
ARDUINO_TOOLS_PARAM="-tools ${ARDUINO_TOOLS_PATH}"
if [ -z "${ARDUINO_TOOLS_PATH}" ]; then
ARDUINO_TOOLS_PARAM=""
fi
if [ ! -z "${AVR_GCC_PREFIX}" ]; then
ARDUINO_AVR_GCC_PREFIX_PARAM="-prefs \"runtime.tools.avr-gcc.path=${AVR_GCC_PREFIX}\""
fi
if [ ! -z "${VERBOSE}" ] && [ "${VERBOSE}" -gt 0 ]; then
ARDUINO_VERBOSE="-verbose"
else
ARDUINO_VERBOSE="-quiet"
fi
## Platform-specific overrides
# Shamelessly stolen from git's Makefile
uname_S=$(uname -s 2>/dev/null || echo not)
if [ "${uname_S}" = "Darwin" ]; then
DEVICE_PORT="$(ls /dev/cu.usbmodemHID?? /dev/cu.usbmodem14*)"
DEVICE_PORT_BOOTLOADER="$(ls /dev/cu.usbmodem14*)"
ARDUINO_PATH="/Applications/Arduino.app/Contents/Java/"
ARDUINO_LOCAL_LIB_PATH="${HOME}/Documents/Arduino"
MD5="md5"
RESET_DEVICE="stty -f ${DEVICE_PORT} 1200"
fi