|
|
|
@ -47,8 +47,6 @@ else
|
|
|
|
|
: "${ARDUINO_CLI:=${SYSTEM_ARDUINO_CLI}}"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
: "${ARDUINO_CONTENT:=${KALEIDOSCOPE_DIR}/.arduino}"
|
|
|
|
|
: "${ARDUINO_DIRECTORIES_DATA:=${ARDUINO_CONTENT}/data}"
|
|
|
|
|
: "${ARDUINO_DIRECTORIES_DOWNLOADS:=${ARDUINO_CONTENT}/downloads}"
|
|
|
|
@ -57,7 +55,6 @@ fi
|
|
|
|
|
: "${ARDUINO_BOARDS_MANAGER_KALEIDOSCOPE:=https://raw.githubusercontent.com/keyboardio/boardsmanager/master/package_keyboardio_index.json}"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
install_arduino_cli() {
|
|
|
|
|
# todo cd to kaleidoscope dir
|
|
|
|
|
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
|
|
|
|
@ -90,7 +87,6 @@ install_arduino_core() {
|
|
|
|
|
run_arduino_cli core install "$1"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
run_arduino_cli() {
|
|
|
|
|
ARDUINO_DIRECTORIES_USER=${ARDUINO_DIRECTORIES_USER} \
|
|
|
|
|
ARDUINO_DIRECTORIES_DATA=${ARDUINO_DIRECTORIES_DATA} \
|
|
|
|
@ -101,8 +97,14 @@ run_arduino_cli() {
|
|
|
|
|
|
|
|
|
|
build_version() {
|
|
|
|
|
: "${LIB_PROPERTIES_PATH:="../.."}"
|
|
|
|
|
GIT_VERSION="$(cd "${SKETCH_DIR}"; if [ -d .git ]; then echo -n '-g' && git describe --abbrev=4 --dirty --always; fi)"
|
|
|
|
|
LIB_VERSION="$(cd "${SKETCH_DIR}"; (grep version= "${LIB_PROPERTIES_PATH}/library.properties" 2>/dev/null || echo version=0.0.0) | cut -d= -f2)${GIT_VERSION}"
|
|
|
|
|
GIT_VERSION="$(
|
|
|
|
|
cd "${SKETCH_DIR}"
|
|
|
|
|
if [ -d .git ]; then echo -n '-g' && git describe --abbrev=4 --dirty --always; fi
|
|
|
|
|
)"
|
|
|
|
|
LIB_VERSION="$(
|
|
|
|
|
cd "${SKETCH_DIR}"
|
|
|
|
|
(grep version= "${LIB_PROPERTIES_PATH}/library.properties" 2>/dev/null || echo version=0.0.0) | cut -d= -f2
|
|
|
|
|
)${GIT_VERSION}"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
build_paths() {
|
|
|
|
@ -135,7 +137,6 @@ build_filenames () {
|
|
|
|
|
: "${LIB_FILE_PATH:=${OUTPUT_PATH}/${OUTPUT_FILE_PREFIX}.a}"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enable_ccache() {
|
|
|
|
|
if [ -z "${CCACHE_NOT_SUPPORTED}" ] && [ "$(command -v ccache)" ]; then
|
|
|
|
|
if ! [ -d "$CCACHE_WRAPPER_PATH" ]; then
|
|
|
|
@ -172,7 +173,6 @@ enable_ccache () {
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
firmware_size() {
|
|
|
|
|
if [ "${ARCH}" = "virtual" ]; then
|
|
|
|
|
echo "[Size not computed for virtual build]"
|
|
|
|
@ -203,7 +203,6 @@ firmware_size () {
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
find_sketch() {
|
|
|
|
|
SKETCH_DIR="${SKETCH:-$(absolute_filename "$(pwd)")}"
|
|
|
|
|
SKETCH_BASE_NAME=$(basename "${SKETCH_DIR}")
|
|
|
|
@ -224,7 +223,6 @@ find_sketch () {
|
|
|
|
|
exit 1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
find_device_vid_pid() {
|
|
|
|
|
: "${VID:=$(get_arduino_pref 'build.vid')}"
|
|
|
|
|
: "${SKETCH_PID:=$(get_arduino_pref 'build.pid')}"
|
|
|
|
@ -232,7 +230,6 @@ find_device_vid_pid() {
|
|
|
|
|
: "${BOOTLOADER_VID:=$(get_arduino_pref 'bootloader.vid')}"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
prompt_before_flashing() {
|
|
|
|
|
flashing_instructions=$(get_arduino_pref 'build.flashing_instructions')
|
|
|
|
|
|
|
|
|
@ -335,7 +332,6 @@ check_bootloader_port_and_flash () {
|
|
|
|
|
return 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flash_from_bootloader() {
|
|
|
|
|
compile "$@"
|
|
|
|
|
prompt_before_flashing
|
|
|
|
@ -395,7 +391,6 @@ build () {
|
|
|
|
|
size "$@"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
prepare_ccache() {
|
|
|
|
|
find_sketch
|
|
|
|
|
build_paths
|
|
|
|
@ -419,8 +414,6 @@ compile () {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set_executable_paths() {
|
|
|
|
|
######
|
|
|
|
|
###### Executable paths
|
|
|
|
@ -451,7 +444,6 @@ AVRDUDE_CMD="${AVRDUDE} -v-C \"${AVRDUDE_CONF}\" -D -p\"$(get_arduino_pref 'buil
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
do_compile() {
|
|
|
|
|
prepare_ccache
|
|
|
|
|
|
|
|
|
@ -463,7 +455,6 @@ do_compile () {
|
|
|
|
|
# shellcheck disable=SC2154
|
|
|
|
|
${compile_HOOKS}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SAVED_BOARD="${BOARD}"
|
|
|
|
|
SAVED_FQBN="${FQBN}"
|
|
|
|
|
if [ -e "${SKETCH_DIR}/.kaleidoscope-builder.conf" ]; then
|
|
|
|
@ -477,7 +468,6 @@ do_compile () {
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
do_compile_with_cli
|
|
|
|
|
|
|
|
|
|
if [ -z "${LIBONLY}" ]; then
|
|
|
|
@ -491,7 +481,7 @@ do_compile () {
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ "${ARDUINO_VERBOSE}" == "--verbose" ]; then
|
|
|
|
|
echo "Build artifacts can be found in ${BUILD_PATH}";
|
|
|
|
|
echo "Build artifacts can be found in ${BUILD_PATH}"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
BOARD="${SAVED_BOARD}"
|
|
|
|
@ -505,7 +495,6 @@ get_arduino_pref() {
|
|
|
|
|
echo "$MESSAGE"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dump_arduino_prefs() {
|
|
|
|
|
if [ "x${_ARDUINO_PREFS}x" == "xx" ]; then
|
|
|
|
|
_ARDUINO_PREFS=$(run_arduino_cli --fqbn "${FQBN}" compile --show-properties "${SKETCH_FILE_PATH}")
|
|
|
|
@ -513,7 +502,6 @@ dump_arduino_prefs() {
|
|
|
|
|
echo "$_ARDUINO_PREFS"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
do_compile_with_cli() {
|
|
|
|
|
#-build-cache "${CORE_CACHE_PATH}" \
|
|
|
|
|
|
|
|
|
@ -541,7 +529,6 @@ do_compile_with_cli() {
|
|
|
|
|
"${SKETCH_FILE_PATH}"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
find_all_sketches() {
|
|
|
|
|
for sketch_name in ./*.ino \
|
|
|
|
|
$([ -d examples ] && find examples -name '*.ino') \
|
|
|
|
@ -571,7 +558,6 @@ build_all () {
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
size() {
|
|
|
|
|
compile
|
|
|
|
|
|
|
|
|
@ -667,7 +653,6 @@ EOF
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
usage() {
|
|
|
|
|
cat <<-EOF
|
|
|
|
|
Usage: $0 SKETCH commands...
|
|
|
|
@ -715,15 +700,16 @@ if [ $# -lt 1 ]; then
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Temporary migration for old makefiles
|
|
|
|
|
# I'm not thrilled about how we default to system Arduino dirs.
|
|
|
|
|
if [ -n "${BOARD_HARDWARE_PATH}" ]; then
|
|
|
|
|
ARDUINO_DIRECTORIES_USER="${BOARD_HARDWARE_PATH}/../"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
: "${KALEIDOSCOPE_DIR:=$(cd "$(dirname "$0")"/..; pwd)}"
|
|
|
|
|
: "${KALEIDOSCOPE_DIR:=$(
|
|
|
|
|
cd "$(dirname "$0")"/..
|
|
|
|
|
pwd
|
|
|
|
|
)}"
|
|
|
|
|
# shellcheck disable=SC2034
|
|
|
|
|
: "${KALEIDOSCOPE_BIN_DIR:=${KALEIDOSCOPE_DIR}/bin/}"
|
|
|
|
|
|
|
|
|
@ -738,7 +724,6 @@ else
|
|
|
|
|
ARDUINO_VERBOSE="--quiet"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Parse the command-line
|
|
|
|
|
## - anything that has a =, is an env var
|
|
|
|
|
## - from the remaining stuff, the first one is the Library/Sketch
|
|
|
|
@ -746,7 +731,6 @@ fi
|
|
|
|
|
##
|
|
|
|
|
## - if there is only one argument, that's a command
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmds=""
|
|
|
|
|
|
|
|
|
|
## Export vars
|
|
|
|
|