From 8b8eec157c6da034784d5eb30ad80f61e1553609 Mon Sep 17 00:00:00 2001 From: Marcio Teixeira Date: Wed, 26 Jul 2017 09:53:19 -0600 Subject: [PATCH] Now able to build from the Makefile. --- Marlin/Configuration.h | 1 + Marlin/Configuration_LulzBot.h | 9 ++++--- Marlin/Makefile | 34 +++++++++++++++++++++----- README_LulzBot.md | 11 +++++---- build-lulzbot-firmware.sh | 44 ++++++++++++++++++++++++++++++++++ 5 files changed, 84 insertions(+), 15 deletions(-) create mode 100755 build-lulzbot-firmware.sh diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index da3753f6f..cfee07660 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -21,6 +21,7 @@ */ #include "Configuration_LulzBot.h" +#include "Conditionals_LulzBot.h" /** * Configuration.h diff --git a/Marlin/Configuration_LulzBot.h b/Marlin/Configuration_LulzBot.h index 828332acc..86b99059d 100644 --- a/Marlin/Configuration_LulzBot.h +++ b/Marlin/Configuration_LulzBot.h @@ -32,11 +32,10 @@ */ -// If compiling using the Arduino IDE, change printer model and toolhead here: +// If compiling using the Arduino IDE, uncomment and set printer model +// and toolhead here: -#define LULZBOT_Huerfano_TAZ_7 -#define TOOLHEAD_Angelfish_Aero - -#include "Conditionals_LulzBot.h" +//#define LULZBOT_Oliveoil_TAZ_6 +//#define TOOLHEAD_Oliveoil_SingleExtruder #endif /* CONFIGURATION_LULZBOT */ \ No newline at end of file diff --git a/Marlin/Makefile b/Marlin/Makefile index d91fd8f0b..14e68973e 100644 --- a/Marlin/Makefile +++ b/Marlin/Makefile @@ -60,7 +60,7 @@ HARDWARE_MOTHERBOARD ?= 301 # Arduino source install directory, and version number # On most linuxes this will be /usr/share/arduino -ARDUINO_INSTALL_DIR ?= ${HOME}/devel/arduino-1.8.3 +ARDUINO_INSTALL_DIR ?= ../ArduinoAddons/arduino-1.8.3 ARDUINO_VERSION ?= 183 # You can optionally set a path to the avr-gcc tools. Requires a trailing slash. (ex: /usr/local/avr-gcc/bin) @@ -82,9 +82,22 @@ LIQUID_TWI2 ?= 0 # this defines if Wire is needed WIRE ?= 0 -# this defines if U8GLIB is needed +# this defines if U8GLIB is needed (may require RELOC_WORKAROUND) U8GLIB ?= 1 +# this defines whether to add a workaround for the avr-gcc relocation bug +# https://www.stix.id.au/wiki/AVR_relocation_truncations_workaround +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) +HASH = $(shell git rev-parse --verify HEAD --short) +HEX_FILENAME=Marlin_$(MODEL)_$(TOOLHEAD)_$(VERSION)$(REVISION)_$(HASH) +LULZBOT_EXTRAS=-DLULZBOT_$(MODEL) -DTOOLHEAD_$(TOOLHEAD) -Wfatal-errors + ############################################################################ # Below here nothing should be changed... @@ -320,6 +333,11 @@ ifeq ($(U8GLIB), 1) SRC += u8g_ll_api.c u8g_bitmap.c u8g_clip.c u8g_com_null.c u8g_delay.c u8g_page.c u8g_pb.c u8g_pb16h1.c u8g_rect.c u8g_state.c u8g_font.c u8g_font_data.c endif +ifeq ($(RELOC_WORKAROUND), 1) +LD_PREFIX=-nodefaultlibs +LD_SUFFIX=-lm -lgcc -lc -lgcc +endif + #Check for Arduino 1.0.0 or higher and use the correct source files for that version ifeq ($(shell [ $(ARDUINO_VERSION) -ge 100 ] && echo true), true) CXXSRC += main.cpp @@ -377,10 +395,11 @@ CTUNING = -funsigned-char -funsigned-bitfields -fpack-struct \ -flto \ -DARDUINO=$(ARDUINO_VERSION) ifneq ($(HARDWARE_MOTHERBOARD),) -CTUNING += -DMOTHERBOARD=${HARDWARE_MOTHERBOARD} +# LulzBot: Commented out this line since this is set by Conditionals_LulzBot.h +#CTUNING += -DMOTHERBOARD=${HARDWARE_MOTHERBOARD} endif #CEXTRA = -Wa,-adhlns=$(<:.c=.lst) -CEXTRA = -fno-use-cxa-atexit -fno-threadsafe-statics +CEXTRA = -fno-use-cxa-atexit -fno-threadsafe-statics $(LULZBOT_EXTRAS) CFLAGS := $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CWARN) $(CEXTRA) $(CTUNING) $(CSTANDARD) CXXFLAGS := $(CDEFS) $(CINCS) -O$(OPT) -Wall $(CEXTRA) $(CTUNING) $(CXXSTANDARD) @@ -426,7 +445,10 @@ endif # Default target. all: sizeafter -build: $(BUILD_DIR) elf hex +build: $(BUILD_DIR) elf hex $(BUILD_DIR)/$(HEX_FILENAME).hex + +$(BUILD_DIR)/$(HEX_FILENAME).hex: $(BUILD_DIR)/$(TARGET).hex + mv $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(HEX_FILENAME).hex # Creates the object directory $(BUILD_DIR): @@ -498,7 +520,7 @@ extcoff: $(TARGET).elf # Link: create ELF output file from library. $(BUILD_DIR)/$(TARGET).elf: $(OBJ) Configuration.h $(Pecho) " CXX $@" - $P $(CC) $(ALL_CXXFLAGS) -Wl,--gc-sections,--relax -o $@ -L. $(OBJ) $(LDFLAGS) + $P $(CC) $(LD_PREFIX) $(ALL_CXXFLAGS) -Wl,--gc-sections,--relax -o $@ -L. $(OBJ) $(LDFLAGS) $(LD_SUFFIX) $(BUILD_DIR)/%.o: %.c Configuration.h Configuration_adv.h $(MAKEFILE) $(Pecho) " CC $<" diff --git a/README_LulzBot.md b/README_LulzBot.md index 62634139e..ef1ba34a0 100644 --- a/README_LulzBot.md +++ b/README_LulzBot.md @@ -2,17 +2,20 @@ This is an experimental development branch of Marlin 1.1.4 for LulzBot printers. +The source on this branch can compile firmware for the TAZ 6 and Mini, as well as all the current toolheads. This firmware also supports some internal R&D prototypes and toolheads. + # Safety and warnings: **This is alpha level software.** It has not been extensively tested and may damage your printer and present other hazards. Use at your own risk. Do not operate your printer while unattended and be sure to power it off when leaving the room. Please consult the documentation that came with your printer for additional safety and warning information. -# Compilation: +# Compilation from the command line on Linux using "avr-gcc" -The source on this branch can compile firmware for the TAZ 6 and Mini, as well as all the current toolheads. This firmware also supports some internal R&D prototypes and toolheads. +Run the "build-lulzbot-firmware.sh" from the top level directory. + +# Compilation using Arduino IDE To select what firmware to build, modify lines 6 and 7 of "Configuration_LulzBot.h" according to the instructions on line 39. # Known Issues: -1. The Makefile does not work. Building must be done via the Arduino IDE (internal builds are being done with 1.8.3) -2. Printer needs to be power cycled to clear "clean nozzle" state. \ No newline at end of file +1. Printer needs to be power cycled to clear "clean nozzle" state. \ No newline at end of file diff --git a/build-lulzbot-firmware.sh b/build-lulzbot-firmware.sh new file mode 100755 index 000000000..afe6dbc1c --- /dev/null +++ b/build-lulzbot-firmware.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +build_firmware() { + printer=$1 + toolhead=$2 + echo + echo Building for ${printer} and ${toolhead} + echo + (cd Marlin; make clean; make $MAKEOPTS MODEL=${printer} TOOLHEAD=${toolhead}) || exit + mv Marlin/applet/*.hex build +} + +rm -rf build +mkdir build + +MINI_MODELS="Gladiola_Mini Huerfano_Mini Gladiola_GLCD" +TAZ_MODELS="Oliveoil_TAZ_6 Huerfano_TAZ_7" + +MINI_TOOLHEADS="Gladiola_SingleExtruder Albatross_Flexystruder Heather_Aero" +TAZ_TOOLHEADS="Oliveoil_SingleExtruder Kanyu_Flexystruder Opah_Moarstruder Javelin_DualExtruder Longfin_FlexyDually Yellowfin_DualExtruder Angelfish_Aero" + +for model in $MINI_MODELS +do + for toolhead in $MINI_TOOLHEADS + do + build_firmware ${model} ${toolhead} + done +done + +for model in $TAZ_MODELS +do + for toolhead in $TAZ_TOOLHEADS + do + build_firmware ${model} ${toolhead} + done +done + +echo +echo +echo +echo Firmware hex files built in "`pwd`/build": +echo +ls build +echo \ No newline at end of file