From 8ddf7ee961c8bb416e4b7dabdeec3c1dabf01cf4 Mon Sep 17 00:00:00 2001 From: Marcio Teixeira Date: Thu, 7 Sep 2017 15:04:17 -0600 Subject: [PATCH] Added switch to build tool to dump out configs. Added "--config" option to build-lulzbot-firmware.sh to save out values in "Configuration.h" and "Configuration_adv.h" for chosen printer and toolhead. This is useful when submitting issues to Marlin devs. Fixed incorrect name of LULZBOT_PRINTCOUNTER --- Marlin/Conditionals_LulzBot.h | 8 ++++---- Marlin/Configuration.h | 2 +- Marlin/Makefile | 20 ++++++++++++++++++ build-lulzbot-firmware.sh | 38 ++++++++++++++++++++++++++++++++--- 4 files changed, 60 insertions(+), 8 deletions(-) diff --git a/Marlin/Conditionals_LulzBot.h b/Marlin/Conditionals_LulzBot.h index 93c4d69a7..3a1e6f5c6 100644 --- a/Marlin/Conditionals_LulzBot.h +++ b/Marlin/Conditionals_LulzBot.h @@ -39,7 +39,7 @@ #error Must specify model and toolhead. Please see "Configuration_LulzBot.h" for directions. #endif -#define LULZBOT_FW_VERSION ".3" +#define LULZBOT_FW_VERSION ".4" // Select options based on printer model @@ -62,7 +62,7 @@ #define LULZBOT_USE_MAX_ENDSTOPS #define LULZBOT_USE_NORMALLY_CLOSED_ENDSTOPS #define LULZBOT_BAUDRATE 250000 - #define LULZBOT_PRINTERCOUNTER + #define LULZBOT_PRINTCOUNTER #endif #if defined(LULZBOT_Gladiola_MiniLCD) @@ -86,7 +86,7 @@ #define LULZBOT_USE_MAX_ENDSTOPS #define LULZBOT_USE_NORMALLY_CLOSED_ENDSTOPS #define LULZBOT_BAUDRATE 250000 - #define LULZBOT_PRINTERCOUNTER + #define LULZBOT_PRINTCOUNTER #endif #if defined(LULZBOT_Juniper_TAZ5) @@ -120,7 +120,7 @@ #define LULZBOT_USE_MAX_ENDSTOPS #define LULZBOT_USE_NORMALLY_CLOSED_ENDSTOPS #define LULZBOT_BAUDRATE 250000 - #define LULZBOT_PRINTERCOUNTER + #define LULZBOT_PRINTCOUNTER #endif // Shared values diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index d3003f8ad..1eb41bd11 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1192,7 +1192,7 @@ * * View the current statistics with M78. */ -#define PRINTCOUNTER LULZBOT_PRINTERCOUNTER +#define PRINTCOUNTER LULZBOT_PRINTCOUNTER //============================================================================= //============================= LCD and SD support ============================ diff --git a/Marlin/Makefile b/Marlin/Makefile index 60f6c5041..31a04beb0 100644 --- a/Marlin/Makefile +++ b/Marlin/Makefile @@ -457,6 +457,26 @@ endif # Default target. all: sizeafter +config: + # This build target uses the C preprocessor to output a snapshot of the + # "Configuration.h" and "Configuration_adv.h" for the current printer + # and toolhead. This is useful for when Marlin developers ask for a copy + # of your config files when you submit an issue. + + # Dump the values defined in "Configuration.h" + echo '#include "Marlin.h"' > /tmp/macros.cpp + cat Configuration.h >> /tmp/macros.cpp + sed -i 's/#define *\(\w*\)/pound_defined_\1/g; s/#ifndef CONFIGURATION_H/#ifndef FOO/g' /tmp/macros.cpp + $(CXX) $(ALL_CXXFLAGS) -E /tmp/macros.cpp -o /tmp/preprocessed.h + grep pound_defined /tmp/preprocessed.h | sed 's/ *pound_defined_\(\w*\)/#define \1/g' > ../build/Configuration.h + + # Dump the values defined in "Configuration_adv.h" + echo '#include "Marlin.h"' > /tmp/macros.cpp + cat Configuration_adv.h >> /tmp/macros.cpp + sed -i 's/#define *\(\w*\)/pound_defined_\1/g; s/#ifndef CONFIGURATION_ADV_H/#ifndef FOO/g' /tmp/macros.cpp + $(CXX) $(ALL_CXXFLAGS) -E /tmp/macros.cpp -o /tmp/preprocessed.h + grep pound_defined /tmp/preprocessed.h | sed 's/ *pound_defined_\(\w*\)/#define \1/g' > ../build/Configuration_adv.h + build: $(BUILD_DIR) elf hex $(BUILD_DIR)/$(HEX_FILENAME).hex $(BUILD_DIR)/$(HEX_FILENAME).hex: $(BUILD_DIR)/$(TARGET).hex diff --git a/build-lulzbot-firmware.sh b/build-lulzbot-firmware.sh index 0f64e4484..1985431d1 100755 --- a/build-lulzbot-firmware.sh +++ b/build-lulzbot-firmware.sh @@ -28,7 +28,17 @@ TAZ_TOOLHEADS="Tilapia_SingleExtruder Kanyu_Flexystruder Opah_Moarstruder Javeli # Prints out a usage summary # usage() { - echo "Usage: $0 [-s|--short-names] [--no-timestamps] [printer_model toolhead_name]" + echo + echo "Usage: $0 [-s|--short-names] [--no-timestamps] [-c|--config] [printer_model toolhead_name]" + echo + echo " -s|--short-names Omits LulzBot code names from generated .hex files" + echo + echo " --no-timestamps Does not embed a timestamp in the .hex file." + echo + echo " -c|--config Rather than compiling a .hex file, dump out the values" + echo " in 'Configuration.h' and 'Configuration_adv.h' that are" + echo " to be used for the specified printer and toolhead." + echo exit } @@ -47,6 +57,20 @@ build_firmware() { mv Marlin/applet/*.hex build } +#### +# build_config +# +# Compiles Configuration.h and Configuration_adv.h for the specified printer and toolhead +# +build_config() { + printer=$1 + toolhead=$2 + echo + echo Generating config for ${printer} and ${toolhead} + echo + (cd Marlin; make clean; make $MAKEOPTS AVR_TOOLS_PATH=${AVR_TOOLS_PATH}/ MODEL=${printer} TOOLHEAD=${toolhead} config) || exit +} + #### # check_tool # @@ -141,7 +165,7 @@ build_summary() { echo echo echo - echo Firmware hex files built in "`pwd`/build": + echo Generated files stored in "`pwd`/build": echo ls build echo @@ -162,6 +186,10 @@ do SHORTNAMES=1 shift ;; + --config|-c) + GENERATE_CONFIG=1 + shift + ;; --*) usage ;; @@ -179,7 +207,11 @@ mkdir build if [ $# -eq 2 ] then - build_firmware $1 $2 + if [ $GENERATE_CONFIG ]; then + build_config $1 $2 + else + build_firmware $1 $2 + fi else build_for_mini build_for_taz