kaleidoscope-builder: Do not hardcode the max program size

Instead of hardcoding the max program size, pick it out of boards.txt, like we
pick the device VID and PID.

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/328/head
Gergely Nagy 7 years ago
parent 8546814b98
commit 7a4f0bac85

@ -30,8 +30,7 @@ firmware_size () {
## This is a terrible hack, please don't hurt me. - algernon
MAX_PROG_SIZE=28672
find_max_prog_size
output="$("$@" | grep "\\(Program\\|Data\\):" | sed -e 's,^, - ,' && echo)"
PROGSIZE="$(echo "${output}" | grep "Program:" | cut -d: -f2 | awk '{print $1}')"

@ -26,6 +26,17 @@ fi
# Shamelessly stolen from git's Makefile
uname_S=$(uname -s 2>/dev/null || echo not)
find_max_prog_size() {
VPIDS=$(${ARDUINO_BUILDER} \
-hardware "${ARDUINO_PATH}/hardware" \
-hardware "${BOARD_HARDWARE_PATH}" \
${ARDUINO_TOOLS_PARAM} \
-tools "${ARDUINO_PATH}/tools-builder" \
-fqbn "${FQBN}" \
-dump-prefs | grep "upload\.maximum_size=")
MAX_PROG_SIZE=${MAX_PROG_SIZE:-$(echo "${VPIDS}" | grep upload.maximum_size | cut -d= -f2)}
}
find_device_vid_pid() {
VPIDS=$(${ARDUINO_BUILDER} \
-hardware "${ARDUINO_PATH}/hardware" \

Loading…
Cancel
Save