Lift configure-arduino-cli and hex-with-bootloader to Makefile

tmp/arduino-cli-pre-rebase
Jesse Vincent 4 years ago
parent f35a1dd032
commit 5c66404667
No known key found for this signature in database
GPG Key ID: CC228463465E40BC

@ -20,15 +20,6 @@ set -e
######
cmd_configure_arduino_cli() {
if [ -z "${ARDUINO_CLI}" ]; then
cmd_install_arduino_cli
fi
if [ -z "${ARDUINO_CLI_CONFIG}" ]; then
_run_arduino_cli config init
fi
}
_run_arduino_cli() {
"${ARDUINO_CLI}" "$@"
}
@ -59,7 +50,6 @@ _find_sketch() {
cmd_flash() {
_set_up_environment
#TODO (arduino team) I'd love to do this with their json output
#but it's short some of the data we kind of need
port=$(_run_arduino_cli board list --format=text | grep "$FQBN" |cut -d' ' -f 1)
@ -78,27 +68,7 @@ cmd_flash() {
}
cmd_hex_with_bootloader() {
_set_up_environment
awk '/^:00000001FF/ == 0' "${HEX_FILE_PATH}" >"${HEX_FILE_WITH_BOOTLOADER_PATH}"
echo "Using ${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
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
}
cmd_compile() {
_set_up_environment
install -d "${OUTPUT_PATH}"
echo "Building ${SKETCH_FILE_PATH}"
@ -133,11 +103,6 @@ cmd_compile() {
}
_set_up_environment() {
_find_sketch
}
cmd_help() {
cat <<-EOF
Usage: $0 SKETCH commands...

@ -143,6 +143,8 @@ all:
install-arduino-cli:
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR="$(KALEIDOSCOPE_BIN_DIR)" sh
configure-arduino-cli:
$(ARDUINO_CLI) config init
install-arduino-core-kaleidoscope:
$(ARDUINO_CLI) core install "keyboardio:avr"
@ -161,6 +163,24 @@ size-map: compile
flash: compile
hex-with-bootloader:
awk '/^:00000001FF/ == 0' "${HEX_FILE_PATH}" >"${HEX_FILE_WITH_BOOTLOADER_PATH}"
@echo "Using ${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"
@echo Combined firmware and bootloader are now at
@echo ${HEX_FILE_WITH_BOOTLOADER_PATH}
@echo
@echo Make sure you have the bootloader version you expect.
@echo
@echo
@echo And TEST THIS ON REAL HARDWARE BEFORE YOU GIVE IT TO ANYONE.
prop:
@echo $(BOOTLOADER_PATH)
@echo $(GIT_VERSION)

Loading…
Cancel
Save