|
|
|
@ -9,15 +9,15 @@ SKETCH="${SKETCH:-${DEFAULT_SKETCH}}"
|
|
|
|
|
######## Keyboard hardware definitions
|
|
|
|
|
########
|
|
|
|
|
|
|
|
|
|
BOARD="${BOARD:-model01}"
|
|
|
|
|
MCU="${MCU:-atmega32u4}"
|
|
|
|
|
: "${BOARD:=model01}"
|
|
|
|
|
: "${MCU:=atmega32u4}"
|
|
|
|
|
|
|
|
|
|
if [ -z "${ARCH}" ]; then
|
|
|
|
|
ARCH=$(echo "${FQBN}" | sed -n -e 's/^[^:]\+:\([^:]\+\).*/\1/p')
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ "${ARCH}" = "virtual" ]; then
|
|
|
|
|
FQBN="${FQBN:-keyboardio:virtual:${BOARD}}"
|
|
|
|
|
: "${FQBN:=keyboardio:virtual:${BOARD}}"
|
|
|
|
|
|
|
|
|
|
# Set the compiler path for virtual builds
|
|
|
|
|
#
|
|
|
|
@ -31,7 +31,7 @@ else
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ -z "${FQBN}" ]; then
|
|
|
|
|
FQBN="${FQBN:-keyboardio:avr:${BOARD}}"
|
|
|
|
|
: "${FQBN:=keyboardio:avr:${BOARD}}"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
########
|
|
|
|
@ -45,10 +45,10 @@ uname_O=$(uname -o 2>/dev/null || echo not)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
find_device_vid_pid() {
|
|
|
|
|
VID=${VID:-$(get_arduino_pref 'build.vid')}
|
|
|
|
|
SKETCH_PID=${SKETCH_PID:-$(get_arduino_pref 'build.pid')}
|
|
|
|
|
BOOTLOADER_PID=${BOOTLOADER_PID:-$(get_arduino_pref 'bootloader.pid')}
|
|
|
|
|
BOOTLOADER_VID=${BOOTLOADER_VID:-$(get_arduino_pref 'bootloader.vid')}
|
|
|
|
|
: ${VID:=$(get_arduino_pref 'build.vid')}
|
|
|
|
|
: ${SKETCH_PID:=$(get_arduino_pref 'build.pid')}
|
|
|
|
|
: ${BOOTLOADER_PID:=$(get_arduino_pref 'bootloader.pid')}
|
|
|
|
|
: ${BOOTLOADER_VID:=$(get_arduino_pref 'bootloader.vid')}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -96,7 +96,7 @@ reset_device_cmd() {
|
|
|
|
|
|
|
|
|
|
find_bootloader_ports() {
|
|
|
|
|
find_device_vid_pid
|
|
|
|
|
BOOTLOADER_VID="${BOOTLOADER_VID:-${VID}}"
|
|
|
|
|
: "${BOOTLOADER_VID:=${VID}}"
|
|
|
|
|
DEVICE_PORT_PROBER="${KALEIDOSCOPE_BIN_DIR}/find-device-port-linux-udev"
|
|
|
|
|
if [[ "${DEVICE_PORT_BOOTLOADER}" = "" ]]; then
|
|
|
|
|
DEVICE_PORT_BOOTLOADER="$(perl ${DEVICE_PORT_PROBER} ${BOOTLOADER_VID} ${BOOTLOADER_PID})"
|
|
|
|
@ -119,15 +119,15 @@ if [ "${uname_S}" = "Darwin" ]; then
|
|
|
|
|
/bin/stty -f ${DEVICE_PORT} 1200
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ARDUINO_PATH="${ARDUINO_PATH:-/Applications/Arduino.app/Contents/Java/}"
|
|
|
|
|
ARDUINO_PACKAGE_PATH="${ARDUINO_PACKAGE_PATH:-${HOME}/Library/Arduino15/packages}"
|
|
|
|
|
ARDUINO_LOCAL_LIB_PATH="${ARDUINO_LOCAL_LIB_PATH:-${HOME}/Documents/Arduino}"
|
|
|
|
|
: "${ARDUINO_PATH:=/Applications/Arduino.app/Contents/Java/}"
|
|
|
|
|
: "${ARDUINO_PACKAGE_PATH:=${HOME}/Library/Arduino15/packages}"
|
|
|
|
|
: "${ARDUINO_LOCAL_LIB_PATH:=${HOME}/Documents/Arduino}"
|
|
|
|
|
|
|
|
|
|
MD5="md5"
|
|
|
|
|
|
|
|
|
|
find_bootloader_ports() {
|
|
|
|
|
find_device_vid_pid
|
|
|
|
|
BOOTLOADER_VID="${BOOTLOADER_VID:-${VID}}"
|
|
|
|
|
: "${BOOTLOADER_VID:=${VID}}"
|
|
|
|
|
DEVICE_PORT_PROBER="${KALEIDOSCOPE_BIN_DIR}/find-device-port-macos"
|
|
|
|
|
if [[ "${DEVICE_PORT_BOOTLOADER}" = "" ]]; then
|
|
|
|
|
DEVICE_PORT_BOOTLOADER="$(perl ${DEVICE_PORT_PROBER} ${BOOTLOADER_VID} ${BOOTLOADER_PID})"
|
|
|
|
@ -148,12 +148,12 @@ elif [ "${uname_S}" = "FreeBSD" ]; then
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MD5="md5"
|
|
|
|
|
AVR_SIZE="${AVR_SIZE:-/usr/local/bin/avr-size}"
|
|
|
|
|
AVR_NM="${AVR_NM:-/usr/local/bin/avr-nm}"
|
|
|
|
|
AVR_OBJDUMP="${AVR_OBJDUMP:-/usr/local/bin/avr-objdump}"
|
|
|
|
|
AVRDUDE="${AVRDUDE:-/usr/local/bin/avrdude}"
|
|
|
|
|
AVRDUDE_CONF="${AVRDUDE_CONF:-/usr/local/etc/avrdude.conf}"
|
|
|
|
|
ARDUINO_BUILDER="${ARDUINO_BUILDER:-/usr/local/bin/arduino-builder}"
|
|
|
|
|
: "${AVR_SIZE:=/usr/local/bin/avr-size}"
|
|
|
|
|
: "${AVR_NM:=/usr/local/bin/avr-nm}"
|
|
|
|
|
: "${AVR_OBJDUMP:=/usr/local/bin/avr-objdump}"
|
|
|
|
|
: "${AVRDUDE:=/usr/local/bin/avrdude}"
|
|
|
|
|
: "${AVRDUDE_CONF:=/usr/local/etc/avrdude.conf}"
|
|
|
|
|
: "${ARDUINO_BUILDER:=/usr/local/bin/arduino-builder}"
|
|
|
|
|
|
|
|
|
|
find_bootloader_ports() {
|
|
|
|
|
DEVICE_PORT_PROBER="${KALEIDOSCPE_BIN_DIR}/find-device-port-freebsd"
|
|
|
|
@ -161,7 +161,7 @@ elif [ "${uname_S}" = "FreeBSD" ]; then
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if [ "${ARCH}" = "virtual" ]; then
|
|
|
|
|
COMPILER_PATH="${COMPILER_PATH:-/usr/local/bin/}"
|
|
|
|
|
: "${COMPILER_PATH:=/usr/local/bin/}"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
elif [ "${uname_O}" = "Cygwin" ]; then
|
|
|
|
@ -173,9 +173,9 @@ elif [ "${uname_O}" = "Cygwin" ]; then
|
|
|
|
|
#
|
|
|
|
|
# It's important that all of these be underneath /cygdrive/c so they can be converted to Windows paths that the
|
|
|
|
|
# Windows Arduino binaries can understand.
|
|
|
|
|
ARDUINO_PATH="${ARDUINO_PATH:-/cygdrive/c/Program\ Files\ (x86)/Arduino}"
|
|
|
|
|
ARDUINO_PACKAGE_PATH="${ARDUINO_PACKAGE_PATH:-/cygdrive/c/Users/${USER}/AppData/Local/Arduino15/packages}"
|
|
|
|
|
ARDUINO_LOCAL_LIB_PATH="${ARDUINO_LOCAL_LIB_PATH:-/cygdrive/c/Users/${USER}/Arduino}"
|
|
|
|
|
: "${ARDUINO_PATH:=/cygdrive/c/Program\ Files\ (x86)/Arduino}"
|
|
|
|
|
: "${ARDUINO_PACKAGE_PATH:=/cygdrive/c/Users/${USER}/AppData/Local/Arduino15/packages}"
|
|
|
|
|
: "${ARDUINO_LOCAL_LIB_PATH:=/cygdrive/c/Users/${USER}/Arduino}"
|
|
|
|
|
TMPDIR="${ARDUINO_LOCAL_LIB_PATH:-/cygdrive/c/Users/${USER}/AppData/Local/Temp}"
|
|
|
|
|
|
|
|
|
|
# We need to prevent Windows executables from being passed parameters that are absolute paths, since they won't
|
|
|
|
@ -207,7 +207,7 @@ elif [ "${uname_O}" = "Cygwin" ]; then
|
|
|
|
|
|
|
|
|
|
find_bootloader_ports() {
|
|
|
|
|
find_device_vid_pid
|
|
|
|
|
BOOTLOADER_VID="${BOOTLOADER_VID:-${VID}}"
|
|
|
|
|
: "${BOOTLOADER_VID:=${VID}}"
|
|
|
|
|
DEVICE_PORT_PROBER="${KALEIDOSCOPE_BIN_DIR}/find-device-port-windows.ps1"
|
|
|
|
|
DEVICE_PORT_BOOTLOADER="$(powershell -noprofile -executionpolicy bypass ${DEVICE_PORT_PROBER} ${BOOTLOADER_VID} ${BOOTLOADER_PID} -Format COM)"
|
|
|
|
|
}
|
|
|
|
@ -218,12 +218,12 @@ fi
|
|
|
|
|
###### Arduino tools configuration
|
|
|
|
|
######
|
|
|
|
|
|
|
|
|
|
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_PACKAGE_PATH="${ARDUINO_PACKAGE_PATH:-${HOME}/.arduino15/packages}"
|
|
|
|
|
: "${ARDUINO_PATH:=/usr/local/arduino}"
|
|
|
|
|
: "${ARDUINO_LOCAL_LIB_PATH:=${HOME}/Arduino}"
|
|
|
|
|
: "${ARDUINO_TOOLS_PATH:=${ARDUINO_PATH}/hardware/tools}"
|
|
|
|
|
: "${ARDUINO_PACKAGE_PATH:=${HOME}/.arduino15/packages}"
|
|
|
|
|
|
|
|
|
|
ARDUINO_BUILDER="${ARDUINO_BUILDER:-${ARDUINO_PATH}/arduino-builder}"
|
|
|
|
|
: "${ARDUINO_BUILDER:=${ARDUINO_PATH}/arduino-builder}"
|
|
|
|
|
ARDUINO_IDE_VERSION="10607"
|
|
|
|
|
|
|
|
|
|
######
|
|
|
|
@ -231,7 +231,7 @@ ARDUINO_IDE_VERSION="10607"
|
|
|
|
|
######
|
|
|
|
|
|
|
|
|
|
# Allow the compiler path to be empty for virtual builds
|
|
|
|
|
COMPILER_PATH="${COMPILER_PATH-${ARDUINO_TOOLS_PATH}/avr/bin/}"
|
|
|
|
|
: "${COMPILER_PATH=${ARDUINO_TOOLS_PATH}/avr/bin/}"
|
|
|
|
|
|
|
|
|
|
COMPILER_SUFFIX=""
|
|
|
|
|
|
|
|
|
@ -242,25 +242,25 @@ OBJCOPY_BASENAME=$(basename ${OBJCOPY:-objcopy})
|
|
|
|
|
|
|
|
|
|
# Allow the compiler prefix to be empty for virtual builds
|
|
|
|
|
COMPILER_PREFIX="${COMPILER_PREFIX-avr-}"
|
|
|
|
|
AVR_SIZE="${AVR_SIZE:-${COMPILER_PATH}/${COMPILER_PREFIX}size}"
|
|
|
|
|
AVR_SIZE_FLAGS="${AVR_SIZE_FLAGS:--C --mcu=${MCU}}"
|
|
|
|
|
AVR_OBJDUMP="${AVR_OBJDUMP:-${COMPILER_PATH}/${COMPILER_PREFIX}objdump}"
|
|
|
|
|
AVR_OBJCOPY="${AVR_OBJCOPY:-${COMPILER_PATH}/${COMPILER_PREFIX}objcopy}"
|
|
|
|
|
AVR_NM="${AVR_NM:-${COMPILER_PATH}/${COMPILER_PREFIX}nm}"
|
|
|
|
|
AVR_AR="${AVR_AR:-${COMPILER_PATH}/${COMPILER_PREFIX}ar}"
|
|
|
|
|
AVR_GCC="${AVR_GCC:-${COMPILER_PATH}/${COMPILER_PREFIX}${C_COMPILER_BASENAME}}"
|
|
|
|
|
: "${AVR_SIZE:=${COMPILER_PATH}/${COMPILER_PREFIX}size}"
|
|
|
|
|
: "${AVR_SIZE_FLAGS:=-C --mcu=${MCU}}"
|
|
|
|
|
: "${AVR_OBJDUMP:=${COMPILER_PATH}/${COMPILER_PREFIX}objdump}"
|
|
|
|
|
: "${AVR_OBJCOPY:=${COMPILER_PATH}/${COMPILER_PREFIX}objcopy}"
|
|
|
|
|
: "${AVR_NM:=${COMPILER_PATH}/${COMPILER_PREFIX}nm}"
|
|
|
|
|
: "${AVR_AR:=${COMPILER_PATH}/${COMPILER_PREFIX}ar}"
|
|
|
|
|
: "${AVR_GCC:=${COMPILER_PATH}/${COMPILER_PREFIX}${C_COMPILER_BASENAME}}"
|
|
|
|
|
AVR_GPLUSPLUS="${AVR_GCC:-${COMPILER_PATH}/${COMPILER_PREFIX}${CXX_COMPILER_BASENAME}}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AVRDUDE="${AVRDUDE:-${ARDUINO_TOOLS_PATH}/avr/bin/avrdude}"
|
|
|
|
|
AVRDUDE_CONF="${AVRDUDE_CONF:-${ARDUINO_TOOLS_PATH}/avr/etc/avrdude.conf}"
|
|
|
|
|
: "${AVRDUDE:=${ARDUINO_TOOLS_PATH}/avr/bin/avrdude}"
|
|
|
|
|
: "${AVRDUDE_CONF:=${ARDUINO_TOOLS_PATH}/avr/etc/avrdude.conf}"
|
|
|
|
|
|
|
|
|
|
######
|
|
|
|
|
###### Source files and dependencies
|
|
|
|
|
######
|
|
|
|
|
|
|
|
|
|
BOARD_HARDWARE_PATH="${BOARD_HARDWARE_PATH:-${ARDUINO_LOCAL_LIB_PATH}/hardware}"
|
|
|
|
|
: "${BOARD_HARDWARE_PATH:=${ARDUINO_LOCAL_LIB_PATH}/hardware}"
|
|
|
|
|
|
|
|
|
|
if [ ! -z "${ARDUINO_TOOLS_PATH}" ]; then
|
|
|
|
|
ARDUINO_TOOLS_PARAM="${ARDUINO_TOOLS_PATH}"
|
|
|
|
|