|
|
|
@ -25,7 +25,7 @@ absolute_filename() {
|
|
|
|
|
|
|
|
|
|
read_conf_files() {
|
|
|
|
|
|
|
|
|
|
for conf_file in \
|
|
|
|
|
for conf_file in \
|
|
|
|
|
"${HOME}/.kaleidoscope-builder.conf" \
|
|
|
|
|
"$(pwd)/.kaleidoscope-builder.conf" \
|
|
|
|
|
"$(pwd)/kaleidoscope-builder.conf" \
|
|
|
|
@ -35,29 +35,26 @@ for conf_file in \
|
|
|
|
|
. "${conf_file}"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
done
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
configure_arduino_cli_env() {
|
|
|
|
|
|
|
|
|
|
SYSTEM_ARDUINO_CLI="$(command -v arduino-cli || true )"
|
|
|
|
|
SYSTEM_ARDUINO_CLI="$(command -v arduino-cli || true)"
|
|
|
|
|
|
|
|
|
|
if [ -z "${SYSTEM_ARDUINO_CLI}" ]; then
|
|
|
|
|
if [ -z "${SYSTEM_ARDUINO_CLI}" ]; then
|
|
|
|
|
: "${ARDUINO_CLI:=${KALEIDOSCOPE_BIN_DIR}/arduino-cli}"
|
|
|
|
|
else
|
|
|
|
|
else
|
|
|
|
|
: "${ARDUINO_CLI:=${SYSTEM_ARDUINO_CLI}}"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
: "${ARDUINO_CONTENT:=${KALEIDOSCOPE_DIR}/.arduino}"
|
|
|
|
|
: "${ARDUINO_DIRECTORIES_DATA:=${ARDUINO_CONTENT}/data}"
|
|
|
|
|
: "${ARDUINO_DIRECTORIES_DOWNLOADS:=${ARDUINO_CONTENT}/downloads}"
|
|
|
|
|
: "${ARDUINO_DIRECTORIES_USER:=${ARDUINO_CONTENT}/user}"
|
|
|
|
|
: "${ARDUINO_CLI_CONFIG:=${ARDUINO_DIRECTORIES_DATA}/arduino-cli.yaml}"
|
|
|
|
|
: "${ARDUINO_BOARDS_MANAGER_KALEIDOSCOPE:=https://raw.githubusercontent.com/keyboardio/boardsmanager/master/package_keyboardio_index.json}"
|
|
|
|
|
: "${ARDUINO_CONTENT:=${KALEIDOSCOPE_DIR}/.arduino}"
|
|
|
|
|
: "${ARDUINO_DIRECTORIES_DATA:=${ARDUINO_CONTENT}/data}"
|
|
|
|
|
: "${ARDUINO_DIRECTORIES_DOWNLOADS:=${ARDUINO_CONTENT}/downloads}"
|
|
|
|
|
: "${ARDUINO_DIRECTORIES_USER:=${ARDUINO_CONTENT}/user}"
|
|
|
|
|
: "${ARDUINO_CLI_CONFIG:=${ARDUINO_DIRECTORIES_DATA}/arduino-cli.yaml}"
|
|
|
|
|
: "${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} \
|
|
|
|
@ -99,10 +95,16 @@ run_arduino_cli() {
|
|
|
|
|
"${ARDUINO_CLI}" "$@"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
build_version () {
|
|
|
|
|
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() {
|
|
|
|
@ -127,7 +129,7 @@ build_paths() {
|
|
|
|
|
mkdir -p "$BUILD_PATH"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
build_filenames () {
|
|
|
|
|
build_filenames() {
|
|
|
|
|
: "${OUTPUT_FILE_PREFIX:=${SKETCH_BASE_NAME}-${LIB_VERSION}}"
|
|
|
|
|
: "${HEX_FILE_PATH:=${OUTPUT_PATH}/${OUTPUT_FILE_PREFIX}.hex}"
|
|
|
|
|
: "${HEX_FILE_WITH_BOOTLOADER_PATH:=${OUTPUT_PATH}/${OUTPUT_FILE_PREFIX}-with-bootloader.hex}"
|
|
|
|
@ -135,8 +137,7 @@ build_filenames () {
|
|
|
|
|
: "${LIB_FILE_PATH:=${OUTPUT_PATH}/${OUTPUT_FILE_PREFIX}.a}"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enable_ccache () {
|
|
|
|
|
enable_ccache() {
|
|
|
|
|
if [ -z "${CCACHE_NOT_SUPPORTED}" ] && [ "$(command -v ccache)" ]; then
|
|
|
|
|
if ! [ -d "$CCACHE_WRAPPER_PATH" ]; then
|
|
|
|
|
mkdir -p "$CCACHE_WRAPPER_PATH"
|
|
|
|
@ -172,8 +173,7 @@ enable_ccache () {
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
firmware_size () {
|
|
|
|
|
firmware_size() {
|
|
|
|
|
if [ "${ARCH}" = "virtual" ]; then
|
|
|
|
|
echo "[Size not computed for virtual build]"
|
|
|
|
|
return
|
|
|
|
@ -184,12 +184,12 @@ firmware_size () {
|
|
|
|
|
## This is a terrible hack, please don't hurt me. - algernon
|
|
|
|
|
|
|
|
|
|
set +e
|
|
|
|
|
raw_output=$("$@" 2> /dev/null)
|
|
|
|
|
raw_output=$("$@" 2>/dev/null)
|
|
|
|
|
rc=$?
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
|
|
if [ $rc -eq 0 ]; then
|
|
|
|
|
output="$(echo "${raw_output}"| grep "\\(Program\\|Data\\):" | sed -e 's,^, - ,' && echo)"
|
|
|
|
|
output="$(echo "${raw_output}" | grep "\\(Program\\|Data\\):" | sed -e 's,^, - ,' && echo)"
|
|
|
|
|
|
|
|
|
|
PROGSIZE="$(echo "${output}" | grep "Program:" | cut -d: -f2 | awk '{print $1}')"
|
|
|
|
|
|
|
|
|
@ -203,8 +203,7 @@ firmware_size () {
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
find_sketch () {
|
|
|
|
|
find_sketch() {
|
|
|
|
|
SKETCH_DIR="${SKETCH:-$(absolute_filename "$(pwd)")}"
|
|
|
|
|
SKETCH_BASE_NAME=$(basename "${SKETCH_DIR}")
|
|
|
|
|
SKETCH_FILE_NAME="${SKETCH_BASE_NAME}.ino"
|
|
|
|
@ -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,8 +230,7 @@ find_device_vid_pid() {
|
|
|
|
|
: "${BOOTLOADER_VID:=$(get_arduino_pref 'bootloader.vid')}"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
prompt_before_flashing () {
|
|
|
|
|
prompt_before_flashing() {
|
|
|
|
|
flashing_instructions=$(get_arduino_pref 'build.flashing_instructions')
|
|
|
|
|
|
|
|
|
|
if [ "x${flashing_instructions}x" = "xx" ]; then
|
|
|
|
@ -249,7 +246,7 @@ prompt_before_flashing () {
|
|
|
|
|
read
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
flash () {
|
|
|
|
|
flash() {
|
|
|
|
|
compile "$@"
|
|
|
|
|
|
|
|
|
|
# Check to see if we can see a keyboard bootloader port.
|
|
|
|
@ -291,7 +288,7 @@ wait_for_bootloader_port() {
|
|
|
|
|
find_bootloader_ports
|
|
|
|
|
# the variable annotations do appear to be necessary
|
|
|
|
|
# shellcheck disable=SC2004
|
|
|
|
|
tries=$(($tries-1))
|
|
|
|
|
tries=$(($tries - 1))
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
if [ "$tries" -gt 0 ]; then
|
|
|
|
@ -301,7 +298,7 @@ wait_for_bootloader_port() {
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
check_bootloader_port () {
|
|
|
|
|
check_bootloader_port() {
|
|
|
|
|
if [ -z "${DEVICE_PORT_BOOTLOADER}" ]; then
|
|
|
|
|
echo "Unable to detect a keyboard in bootloader mode."
|
|
|
|
|
echo "You may need to hold a key or hit a reset button."
|
|
|
|
@ -311,7 +308,7 @@ check_bootloader_port () {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
check_bootloader_port_and_flash () {
|
|
|
|
|
check_bootloader_port_and_flash() {
|
|
|
|
|
|
|
|
|
|
if ! check_bootloader_port; then
|
|
|
|
|
return 1
|
|
|
|
@ -335,7 +332,6 @@ check_bootloader_port_and_flash () {
|
|
|
|
|
return 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flash_from_bootloader() {
|
|
|
|
|
compile "$@"
|
|
|
|
|
prompt_before_flashing
|
|
|
|
@ -356,14 +352,14 @@ flash_with_programmer() {
|
|
|
|
|
"-Uflash:w:${HEX_FILE_PATH}:i"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
flash_over_usb () {
|
|
|
|
|
FLASH_CMD=$( ${AVRDUDE_CMD} \
|
|
|
|
|
flash_over_usb() {
|
|
|
|
|
FLASH_CMD=$(${AVRDUDE_CMD} \
|
|
|
|
|
-cavr109 \
|
|
|
|
|
-P "${DEVICE_PORT_BOOTLOADER}" \
|
|
|
|
|
-b57600 \
|
|
|
|
|
"-Uflash:w:${HEX_FILE_PATH}:i")
|
|
|
|
|
if [ "${ARDUINO_VERBOSE}" != "--verbose" ]; then
|
|
|
|
|
${FLASH_CMD} 2>&1 |grep -v ^avrdude | grep -v '^$' |grep -v '^ ' | grep -vi programmer
|
|
|
|
|
${FLASH_CMD} 2>&1 | grep -v ^avrdude | grep -v '^$' | grep -v '^ ' | grep -vi programmer
|
|
|
|
|
return "${PIPESTATUS[0]}"
|
|
|
|
|
else
|
|
|
|
|
${FLASH_CMD}
|
|
|
|
@ -371,16 +367,16 @@ flash_over_usb () {
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
hex_with_bootloader () {
|
|
|
|
|
hex_with_bootloader() {
|
|
|
|
|
compile
|
|
|
|
|
|
|
|
|
|
: "${BOOTLOADER_PATH:=$( get_arduino_pref 'runtime.platform.path' )/bootloaders/$( get_arduino_pref 'bootloader.file' )}"
|
|
|
|
|
: "${BOOTLOADER_PATH:=$(get_arduino_pref 'runtime.platform.path')/bootloaders/$(get_arduino_pref 'bootloader.file')}"
|
|
|
|
|
|
|
|
|
|
awk '/^:00000001FF/ == 0' "${HEX_FILE_PATH}" > "${HEX_FILE_WITH_BOOTLOADER_PATH}"
|
|
|
|
|
awk '/^:00000001FF/ == 0' "${HEX_FILE_PATH}" >"${HEX_FILE_WITH_BOOTLOADER_PATH}"
|
|
|
|
|
echo "Using ${BOOTLOADER_PATH}"
|
|
|
|
|
cat "${BOOTLOADER_PATH}" >> "${HEX_FILE_WITH_BOOTLOADER_PATH}"
|
|
|
|
|
cat "${BOOTLOADER_PATH}" >>"${HEX_FILE_WITH_BOOTLOADER_PATH}"
|
|
|
|
|
ln -sf -- "${OUTPUT_FILE_PREFIX}-with-bootloader.hex" "${OUTPUT_PATH}/${SKETCH_BASE_NAME}-latest-with-bootloader.hex"
|
|
|
|
|
cat <<- EOF
|
|
|
|
|
cat <<-EOF
|
|
|
|
|
|
|
|
|
|
Combined firmware and bootloader are now at ${HEX_FILE_WITH_BOOTLOADER_PATH}
|
|
|
|
|
Make sure you have the bootloader version you expect.
|
|
|
|
@ -390,18 +386,17 @@ hex_with_bootloader () {
|
|
|
|
|
EOF
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
build () {
|
|
|
|
|
build() {
|
|
|
|
|
compile "$@"
|
|
|
|
|
size "$@"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
prepare_ccache () {
|
|
|
|
|
prepare_ccache() {
|
|
|
|
|
find_sketch
|
|
|
|
|
build_paths
|
|
|
|
|
enable_ccache
|
|
|
|
|
}
|
|
|
|
|
compile () {
|
|
|
|
|
compile() {
|
|
|
|
|
find_sketch
|
|
|
|
|
set_executable_paths
|
|
|
|
|
build_version
|
|
|
|
@ -419,40 +414,37 @@ compile () {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set_executable_paths() {
|
|
|
|
|
######
|
|
|
|
|
###### Executable paths
|
|
|
|
|
######
|
|
|
|
|
|
|
|
|
|
# Allow the compiler path to be empty for virtual builds
|
|
|
|
|
# should use compiler.path instead of appending bin, but we don't have substitution het
|
|
|
|
|
: "${COMPILER_PATH=$(get_arduino_pref 'runtime.tools.avr-gcc.path')/bin}"
|
|
|
|
|
|
|
|
|
|
set_executable_paths () {
|
|
|
|
|
######
|
|
|
|
|
###### Executable paths
|
|
|
|
|
######
|
|
|
|
|
|
|
|
|
|
# Allow the compiler path to be empty for virtual builds
|
|
|
|
|
# should use compiler.path instead of appending bin, but we don't have substitution het
|
|
|
|
|
: "${COMPILER_PATH=$(get_arduino_pref 'runtime.tools.avr-gcc.path')/bin}"
|
|
|
|
|
|
|
|
|
|
COMPILER_SUFFIX=""
|
|
|
|
|
COMPILER_SUFFIX=""
|
|
|
|
|
|
|
|
|
|
C_COMPILER_BASENAME=$(basename "${CC:-gcc}")
|
|
|
|
|
CXX_COMPILER_BASENAME=$(basename "${CXX:-g++}")
|
|
|
|
|
AR_BASENAME=$(basename "${AR:-ar}")
|
|
|
|
|
C_COMPILER_BASENAME=$(basename "${CC:-gcc}")
|
|
|
|
|
CXX_COMPILER_BASENAME=$(basename "${CXX:-g++}")
|
|
|
|
|
AR_BASENAME=$(basename "${AR:-ar}")
|
|
|
|
|
|
|
|
|
|
# Allow the compiler prefix to be empty for virtual builds
|
|
|
|
|
COMPILER_PREFIX="${COMPILER_PREFIX-avr-}"
|
|
|
|
|
: "${AVR_SIZE:=${COMPILER_PATH}/${COMPILER_PREFIX}size}"
|
|
|
|
|
: "${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}"
|
|
|
|
|
# Allow the compiler prefix to be empty for virtual builds
|
|
|
|
|
COMPILER_PREFIX="${COMPILER_PREFIX-avr-}"
|
|
|
|
|
: "${AVR_SIZE:=${COMPILER_PATH}/${COMPILER_PREFIX}size}"
|
|
|
|
|
: "${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}"
|
|
|
|
|
|
|
|
|
|
# TO DO should use tools.avrdude.cmd.path and tools.avrdude.config.path instead of hardcoding
|
|
|
|
|
: "${AVRDUDE:=$(get_arduino_pref 'runtime.tools.avrdude.path')/bin/avrdude}"
|
|
|
|
|
: "${AVRDUDE_CONF:=$(get_arduino_pref 'runtime.tools.avrdude.path')/etc/avrdude.conf}"
|
|
|
|
|
AVRDUDE_CMD="${AVRDUDE} -v-C \"${AVRDUDE_CONF}\" -D -p\"$(get_arduino_pref 'build.mcu')\""
|
|
|
|
|
# TO DO should use tools.avrdude.cmd.path and tools.avrdude.config.path instead of hardcoding
|
|
|
|
|
: "${AVRDUDE:=$(get_arduino_pref 'runtime.tools.avrdude.path')/bin/avrdude}"
|
|
|
|
|
: "${AVRDUDE_CONF:=$(get_arduino_pref 'runtime.tools.avrdude.path')/etc/avrdude.conf}"
|
|
|
|
|
AVRDUDE_CMD="${AVRDUDE} -v-C \"${AVRDUDE_CONF}\" -D -p\"$(get_arduino_pref 'build.mcu')\""
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
do_compile () {
|
|
|
|
|
do_compile() {
|
|
|
|
|
prepare_ccache
|
|
|
|
|
|
|
|
|
|
install -d "${OUTPUT_PATH}"
|
|
|
|
@ -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}" \
|
|
|
|
|
|
|
|
|
@ -536,13 +524,12 @@ do_compile_with_cli() {
|
|
|
|
|
--build-properties "compiler.cpp.cmd=${_CMD_CXX}" \
|
|
|
|
|
--build-properties "compiler.ar.cmd=${_CMD_AR}" \
|
|
|
|
|
--build-properties "compiler.c.elf.cmd=${_CMD_CXX}" \
|
|
|
|
|
--build-properties "compiler.cpp.extra_flags=${LOCAL_CFLAGS}"\
|
|
|
|
|
--build-properties "compiler.cpp.extra_flags=${LOCAL_CFLAGS}" \
|
|
|
|
|
--warnings all \
|
|
|
|
|
"${SKETCH_FILE_PATH}"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
find_all_sketches () {
|
|
|
|
|
find_all_sketches() {
|
|
|
|
|
for sketch_name in ./*.ino \
|
|
|
|
|
$([ -d examples ] && find examples -name '*.ino') \
|
|
|
|
|
src/*.ino; do
|
|
|
|
@ -562,7 +549,7 @@ find_all_sketches () {
|
|
|
|
|
done | sort
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
build_all () {
|
|
|
|
|
build_all() {
|
|
|
|
|
plugins="$(find_all_sketches)"
|
|
|
|
|
|
|
|
|
|
for sketch in ${plugins}; do
|
|
|
|
@ -571,8 +558,7 @@ build_all () {
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
size () {
|
|
|
|
|
size() {
|
|
|
|
|
compile
|
|
|
|
|
|
|
|
|
|
: "${AVR_SIZE_FLAGS:=-C --mcu=$(get_arduino_pref 'build.mcu')}"
|
|
|
|
@ -582,23 +568,23 @@ size () {
|
|
|
|
|
echo
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
size_map () {
|
|
|
|
|
size_map() {
|
|
|
|
|
compile
|
|
|
|
|
|
|
|
|
|
"${AVR_NM}" --size-sort -C -r -l -t decimal "${ELF_FILE_PATH}"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
disassemble () {
|
|
|
|
|
disassemble() {
|
|
|
|
|
compile
|
|
|
|
|
|
|
|
|
|
"${AVR_OBJDUMP}" -C -d "${ELF_FILE_PATH}"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
decompile () {
|
|
|
|
|
decompile() {
|
|
|
|
|
disassemble
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
clean () {
|
|
|
|
|
clean() {
|
|
|
|
|
find_sketch
|
|
|
|
|
build_paths
|
|
|
|
|
if [ -d "$OUTPUT_PATH" ]; then
|
|
|
|
@ -612,7 +598,7 @@ reset_device() {
|
|
|
|
|
reset_device_cmd
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
check_device_port () {
|
|
|
|
|
check_device_port() {
|
|
|
|
|
if [ -z "$DEVICE_PORT" ]; then
|
|
|
|
|
cat <<EOF >&2
|
|
|
|
|
|
|
|
|
@ -667,9 +653,8 @@ EOF
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
usage () {
|
|
|
|
|
cat <<- EOF
|
|
|
|
|
usage() {
|
|
|
|
|
cat <<-EOF
|
|
|
|
|
Usage: $0 SKETCH commands...
|
|
|
|
|
|
|
|
|
|
Runs all of the commands in the context of the Sketch.
|
|
|
|
@ -706,7 +691,7 @@ usage () {
|
|
|
|
|
EOF
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
help () {
|
|
|
|
|
help() {
|
|
|
|
|
usage
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -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
|
|
|
|
|