From 7a4f0bac85cda8a9b5ad85e06d5ca17c5c3c5949 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Fri, 18 May 2018 23:31:29 +0200 Subject: [PATCH 1/2] 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 --- bin/kaleidoscope-builder | 3 +-- etc/kaleidoscope-builder.conf | 11 +++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/bin/kaleidoscope-builder b/bin/kaleidoscope-builder index a67bab55..58e1b4b7 100755 --- a/bin/kaleidoscope-builder +++ b/bin/kaleidoscope-builder @@ -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}')" diff --git a/etc/kaleidoscope-builder.conf b/etc/kaleidoscope-builder.conf index b3379734..4d5a8c23 100644 --- a/etc/kaleidoscope-builder.conf +++ b/etc/kaleidoscope-builder.conf @@ -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" \ From c65a1b89bf78d67b403a0a9f63355eb9f1d4a14e Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Fri, 18 May 2018 23:33:51 +0200 Subject: [PATCH 2/2] kaleidoscope-builder: Do not reset the device if NO_RESET is set Signed-off-by: Gergely Nagy --- etc/kaleidoscope-builder.conf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/etc/kaleidoscope-builder.conf b/etc/kaleidoscope-builder.conf index 4d5a8c23..fa4d064d 100644 --- a/etc/kaleidoscope-builder.conf +++ b/etc/kaleidoscope-builder.conf @@ -58,7 +58,9 @@ find_device_port() { } reset_device_cmd() { - stty -F ${DEVICE_PORT} 1200 hupcl + if [ -z ${NO_RESET} ]; then + stty -F ${DEVICE_PORT} 1200 hupcl + fi } find_bootloader_ports() {