@ -59,7 +59,6 @@ find_sketch () {
}
}
flash () {
flash () {
cd "$(find_sketch)"
. ${ROOT}/tools/settings.sh
. ${ROOT}/tools/settings.sh
echo "Press ENTER when ready..."
echo "Press ENTER when ready..."
@ -68,12 +67,9 @@ flash () {
reset_device
reset_device
sleep 3s
sleep 3s
avrdude -q -q -p${MCU} -cavr109 -D -P ${DEVICE_PORT_BOOTLOADER} -b57600 "-Uflash:w:${HEX_FILE_PATH}:i"
avrdude -q -q -p${MCU} -cavr109 -D -P ${DEVICE_PORT_BOOTLOADER} -b57600 "-Uflash:w:${HEX_FILE_PATH}:i"
cd "${SOURCEDIR}"
}
}
program () {
program () {
cd "$(find_sketch)"
. ${ROOT}/tools/settings.sh
. ${ROOT}/tools/settings.sh
echo "Press ENTER when ready..."
echo "Press ENTER when ready..."
@ -85,12 +81,9 @@ program () {
-D \
-D \
-B 1 \
-B 1 \
"-Uflash:w:${HEX_FILE_PATH}:i"
"-Uflash:w:${HEX_FILE_PATH}:i"
cd "${SOURCEDIR}"
}
}
hex_with_bootloader () {
hex_with_bootloader () {
cd "$(find_sketch)"
. ${ROOT}/tools/settings.sh
. ${ROOT}/tools/settings.sh
cat ${HEX_FILE_PATH} | awk '/^:00000001FF/ == 0' > ${HEX_FILE_WITH_BOOTLOADER_PATH}
cat ${HEX_FILE_PATH} | awk '/^:00000001FF/ == 0' > ${HEX_FILE_WITH_BOOTLOADER_PATH}
@ -105,8 +98,6 @@ Make sure you have the bootloader version you expect.
And TEST THIS ON REAL HARDWARE BEFORE YOU GIVE IT TO ANYONE
And TEST THIS ON REAL HARDWARE BEFORE YOU GIVE IT TO ANYONE
EOF
EOF
cd "${SOURCEDIR}"
}
}
build () {
build () {
@ -115,7 +106,6 @@ build () {
}
}
compile () {
compile () {
cd "$(find_sketch)"
. ${ROOT}/tools/settings.sh
. ${ROOT}/tools/settings.sh
install -d "${OUTPUT_PATH}"
install -d "${OUTPUT_PATH}"
@ -141,15 +131,13 @@ compile () {
${ARDUINO_VERBOSE} \
${ARDUINO_VERBOSE} \
-prefs "compiler.cpp.extra_flags=-std=c++11 -Woverloaded-virtual -Wno-unused-parameter -Wno-unused-variable -Wno-ignored-qualifiers" \
-prefs "compiler.cpp.extra_flags=-std=c++11 -Woverloaded-virtual -Wno-unused-parameter -Wno-unused-variable -Wno-ignored-qualifiers" \
${ARDUINO_AVR_GCC_PREFIX_PARAM} \
${ARDUINO_AVR_GCC_PREFIX_PARAM} \
"${SKETCH}.ino"
"$(find_sketch)/$ {SKETCH}.ino"
cp "${BUILD_PATH}/${SKETCH}.ino.hex" "${HEX_FILE_PATH}"
cp "${BUILD_PATH}/${SKETCH}.ino.hex" "${HEX_FILE_PATH}"
cp "${BUILD_PATH}/${SKETCH}.ino.elf" "${ELF_FILE_PATH}"
cp "${BUILD_PATH}/${SKETCH}.ino.elf" "${ELF_FILE_PATH}"
ln -sf "${OUTPUT_FILE_PREFIX}.hex" "${OUTPUT_PATH}/${SKETCH}-latest.hex"
ln -sf "${OUTPUT_FILE_PREFIX}.hex" "${OUTPUT_PATH}/${SKETCH}-latest.hex"
ln -sf "${OUTPUT_FILE_PREFIX}.elf" "${OUTPUT_PATH}/${SKETCH}-latest.elf"
ln -sf "${OUTPUT_FILE_PREFIX}.elf" "${OUTPUT_PATH}/${SKETCH}-latest.elf"
rm -rf "${BUILD_PATH}"
rm -rf "${BUILD_PATH}"
cd "${SOURCEDIR}"
}
}
_find_all () {
_find_all () {
@ -176,50 +164,35 @@ build_all () {
}
}
report_size () {
report_size () {
cd "$(find_sketch)"
. ${ROOT}/tools/settings.sh
. ${ROOT}/tools/settings.sh
echo "- Size: firmware/${LIBRARY}/${OUTPUT_FILE_PREFIX}.elf"
echo "- Size: firmware/${LIBRARY}/${OUTPUT_FILE_PREFIX}.elf"
firmware_size "${AVR_SIZE}" -C --mcu="${MCU}" "${ELF_FILE_PATH}"
firmware_size "${AVR_SIZE}" -C --mcu="${MCU}" "${ELF_FILE_PATH}"
echo
echo
cd "${SOURCEDIR}"
}
}
size_map () {
size_map () {
cd "$(find_sketch)"
. ${ROOT}/tools/settings.sh
. ${ROOT}/tools/settings.sh
"${AVR_NM}" --size-sort -C -r -l "${ELF_FILE_PATH}"
"${AVR_NM}" --size-sort -C -r -l "${ELF_FILE_PATH}"
cd "${SOURCEDIR}"
}
}
decompile () {
decompile () {
cd "$(find_sketch)"
. ${ROOT}/tools/settings.sh
. ${ROOT}/tools/settings.sh
"${AVR_OBJDUMP}" -d "${ELF_FILE_PATH}"
"${AVR_OBJDUMP}" -d "${ELF_FILE_PATH}"
cd "${SOURCEDIR}"
}
}
clean () {
clean () {
cd "$(find_sketch)"
. ${ROOT}/tools/settings.sh
. ${ROOT}/tools/settings.sh
rm -rf "${OUTPUT_PATH}"
rm -rf "${OUTPUT_PATH}"
cd "${SOURCEDIR}"
}
}
reset_device () {
reset_device () {
cd "$(find_sketch)"
. ${ROOT}/tools/settings.sh
. ${ROOT}/tools/settings.sh
${RESET_DEVICE}
${RESET_DEVICE}
cd "${SOURCEDIR}"
}
}
usage () {
usage () {