Changes for TAZ 7; Improved build scripts.

Changed Z_MAX on TAZ 7.
Build script now has options to record the configuration file as well as checksums that can be used to compare various releases.
master
Marcio Teixeira 7 years ago
parent dac8a73633
commit df5f8a5aec

@ -39,7 +39,7 @@
#error Must specify model and toolhead. Please see "Configuration_LulzBot.h" for directions.
#endif
#define LULZBOT_FW_VERSION ".7"
#define LULZBOT_FW_VERSION ".8"
// Select options based on printer model
@ -123,6 +123,14 @@
#define LULZBOT_PRINTCOUNTER
#endif
// The Makefile and build-lulzbot-firmware.sh has an option to generate
// firmware without any identifying version or build timestamp. This is
// used in internal testing to allow us to binary diff across .hex files.
#if defined(LULZBOT_MASK_VERSION)
#undef LULZBOT_FW_VERSION
#define LULZBOT_FW_VERSION ".xx"
#endif
// Shared values
#define LULZBOT_STRING_CONFIG_H_AUTHOR "(Aleph Objects Inc., LulzBot Git Repository)"
#define LULZBOT_BUFSIZE 10
@ -792,7 +800,7 @@
#elif defined(LULZBOT_Quiver_TAZ7)
#define LULZBOT_STANDARD_Z_MIN_POS 0
#define LULZBOT_STANDARD_Z_MAX_POS 290
#define LULZBOT_STANDARD_Z_MAX_POS 300
#endif
#define LULZBOT_X_MAX_POS (LULZBOT_STANDARD_X_MAX_POS - LULZBOT_TOOLHEAD_X_MAX_ADJ)

