|
|
@ -61,31 +61,31 @@ enable_ccache () {
|
|
|
|
if ! [ -d "$CCACHE_WRAPPER_PATH" ]; then
|
|
|
|
if ! [ -d "$CCACHE_WRAPPER_PATH" ]; then
|
|
|
|
mkdir -p "$CCACHE_WRAPPER_PATH"
|
|
|
|
mkdir -p "$CCACHE_WRAPPER_PATH"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if ! [ -h "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}${C_COMPILER_BASENAME}" ]; then
|
|
|
|
if ! [ -h "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}${C_COMPILER_BASENAME}" ]; then
|
|
|
|
ln -s "$(command -v ccache)" "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}${C_COMPILER_BASENAME}"
|
|
|
|
ln -s "$(command -v ccache)" "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}${C_COMPILER_BASENAME}"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if ! [ -h "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}${CXX_COMPILER_BASENAME}" ]; then
|
|
|
|
if ! [ -h "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}${CXX_COMPILER_BASENAME}" ]; then
|
|
|
|
ln -s "$(command -v ccache)" "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}${CXX_COMPILER_BASENAME}"
|
|
|
|
ln -s "$(command -v ccache)" "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}${CXX_COMPILER_BASENAME}"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if ! [ -h "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}nm" ]; then
|
|
|
|
if ! [ -h "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}nm" ]; then
|
|
|
|
ln -s "${AVR_NM}" "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}nm"
|
|
|
|
ln -s "${AVR_NM}" "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}nm"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if ! [ -h "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}objcopy" ]; then
|
|
|
|
if ! [ -h "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}objcopy" ]; then
|
|
|
|
ln -s "${AVR_OBJCOPY}" "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}objcopy"
|
|
|
|
ln -s "${AVR_OBJCOPY}" "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}objcopy"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if ! [ -h "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}ar" ]; then
|
|
|
|
if ! [ -h "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}ar" ]; then
|
|
|
|
ln -s "${AVR_AR}" "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}ar"
|
|
|
|
ln -s "${AVR_AR}" "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}ar"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if ! [ -h "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}size" ]; then
|
|
|
|
if ! [ -h "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}size" ]; then
|
|
|
|
ln -s "${AVR_SIZE}" "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}size"
|
|
|
|
ln -s "${AVR_SIZE}" "${CCACHE_WRAPPER_PATH}/${COMPILER_PREFIX}size"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
export CCACHE_PATH=${COMPILER_PATH}/
|
|
|
|
export CCACHE_PATH=${COMPILER_PATH}/
|
|
|
|
CCACHE_ENABLE="-prefs compiler.path=${CCACHE_WRAPPER_PATH}/"
|
|
|
|
CCACHE_ENABLE="-prefs compiler.path=${CCACHE_WRAPPER_PATH}/"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
@ -163,16 +163,16 @@ prompt_before_flashing () {
|
|
|
|
flash () {
|
|
|
|
flash () {
|
|
|
|
maybe_build "$@"
|
|
|
|
maybe_build "$@"
|
|
|
|
|
|
|
|
|
|
|
|
# Check to see if we can see a keyboard bootloader port.
|
|
|
|
# Check to see if we can see a keyboard bootloader port.
|
|
|
|
# If we -can-, then we should skip over the "reset to bootloader" thing
|
|
|
|
# If we -can-, then we should skip over the "reset to bootloader" thing
|
|
|
|
find_bootloader_ports
|
|
|
|
find_bootloader_ports
|
|
|
|
if [ -z "${DEVICE_PORT_BOOTLOADER}" ]; then
|
|
|
|
if [ -z "${DEVICE_PORT_BOOTLOADER}" ]; then
|
|
|
|
prompt_before_flashing
|
|
|
|
prompt_before_flashing
|
|
|
|
|
|
|
|
|
|
|
|
# This is defined in the (optional) user config.
|
|
|
|
# This is defined in the (optional) user config.
|
|
|
|
# shellcheck disable=SC2154
|
|
|
|
# shellcheck disable=SC2154
|
|
|
|
${preFlash_HOOKS}
|
|
|
|
${preFlash_HOOKS}
|
|
|
|
|
|
|
|
|
|
|
|
# If we're -not- doing a manual reset, then try to do it automatically
|
|
|
|
# If we're -not- doing a manual reset, then try to do it automatically
|
|
|
|
if [ -z "${MANUAL_RESET}" ]; then
|
|
|
|
if [ -z "${MANUAL_RESET}" ]; then
|
|
|
|
reset_device
|
|
|
|
reset_device
|
|
|
@ -195,7 +195,7 @@ flash () {
|
|
|
|
wait_for_bootloader_port() {
|
|
|
|
wait_for_bootloader_port() {
|
|
|
|
declare -i tries
|
|
|
|
declare -i tries
|
|
|
|
tries=15
|
|
|
|
tries=15
|
|
|
|
|
|
|
|
|
|
|
|
while [ "$tries" -gt 0 ] && [ -z "${DEVICE_PORT_BOOTLOADER}" ]; do
|
|
|
|
while [ "$tries" -gt 0 ] && [ -z "${DEVICE_PORT_BOOTLOADER}" ]; do
|
|
|
|
sleep 1
|
|
|
|
sleep 1
|
|
|
|
printf "."
|
|
|
|
printf "."
|
|
|
@ -204,12 +204,12 @@ wait_for_bootloader_port() {
|
|
|
|
# shellcheck disable=SC2004
|
|
|
|
# shellcheck disable=SC2004
|
|
|
|
tries=$(($tries-1))
|
|
|
|
tries=$(($tries-1))
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$tries" -gt 0 ]; then
|
|
|
|
if [ "$tries" -gt 0 ]; then
|
|
|
|
echo "Found."
|
|
|
|
echo "Found."
|
|
|
|
else
|
|
|
|
else
|
|
|
|
echo "Timed out."
|
|
|
|
echo "Timed out."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
check_bootloader_port () {
|
|
|
|
check_bootloader_port () {
|
|
|
@ -227,11 +227,11 @@ check_bootloader_port_and_flash () {
|
|
|
|
if ! check_bootloader_port; then
|
|
|
|
if ! check_bootloader_port; then
|
|
|
|
return 1
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
echo "Flashing your keyboard:"
|
|
|
|
echo "Flashing your keyboard:"
|
|
|
|
|
|
|
|
|
|
|
|
# If the flash fails, try a second time
|
|
|
|
# If the flash fails, try a second time
|
|
|
|
if ! flash_over_usb; then
|
|
|
|
if ! flash_over_usb; then
|
|
|
|
sleep 2
|
|
|
|
sleep 2
|
|
|
|
if ! flash_over_usb; then
|
|
|
|
if ! flash_over_usb; then
|
|
|
|
if [ "${ARDUINO_VERBOSE}" != "-verbose" ]; then
|
|
|
|
if [ "${ARDUINO_VERBOSE}" != "-verbose" ]; then
|
|
|
@ -341,7 +341,7 @@ compile () {
|
|
|
|
enable_ccache
|
|
|
|
enable_ccache
|
|
|
|
|
|
|
|
|
|
|
|
install -d "${OUTPUT_PATH}"
|
|
|
|
install -d "${OUTPUT_PATH}"
|
|
|
|
|
|
|
|
|
|
|
|
SKETCH_DIR="$(find_sketch)"
|
|
|
|
SKETCH_DIR="$(find_sketch)"
|
|
|
|
|
|
|
|
|
|
|
|
echo "Building ${SKETCH_DIR}/${SKETCH} ${LIB_VERSION} into ${OUTPUT_PATH}"
|
|
|
|
echo "Building ${SKETCH_DIR}/${SKETCH} ${LIB_VERSION} into ${OUTPUT_PATH}"
|
|
|
@ -362,7 +362,7 @@ compile () {
|
|
|
|
# We want literal backslashes here, not arrays.
|
|
|
|
# We want literal backslashes here, not arrays.
|
|
|
|
ARDUINO_PACKAGES="-hardware \"${ARDUINO_PACKAGE_PATH}\""
|
|
|
|
ARDUINO_PACKAGES="-hardware \"${ARDUINO_PACKAGE_PATH}\""
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
SAVED_BOARD="${BOARD}"
|
|
|
|
SAVED_BOARD="${BOARD}"
|
|
|
|
SAVED_FQBN="${FQBN}"
|
|
|
|
SAVED_FQBN="${FQBN}"
|
|
|
|
if [ -e "${SKETCH_DIR}/.kaleidoscope-builder.conf" ]; then
|
|
|
|
if [ -e "${SKETCH_DIR}/.kaleidoscope-builder.conf" ]; then
|
|
|
|