@ -93,7 +93,7 @@ RELOC_WORKAROUND ?= 1
# The following added by AlephObjects for adjusting the name of the output
# hex file
VERSION=$(shell grep "define SHORT_BUILD_VERSION" Version.h | cut -d \" -f 2)
REVISION=$(shell grep "define LULZBOT_FW" Conditionals_LulzBot.h | cut -d \" -f 2)
REVISION=$(shell grep -m 1 "define LULZBOT_FW" Conditionals_LulzBot.h | cut -d \" -f 2)
HASH = $(shell git rev-parse --verify HEAD --short)
HEX_FILENAME=Marlin_$(MODEL)_$(TOOLHEAD)_$(VERSION)$(REVISION)_$(HASH)
LULZBOT_EXTRAS=-DLULZBOT_$(MODEL) -DTOOLHEAD_$(TOOLHEAD) -Wfatal-errors
@ -381,10 +381,18 @@ MV = mv -f
CDEFS = -DF_CPU=$(F_CPU) ${addprefix -D , $(DEFINES)}
CXXDEFS = $(CDEFS)
#Disabling the timestamp is useful for diffing binaries between different builds.
# Disabling the timestamp and/or timestamp in the .hex file is useful for
# binary diffing between different builds of .hex files to detect unintended
# changes.
ifeq ($(NO_TIMESTAMP), 1)
#CDEFS +=-D__DATE__="??? ?? ????" -D__TIME__="??:??:??"
CDEFS +=-D__DATE__='"Aug 17 2017"' -D__TIME__='"08:59:30"'
CDEFS +='-D__DATE__="??? ?? ????"'
CDEFS +='-D__TIME__="??:??:??"'
endif
#Disabling the versions is useful for diffing binaries between different
#versions
ifeq ($(NO_VERSION), 1)
CDEFS +='-DLULZBOT_MASK_VERSION'
endif
ifeq ($(HARDWARE_VARIANT), Teensy)
@ -457,7 +465,7 @@ endif
# Default target.
all: sizeafter
config:
config: $(BUILD_DIR)
# 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
@ -468,14 +476,16 @@ config:
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
echo "/* Configuration.h */" > $(BUILD_DIR)/$(HEX_FILENAME).config
grep pound_defined /tmp/preprocessed.h | sed 's/ *pound_defined_\(\w*\)/#define \1/g' >> $(BUILD_DIR)/$(HEX_FILENAME).config
# 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
echo "/* Configuration_adv.h */" >> $(BUILD_DIR)/$(HEX_FILENAME).config
grep pound_defined /tmp/preprocessed.h | sed 's/ *pound_defined_\(\w*\)/#define \1/g' >> $(BUILD_DIR)/$(HEX_FILENAME).config
build: $(BUILD_DIR) elf hex $(BUILD_DIR)/$(HEX_FILENAME).hex

@ -29,32 +29,56 @@ TAZ_TOOLHEADS="Tilapia_SingleExtruder Kanyu_Flexystruder Opah_Moarstruder Javeli
#
usage() {
echo
echo "Usage: $0 [-s|--short-names] [--no-timestamps] [-c|--config] [printer_model toolhead_name]"
echo "Usage: $0 [-s|--short-names] [-h|--hash] [-c|--config] [printer_model toolhead_name]"
echo
echo " -s|--short-names Omits LulzBot code names from generated .hex files"
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 " -h|--hash Records md5sum of the .hex files. These files will be generated:"
echo " md5sums-full* Sum w/ embedded version str and timestamp"
echo " md5sums-bare* Sum w/o embedded version str and timestamp"
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 " -c|--config Save the values of 'Configuration.h' and 'Configuration_adv.h'"
echo " that are used for the specified printer and toolhead."
echo
exit
}
####
# build_firmware <printer> <toolhead>
# compile_firmware <printer> <toolhead> [makeopts]
#
# Compiles firmware for the specified printer and toolhead
#
build_firmware() {
printer=$1
toolhead=$2
compile_firmware() {
printer=$1 ; shift 1
toolhead=$1 ; shift 1
(cd Marlin; make clean; make AVR_TOOLS_PATH=${AVR_TOOLS_PATH}/ MODEL=${printer} TOOLHEAD=${toolhead} $*) || exit
}
####
# record_checksum <hex_file> <checksum-file-prefix>
#
# Records the md5sum of a hex file to the checksum file
#
record_checksum() {
HEX_NAME=`basename $1`
VERSION=`echo $HEX_NAME | sed -r "s/Marlin_(.+)_(.+)_(.+)_(.+)_(.+)_(.+).hex/\5-\6/"`
VARIANT=`echo $HEX_NAME | sed -r "s/Marlin_(.+)_(.+)_(.+)_(.+)_(.+)_(.+).hex/\1_\2 \3_\4/"`
cat $1 | md5sum | sed "s/-/$VARIANT/" >> ${2}-${VERSION}.txt
}
####
# generate_bare_checksum <printer> <toolhead>
#
# Builds firmware without timestamp and version strings, and
# saves md5sum to a file. These are useful to see if anything
# actually changed between two versions.
#
generate_bare_checksum() {
echo
echo Building for ${printer} and ${toolhead}
echo Generating bare checksum for $1 and $2
echo
(cd Marlin; make clean; make $MAKEOPTS AVR_TOOLS_PATH=${AVR_TOOLS_PATH}/ MODEL=${printer} TOOLHEAD=${toolhead}) || exit
mv Marlin/applet/*.hex build
compile_firmware $1 $2 NO_TIMESTAMP=1 NO_VERSION=1
record_checksum Marlin/applet/*.hex build/md5sums-bare
}
####
@ -63,12 +87,33 @@ build_firmware() {
# 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 Generating config for $1 and $2
echo
compile_firmware $1 $2 config
}
####
# build_firmware <printer> <toolhead> <dest-dir>
#
# Compiles firmware for the specified printer and toolhead
#
build_firmware() {
if [ $MAKE_HASHES ]; then
generate_bare_checksum $1 $2
fi
echo
echo Building for $1 and $2
echo
(cd Marlin; make clean; make $MAKEOPTS AVR_TOOLS_PATH=${AVR_TOOLS_PATH}/ MODEL=${printer} TOOLHEAD=${toolhead} config) || exit
compile_firmware $1 $2
if [ $MAKE_HASHES ]; then
record_checksum Marlin/applet/*.hex build/md5sums-full
fi
mv Marlin/applet/*.hex build
if [ $GENERATE_CONFIG ]; then
build_config $1 $2
mv Marlin/applet/*.config build
fi
}
####
@ -178,15 +223,15 @@ build_summary() {
while true
do
case $1 in
--no-timestamps)
MAKEOPTS="NO_TIMESTAMP=1"
-h|--hash)
MAKE_HASHES=1
shift
;;
--short-names|-s)
-s|--short-names)
SHORTNAMES=1
shift
;;
--config|-c)
-c|--config)
GENERATE_CONFIG=1
shift
;;
@ -203,15 +248,11 @@ locate_avr_tools
check_avr_tools
rm -rf build
mkdir build
mkdir build
if [ $# -eq 2 ]
then
if [ $GENERATE_CONFIG ]; then
build_config $1 $2
else
build_firmware $1 $2
fi
build_firmware $1 $2
else
build_for_mini
build_for_taz
@ -219,6 +260,7 @@ fi
if [ $SHORTNAMES ]; then
rename 's/Marlin_(.+)_(.+)_(.+)_(.+)_(.+)_(.+).hex/Marlin_$2_$4_$5_$6.hex/' build/*
rename 's/Marlin_(.+)_(.+)_(.+)_(.+)_(.+)_(.+).config/Marlin_$2_$4_$5_$6.config/' build/*
fi
build_summary

Loading…
Cancel
Save