Browse Source
Conflicts: Marlin/Configuration.h Marlin/EEPROMwrite.h Marlin/Marlin.h Marlin/Marlin.pde Marlin/temperature.cpp Marlin/temperature.h Marlin/thermistortables.hpull/1/head
Erik van der Zalm
13 years ago
33 changed files with 11312 additions and 11112 deletions
@ -1,274 +1,320 @@ |
|||
TARGET = $(notdir $(CURDIR)) |
|||
# CHANGE BELOW:
|
|||
#~ INSTALL_DIR = /Applications/Arduino.app/Contents/Resources/Java
|
|||
INSTALL_DIR = /home/bkubicek/software/arduino-0022 |
|||
#~ PORT = /dev/cu.usbserial*
|
|||
PORT = /dev/ttyACM0 |
|||
|
|||
# Get these values from:
|
|||
# $(INSTALL_DIR)/hardware/boards.txt
|
|||
# (arduino-0022/hardware/arduino/boards.txt)
|
|||
# The values below are for the "Arduino Duemilanove or Nano w/ ATmega328"
|
|||
# now for "Arduino Mega 2560"
|
|||
UPLOAD_SPEED = 115200 |
|||
UPLOAD_PROTOCOL = stk500v2 |
|||
BUILD_MCU = atmega2560 |
|||
BUILD_F_CPU = 16000000L |
|||
|
|||
# getting undefined reference to `__cxa_pure_virtual'
|
|||
#~ [http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1254180518 Arduino Forum - Makefile]
|
|||
#~ http://www.arduino.cc/playground/OpenBSD/CLI
|
|||
#~ [http://arduino.cc/forum/index.php?topic=52041.0 A "simple" makefile for Arduino]
|
|||
#~ [http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1275488191 Arduino Forum - Configuring avr-gcc options in arduino IDE]
|
|||
# found in /usr/lib/gcc/avr/4.3.5/cc1plus; fixed with -Wl,--gc-section
|
|||
|
|||
############################################################################
|
|||
# Below here nothing should be changed...
|
|||
|
|||
ARDUINO = $(INSTALL_DIR)/hardware/arduino/cores/arduino |
|||
#
|
|||
# Arduino 0022 Makefile
|
|||
# Uno with DOGS102 Shield
|
|||
#~ AVR_TOOLS_PATH = $(INSTALL_DIR)/hardware/tools/avr/bin
|
|||
# in Ubuntu, avr-gcc is installed separate;
|
|||
# only avrdude comes with the IDE
|
|||
AVR_TOOLS_PATH = /usr/bin |
|||
AVR_DUDE_PATH = $(INSTALL_DIR)/hardware/tools |
|||
#
|
|||
# written by olikraus@gmail.com
|
|||
#
|
|||
# Features:
|
|||
# - boards.txt is used to derive parameters
|
|||
# - All intermediate files are put into a separate directory (TMPDIRNAME)
|
|||
# - Simple use: Copy Makefile into the same directory of the .pde file
|
|||
#
|
|||
# Limitations:
|
|||
# - requires UNIX environment
|
|||
# - TMPDIRNAME must be subdirectory of the current directory.
|
|||
#
|
|||
# Targets
|
|||
# all build everything
|
|||
# upload build and upload to arduino
|
|||
# clean remove all temporary files (includes final hex file)
|
|||
#
|
|||
# History
|
|||
# 001 28 Apr 2010 first release
|
|||
# 002 05 Oct 2010 added 'uno'
|
|||
#
|
|||
|
|||
#=== user configuration ===
|
|||
# All ...PATH variables must have a '/' at the end
|
|||
|
|||
# Board (and prozessor) information: see $(ARDUINO_PATH)hardware/arduino/boards.txt
|
|||
# Some examples:
|
|||
# BOARD DESCRIPTION
|
|||
# uno Arduino Uno
|
|||
# atmega328 Arduino Duemilanove or Nano w/ ATmega328
|
|||
# diecimila Arduino Diecimila, Duemilanove, or Nano w/ ATmega168
|
|||
# mega Arduino Mega
|
|||
# mini Arduino Mini
|
|||
# lilypad328 LilyPad Arduino w/ ATmega328
|
|||
BOARD:=mega |
|||
|
|||
# additional (comma separated) defines
|
|||
# -DDOGM128_HW board is connected to DOGM128 display
|
|||
# -DDOGM132_HW board is connected to DOGM132 display
|
|||
# -DDOGS102_HW board is connected to DOGS102 display
|
|||
# -DDOG_REVERSE 180 degree rotation
|
|||
# -DDOG_SPI_SW_ARDUINO force SW shiftOut
|
|||
DEFS=-DDOGS102_HW -DDOG_DOUBLE_MEMORY -DDOG_SPI_SW_ARDUINO |
|||
|
|||
# The location where the avr tools (e.g. avr-gcc) are located. Requires a '/' at the end.
|
|||
# Can be empty if all tools are accessable through the search path
|
|||
AVR_TOOLS_PATH:=/usr/bin/ |
|||
|
|||
# Install path of the arduino software. Requires a '/' at the end.
|
|||
ARDUINO_PATH:=/home/bkubicek/software/arduino-0022/ |
|||
|
|||
# Install path for avrdude. Requires a '/' at the end. Can be empty if avrdude is in the search path.
|
|||
AVRDUDE_PATH:= |
|||
|
|||
# The unix device where we can reach the arduino board
|
|||
# Uno: /dev/ttyACM0
|
|||
# Duemilanove: /dev/ttyUSB0
|
|||
AVRDUDE_PORT:=/dev/ttyACM0 |
|||
|
|||
# List of all libaries which should be included.
|
|||
#EXTRA_DIRS=$(ARDUINO_PATH)libraries/LiquidCrystal/
|
|||
#EXTRA_DIRS+=$(ARDUINO_PATH)libraries/Dogm/
|
|||
#EXTRA_DIRS+=/home/kraus/src/arduino/dogm128/hg/libraries/Dogm/
|
|||
|
|||
#=== fetch parameter from boards.txt processor parameter ===
|
|||
# the basic idea is to get most of the information from boards.txt
|
|||
|
|||
BOARDS_TXT:=$(ARDUINO_PATH)hardware/arduino/boards.txt |
|||
|
|||
# get the MCU value from the $(BOARD).build.mcu variable. For the atmega328 board this is atmega328p
|
|||
MCU:=$(shell sed -n -e "s/$(BOARD).build.mcu=\(.*\)/\1/p" $(BOARDS_TXT)) |
|||
# get the F_CPU value from the $(BOARD).build.f_cpu variable. For the atmega328 board this is 16000000
|
|||
F_CPU:=$(shell sed -n -e "s/$(BOARD).build.f_cpu=\(.*\)/\1/p" $(BOARDS_TXT)) |
|||
|
|||
# avrdude
|
|||
# get the AVRDUDE_UPLOAD_RATE value from the $(BOARD).upload.speed variable. For the atmega328 board this is 57600
|
|||
AVRDUDE_UPLOAD_RATE:=$(shell sed -n -e "s/$(BOARD).upload.speed=\(.*\)/\1/p" $(BOARDS_TXT)) |
|||
# get the AVRDUDE_PROGRAMMER value from the $(BOARD).upload.protocol variable. For the atmega328 board this is stk500
|
|||
# AVRDUDE_PROGRAMMER:=$(shell sed -n -e "s/$(BOARD).upload.protocol=\(.*\)/\1/p" $(BOARDS_TXT))
|
|||
# use stk500v1, because stk500 will default to stk500v2
|
|||
AVRDUDE_PROGRAMMER:=stk500v1 |
|||
|
|||
#=== identify user files ===
|
|||
PDESRC:=$(shell ls *.pde) |
|||
TARGETNAME=$(basename $(PDESRC)) |
|||
|
|||
CDIRS:=$(EXTRA_DIRS) $(addsuffix utility/,$(EXTRA_DIRS)) |
|||
CDIRS:=*.c utility/*.c $(addsuffix *.c,$(CDIRS)) $(ARDUINO_PATH)hardware/arduino/cores/arduino/*.c |
|||
CSRC:=$(shell ls $(CDIRS) 2>/dev/null) |
|||
|
|||
CCSRC:=$(shell ls *.cc 2>/dev/null) |
|||
|
|||
CPPDIRS:=$(EXTRA_DIRS) $(addsuffix utility/,$(EXTRA_DIRS)) |
|||
CPPDIRS:=*.cpp utility/*.cpp $(addsuffix *.cpp,$(CPPDIRS)) $(ARDUINO_PATH)hardware/arduino/cores/arduino/*.cpp |
|||
CPPSRC:=$(shell ls $(CPPDIRS) 2>/dev/null) |
|||
|
|||
#=== build internal variables ===
|
|||
|
|||
# the name of the subdirectory where everything is stored
|
|||
TMPDIRNAME:=tmp |
|||
TMPDIRPATH:=$(TMPDIRNAME)/ |
|||
|
|||
AVRTOOLSPATH:=$(AVR_TOOLS_PATH) |
|||
|
|||
OBJCOPY:=$(AVRTOOLSPATH)avr-objcopy |
|||
OBJDUMP:=$(AVRTOOLSPATH)avr-objdump |
|||
SIZE:=$(AVRTOOLSPATH)avr-size |
|||
|
|||
CPPSRC:=$(addprefix $(TMPDIRPATH),$(PDESRC:.pde=.cpp)) $(CPPSRC) |
|||
|
|||
COBJ:=$(CSRC:.c=.o) |
|||
CCOBJ:=$(CCSRC:.cc=.o) |
|||
CPPOBJ:=$(CPPSRC:.cpp=.o) |
|||
|
|||
OBJFILES:=$(COBJ) $(CCOBJ) $(CPPOBJ) |
|||
DIRS:= $(dir $(OBJFILES)) |
|||
|
|||
DEPFILES:=$(OBJFILES:.o=.d) |
|||
# assembler files from avr-gcc -S
|
|||
ASSFILES:=$(OBJFILES:.o=.s) |
|||
# disassembled object files with avr-objdump -S
|
|||
DISFILES:=$(OBJFILES:.o=.dis) |
|||
|
|||
|
|||
LIBNAME:=$(TMPDIRPATH)$(TARGETNAME).a |
|||
ELFNAME:=$(TMPDIRPATH)$(TARGETNAME).elf |
|||
HEXNAME:=$(TMPDIRPATH)$(TARGETNAME).hex |
|||
|
|||
AVRDUDE_FLAGS = -V -F |
|||
AVRDUDE_FLAGS += -C $(ARDUINO_PATH)/hardware/tools/avrdude.conf |
|||
AVRDUDE_FLAGS += -p $(MCU) |
|||
AVRDUDE_FLAGS += -P $(AVRDUDE_PORT) |
|||
AVRDUDE_FLAGS += -c $(AVRDUDE_PROGRAMMER) |
|||
AVRDUDE_FLAGS += -b $(AVRDUDE_UPLOAD_RATE) |
|||
AVRDUDE_FLAGS += -U flash:w:$(HEXNAME) |
|||
|
|||
AVRDUDE = avrdude |
|||
|
|||
#=== predefined variable override ===
|
|||
# use "make -p -f/dev/null" to see the default rules and definitions
|
|||
|
|||
# Build C and C++ flags. Include path information must be placed here
|
|||
COMMON_FLAGS = -DF_CPU=$(F_CPU) -mmcu=$(MCU) $(DEFS) |
|||
# COMMON_FLAGS += -gdwarf-2
|
|||
COMMON_FLAGS += -Os |
|||
COMMON_FLAGS += -Wall -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums |
|||
COMMON_FLAGS += -I. |
|||
COMMON_FLAGS += -I$(ARDUINO_PATH)hardware/arduino/cores/arduino |
|||
COMMON_FLAGS += $(addprefix -I,$(EXTRA_DIRS)) |
|||
COMMON_FLAGS += -ffunction-sections -fdata-sections -Wl,--gc-sections |
|||
COMMON_FLAGS += -Wl,--relax |
|||
COMMON_FLAGS += -mcall-prologues |
|||
SRC = $(ARDUINO)/pins_arduino.c $(ARDUINO)/wiring.c \
|
|||
$(ARDUINO)/wiring_analog.c $(ARDUINO)/wiring_digital.c \
|
|||
$(ARDUINO)/wiring_pulse.c \
|
|||
$(ARDUINO)/wiring_shift.c $(ARDUINO)/WInterrupts.c |
|||
# added applet/$(TARGET).cpp as in IDE 0022
|
|||
CXXSRC = $(ARDUINO)/HardwareSerial.cpp $(ARDUINO)/WMath.cpp \
|
|||
$(ARDUINO)/Print.cpp \
|
|||
$(ARDUINO)/main.cpp |
|||
# applet/$(TARGET).cpp # no need, having a rule now for applet/$(TARGET).cpp.o
|
|||
# added main.cpp, as in 0022
|
|||
FORMAT = ihex |
|||
|
|||
# Name of this Makefile (used for "make depend").
|
|||
MAKEFILE = Makefile |
|||
|
|||
# Debugging format.
|
|||
# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2.
|
|||
# AVR (extended) COFF requires stabs, plus an avr-objcopy run.
|
|||
DEBUG = stabs |
|||
|
|||
OPT = 2 |
|||
|
|||
# Place -D or -U options here
|
|||
#~ CDEFS = -DBUILD_F_CPU=$(BUILD_F_CPU)
|
|||
#~ CXXDEFS = -DBUILD_F_CPU=$(BUILD_F_CPU)
|
|||
# now called DF_CPU
|
|||
CDEFS = -DF_CPU=$(BUILD_F_CPU) -DARDUINO=22 |
|||
CXXDEFS = -DF_CPU=$(BUILD_F_CPU) -DARDUINO=22 |
|||
|
|||
# Place -I options here
|
|||
CINCS = -I$(ARDUINO) -I$(INSTALL_DIR)/libraries/LiquidCrystal/ -I$(INSTALL_DIR)/libraries/EEPROM/ |
|||
CXXINCS = -I$(ARDUINO) |
|||
|
|||
# Compiler flag to set the C Standard level.
|
|||
# c89 - "ANSI" C
|
|||
# gnu89 - c89 plus GCC extensions
|
|||
# c99 - ISO C99 standard (not yet fully implemented)
|
|||
# gnu99 - c99 plus GCC extensions
|
|||
CSTANDARD = -std=gnu99 |
|||
CDEBUG = -g$(DEBUG) |
|||
# note that typically, IDE 0022 uses -w to suppress warnings (both in cpp and c)!
|
|||
CWARN = -Wall |
|||
#~ CWARN = -w
|
|||
# "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++:
|
|||
CCWARN = -Wstrict-prototypes |
|||
CTUNING = -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums |
|||
#CEXTRA = -Wa,-adhlns=$(<:.c=.lst)
|
|||
|
|||
# to eliminate pins_ardiuno warnings:
|
|||
# http://arduino.cc/pipermail/developers_arduino.cc/2010-December/004005.html
|
|||
|
|||
# [http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1254180518 Arduino Forum - Makefile]
|
|||
#~ For building the objects files "-ffunction-sections -fdata-sections" was missing
|
|||
#~ and the final avr-gcc call needs "-Wl,--gc-section".
|
|||
CXSECTF = -fno-exceptions -ffunction-sections -fdata-sections |
|||
CFINALF = -Wl,--gc-section |
|||
|
|||
CFLAGS = $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CWARN) $(CCWARN) $(CSTANDARD) $(CEXTRA) |
|||
# added CWARN also to .cpp
|
|||
CXXFLAGS = $(CDEFS) $(CINCS) -O$(OPT) $(CWARN) $(CXSECTF) |
|||
#ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
|
|||
LDFLAGS = -lm |
|||
|
|||
# Programming support using avrdude. Settings and variables.
|
|||
AVRDUDE_PORT = $(PORT) |
|||
AVRDUDE_WRITE_FLASH = -U flash:w:applet/$(TARGET).hex |
|||
AVRDUDE_FLAGS = -V -F \
|
|||
-p $(BUILD_MCU) -P $(AVRDUDE_PORT) -c $(UPLOAD_PROTOCOL) \
|
|||
-b $(UPLOAD_SPEED) -C $(INSTALL_DIR)/hardware/tools/avrdude.conf |
|||
# -b $(UPLOAD_SPEED) -C $(INSTALL_DIR)/hardware/tools/avr/etc/avrdude.conf
|
|||
|
|||
# Program settings
|
|||
CC = $(AVR_TOOLS_PATH)/avr-gcc |
|||
CXX = $(AVR_TOOLS_PATH)/avr-g++ |
|||
OBJCOPY = $(AVR_TOOLS_PATH)/avr-objcopy |
|||
OBJDUMP = $(AVR_TOOLS_PATH)/avr-objdump |
|||
AR = $(AVR_TOOLS_PATH)/avr-ar |
|||
SIZE = $(AVR_TOOLS_PATH)/avr-size |
|||
NM = $(AVR_TOOLS_PATH)/avr-nm |
|||
#~ AVRDUDE = $(AVR_TOOLS_PATH)/avrdude
|
|||
AVRDUDE = $(AVR_DUDE_PATH)/avrdude |
|||
REMOVE = rm -f |
|||
MV = mv -f |
|||
|
|||
# Define all object files.
|
|||
# NOTE: obj files will be created in respective src directories (libraries or $(INSTALL_DIR));
|
|||
# make clean deletes them fine
|
|||
# note that srcs are in libraries or other directories;
|
|||
# $(CXXSRC:.cpp=.o) will cause obj files to be in same loc as src files
|
|||
#~ OBJ = $(SRC:.c=.o) $(CXXSRC:.cpp=.o) $(ASRC:.S=.o)
|
|||
# to change the output directory for object files;
|
|||
# must change the obj list here!
|
|||
# and then, match to corresponding rule somehow?
|
|||
# or leave this - and parse in rule (auth automatic variable $(@F))?
|
|||
# "Suffix Replacement"
|
|||
OBJ = $(SRC:.c=.o) $(CXXSRC:.cpp=.o) $(ASRC:.S=.o) |
|||
|
|||
# added - OBJ list, transformed into applet/
|
|||
OBJT = $(addprefix applet/,$(notdir $(OBJ))) |
|||
ALLSRC = $(SRC) $(CXXSRC) $(ASRC) |
|||
|
|||
# Define all listing files.
|
|||
LST = $(ASRC:.S=.lst) $(CXXSRC:.cpp=.lst) $(SRC:.c=.lst) |
|||
|
|||
# Combine all necessary flags and optional flags.
|
|||
# Add target processor to flags.
|
|||
ALL_CFLAGS = -mmcu=$(BUILD_MCU) -I. $(CFLAGS) |
|||
ALL_CXXFLAGS = -mmcu=$(BUILD_MCU) -I. $(CXXFLAGS) |
|||
ALL_ASFLAGS = -mmcu=$(BUILD_MCU) -I. -x assembler-with-cpp $(ASFLAGS) |
|||
|
|||
# depended libraries of .pde need to be added from
|
|||
# $(INSTALL_DIR)/libraries (TODO: and/or ~/sketchbook/libraries)
|
|||
# grep for 'include', test if exists, add...
|
|||
# note: prefix "a real tab character" http://www.delorie.com/djgpp/doc/ug/larger/makefiles.html
|
|||
# $$ to escape $ for shell;
|
|||
# note: must NOT put comments # inside bash execution;
|
|||
# those would get removed by make; making shell see "EOF in backquote substitution"
|
|||
# echo $$ix ; \
|
|||
# 'shell' twice - for each subprocess! Backtick doesn't get expanded?
|
|||
GREPRES:=$(shell for ix in $(shell grep include $(TARGET).pde | sed 's/.*[<"]\(.*\).h[>"].*/\1/'); do \
|
|||
if [ -d $(INSTALL_DIR)/libraries/$$ix ] ; then \
|
|||
LINCS="$$LINCS -I$(INSTALL_DIR)/libraries/$$ix" ;\
|
|||
fi; \
|
|||
done; \
|
|||
echo $$LINCS) |
|||
# append includes:
|
|||
CINCS += $(GREPRES) |
|||
CXXINCS += $(GREPRES) |
|||
# append library source .cpp files too (CXXSRC)
|
|||
GREPRESB:=$(shell for ix in $(shell grep include $(TARGET).pde | sed 's/.*[<"]\(.*\).h[>"].*/\1/'); do \
|
|||
if [ -d $(INSTALL_DIR)/libraries/$$ix ] ; then \
|
|||
CPPSRCS="$$CPPSRCS $(INSTALL_DIR)/libraries/$$ix/*.cpp" ;\
|
|||
fi; \
|
|||
done; \
|
|||
echo $$CPPSRCS) |
|||
CXXSRC += $(GREPRESB) |
|||
# added - only CXX obj from libraries:
|
|||
CXXLIBOBJ = $(GREPRESB:.cpp=.o) |
|||
|
|||
# Default target.
|
|||
all: applet_files build sizeafter |
|||
|
|||
build: elf hex |
|||
|
|||
applet_files: $(TARGET).pde |
|||
# Here is the "preprocessing". |
|||
# It creates a .cpp file based with the same name as the .pde file. |
|||
# On top of the new .cpp file comes the WProgram.h header. |
|||
# At the end there is a generic main() function attached. |
|||
# Then the .cpp file will be compiled. Errors during compile will |
|||
# refer to this new, automatically generated, file. |
|||
# Not the original .pde file you actually edit... |
|||
test -d applet || mkdir applet |
|||
# @ supresses printout of the cmdline itself; so only the out of echo is printed |
|||
@echo ALL OBJT: $(OBJT) |
|||
@echo ALL CXXLIBOBJ: $(CXXLIBOBJ) |
|||
# echo '#include "WProgram.h"' > applet/$(TARGET).cpp
|
|||
@echo "#include \"WProgram.h\"\nvoid setup();\nvoid loop();\n" > applet/$(TARGET).cpp |
|||
cat $(TARGET).pde >> applet/$(TARGET).cpp |
|||
# no more need to cat main.cpp (v0022) - now it is compiled in |
|||
# cat $(ARDUINO)/main.cpp >> applet/$(TARGET).cpp
|
|||
|
|||
|
|||
elf: applet/$(TARGET).elf |
|||
hex: applet/$(TARGET).hex |
|||
eep: applet/$(TARGET).eep |
|||
lss: applet/$(TARGET).lss |
|||
sym: applet/$(TARGET).sym |
|||
|
|||
CFLAGS = $(COMMON_FLAGS) -std=gnu99 -Wstrict-prototypes |
|||
CXXFLAGS = $(COMMON_FLAGS) |
|||
|
|||
# Replace standard build tools by avr tools
|
|||
CC = $(AVRTOOLSPATH)avr-gcc |
|||
CXX = $(AVRTOOLSPATH)avr-g++ |
|||
AR = @$(AVRTOOLSPATH)avr-ar |
|||
|
|||
|
|||
# "rm" must be able to delete a directory tree
|
|||
RM = rm -rf |
|||
|
|||
#=== rules ===
|
|||
|
|||
# add rules for the C/C++ files where the .o file is placed in the TMPDIRPATH
|
|||
# reuse existing variables as far as possible
|
|||
|
|||
$(TMPDIRPATH)%.o: %.c |
|||
@echo compile $< |
|||
@$(COMPILE.c) $(OUTPUT_OPTION) $< |
|||
|
|||
$(TMPDIRPATH)%.o: %.cc |
|||
@echo compile $< |
|||
@$(COMPILE.cc) $(OUTPUT_OPTION) $< |
|||
# Program the device.
|
|||
upload: applet/$(TARGET).hex |
|||
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) |
|||
|
|||
$(TMPDIRPATH)%.o: %.cpp |
|||
@echo compile $< |
|||
@$(COMPILE.cpp) $(OUTPUT_OPTION) $< |
|||
# Display size of file.
|
|||
HEXSIZE = $(SIZE) --target=$(FORMAT) applet/$(TARGET).hex |
|||
ELFSIZE = $(SIZE) applet/$(TARGET).elf |
|||
sizebefore: |
|||
@if [ -f applet/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(HEXSIZE); echo; fi |
|||
|
|||
$(TMPDIRPATH)%.s: %.c |
|||
@$(COMPILE.c) $(OUTPUT_OPTION) -S $< |
|||
sizeafter: |
|||
@if [ -f applet/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(HEXSIZE); echo; fi |
|||
|
|||
$(TMPDIRPATH)%.s: %.cc |
|||
@$(COMPILE.cc) $(OUTPUT_OPTION) -S $< |
|||
# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
|
|||
COFFCONVERT=$(OBJCOPY) --debugging \
|
|||
--change-section-address .data-0x800000 \
|
|||
--change-section-address .bss-0x800000 \
|
|||
--change-section-address .noinit-0x800000 \
|
|||
--change-section-address .eeprom-0x810000 |
|||
|
|||
$(TMPDIRPATH)%.s: %.cpp |
|||
@$(COMPILE.cpp) $(OUTPUT_OPTION) -S $< |
|||
coff: applet/$(TARGET).elf |
|||
$(COFFCONVERT) -O coff-avr applet/$(TARGET).elf $(TARGET).cof |
|||
|
|||
$(TMPDIRPATH)%.dis: $(TMPDIRPATH)%.o |
|||
@$(OBJDUMP) -S $< > $@ |
|||
extcoff: $(TARGET).elf |
|||
$(COFFCONVERT) -O coff-ext-avr applet/$(TARGET).elf $(TARGET).cof |
|||
|
|||
.SUFFIXES: .elf .hex .pde |
|||
.SUFFIXES: .elf .hex .eep .lss .sym |
|||
|
|||
.elf.hex: |
|||
@$(OBJCOPY) -O ihex -R .eeprom $< $@ |
|||
|
|||
$(TMPDIRPATH)%.cpp: %.pde |
|||
@cat $(ARDUINO_PATH)hardware/arduino/cores/arduino/main.cpp > $@ |
|||
@cat $< >> $@ |
|||
@echo >> $@ |
|||
@echo 'extern "C" void __cxa_pure_virtual() { while (1); }' >> $@ |
|||
|
|||
|
|||
.PHONY: all |
|||
all: tmpdir $(HEXNAME) assemblersource showsize |
|||
ls -al $(HEXNAME) $(ELFNAME) |
|||
|
|||
$(ELFNAME): $(LIBNAME)($(addprefix $(TMPDIRPATH),$(OBJFILES))) |
|||
$(LINK.o) $(COMMON_FLAGS) $(LIBNAME) $(LOADLIBES) $(LDLIBS) -o $@ |
|||
|
|||
$(LIBNAME)(): $(addprefix $(TMPDIRPATH),$(OBJFILES)) |
|||
|
|||
#=== create temp directory ===
|
|||
# not really required, because it will be also created during the dependency handling
|
|||
.PHONY: tmpdir |
|||
tmpdir: |
|||
@test -d $(TMPDIRPATH) || mkdir $(TMPDIRPATH) |
|||
|
|||
#=== create assembler files for each C/C++ file ===
|
|||
.PHONY: assemblersource |
|||
assemblersource: $(addprefix $(TMPDIRPATH),$(ASSFILES)) $(addprefix $(TMPDIRPATH),$(DISFILES)) |
|||
|
|||
|
|||
#=== show the section sizes of the ELF file ===
|
|||
.PHONY: showsize |
|||
showsize: $(ELFNAME) |
|||
$(SIZE) $< |
|||
|
|||
#=== clean up target ===
|
|||
# this is simple: the TMPDIRPATH is removed
|
|||
.PHONY: clean |
|||
$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ |
|||
|
|||
.elf.eep: |
|||
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
|
|||
--change-section-lma .eeprom=0 -O $(FORMAT) $< $@ |
|||
|
|||
# Create extended listing file from ELF output file.
|
|||
.elf.lss: |
|||
$(OBJDUMP) -h -S $< > $@ |
|||
|
|||
# Create a symbol table from ELF output file.
|
|||
.elf.sym: |
|||
$(NM) -n $< > $@ |
|||
|
|||
# Link: create ELF output file from library.
|
|||
# NOTE: applet/$(TARGET).cpp.o MUST BE BEFORE applet/core.a
|
|||
# in the dependency list, so its rule runs first!
|
|||
applet/$(TARGET).elf: $(TARGET).pde applet/$(TARGET).cpp.o applet/core.a |
|||
# $(CC) $(ALL_CFLAGS) -o $@ applet/$(TARGET).cpp -L. applet/core.a $(LDFLAGS)
|
|||
# changed as in IDE v0022: link cpp obj files
|
|||
@echo $$(tput bold)$$(tput setaf 2) $(CC) $$(tput sgr0) $(ALL_CFLAGS) $(CFINALF) -o $@ applet/$(TARGET).cpp.o $(CXXOBJ) -L. applet/core.a $(LDFLAGS) |
|||
@$(CC) $(ALL_CFLAGS) $(CFINALF) -o $@ applet/$(TARGET).cpp.o $(CXXOBJ) -L. applet/core.a $(LDFLAGS) |
|||
|
|||
# added: cpp.o depends on cpp (and .pde which generates it)
|
|||
# $< "first item in the dependencies list"; $@ "left side of the :"; $^ "right side of the :"
|
|||
# http://www.cs.colby.edu/maxwell/courses/tutorials/maketutor/
|
|||
applet/$(TARGET).cpp.o: applet/$(TARGET).cpp |
|||
@echo $$(tput bold) $(CXX) $$(tput sgr0) -c $(ALL_CXXFLAGS) $< -o $@ |
|||
@$(CXX) -c $(ALL_CXXFLAGS) $< -o $@ |
|||
|
|||
#~ applet/core.a: $(OBJ)
|
|||
#~ @for i in $(OBJ); do echo $(AR) rcs applet/core.a $$i; $(AR) rcs applet/core.a $$i; done
|
|||
|
|||
applet/core.a: $(OBJT) |
|||
@for i in $(OBJT); do echo $(AR) rcs applet/core.a $$i; $(AR) rcs applet/core.a $$i; done |
|||
|
|||
# iterate through OBJ to find the original location; then build depending on source extension
|
|||
# TODO: add handling of assembler files
|
|||
applet/%.o: |
|||
@for iob in $(OBJ); do \
|
|||
if [ "`basename $$iob`" = "`basename $@`" ]; then \
|
|||
for ios in $(ALLSRC); do \
|
|||
if [ "$${iob%%.*}" = "$${ios%%.*}" ]; then \
|
|||
case $${ios##*.} in \
|
|||
"cpp") \
|
|||
echo "$$(tput bold)$$(tput setaf 1) $(CXX) $$(tput sgr0) -c $(ALL_CXXFLAGS) $$ios -o $@"; \
|
|||
$(CXX) -c $(ALL_CXXFLAGS) $$ios -o $@;; \
|
|||
"c") \
|
|||
echo "$$(tput bold)$$(tput setaf 1) $(CC) $$(tput sgr0) -c $(ALL_CFLAGS) $$ios -o $@"; \
|
|||
$(CC) -c $(ALL_CFLAGS) $$ios -o $@;; \
|
|||
esac; \
|
|||
fi; \
|
|||
done; \
|
|||
fi; \
|
|||
done; |
|||
|
|||
#~ # Compile: create object files from C++ source files.
|
|||
#~ .cpp.o:
|
|||
#~ $(CXX) -c $(ALL_CXXFLAGS) $< -o $@
|
|||
|
|||
#~ # Compile: create object files from C source files.
|
|||
#~ .c.o:
|
|||
#~ $(CC) -c $(ALL_CFLAGS) $< -o $@
|
|||
|
|||
#~ # Compile: create assembler files from C source files.
|
|||
#~ .c.s:
|
|||
#~ $(CC) -S $(ALL_CFLAGS) $< -o $@
|
|||
|
|||
#~ # Assemble: create object files from assembler source files.
|
|||
#~ .S.o:
|
|||
#~ $(CC) -c $(ALL_ASFLAGS) $< -o $@
|
|||
|
|||
#~ # Automatic dependencies
|
|||
#~ %.d: %.c
|
|||
#~ $(CC) -M $(ALL_CFLAGS) $< | sed "s;$(notdir $*).o:;$*.o $*.d:;" > $@
|
|||
|
|||
#~ %.d: %.cpp
|
|||
#~ $(CXX) -M $(ALL_CXXFLAGS) $< | sed "s;$(notdir $*).o:;$*.o $*.d:;" > $@
|
|||
|
|||
# Target: clean project.
|
|||
clean: |
|||
$(RM) $(TMPDIRPATH) |
|||
|
|||
# Program the device.
|
|||
# step 1: reset the arduino board with the stty command
|
|||
# step 2: user avrdude to upload the software
|
|||
.PHONY: upload |
|||
upload: $(HEXNAME) |
|||
stty -F $(AVRDUDE_PORT) hupcl |
|||
$(AVRDUDE) $(AVRDUDE_FLAGS) |
|||
|
|||
|
|||
# === dependency handling ===
|
|||
# From the gnu make manual (section 4.14, Generating Prerequisites Automatically)
|
|||
# Additionally (because this will be the first executed rule) TMPDIRPATH is created here.
|
|||
# Instead of "sed" the "echo" command is used
|
|||
# cd $(TMPDIRPATH); mkdir -p $(DIRS) 2> /dev/null; cd ..
|
|||
DEPACTION=test -d $(TMPDIRPATH) || mkdir $(TMPDIRPATH);\
|
|||
mkdir -p $(addprefix $(TMPDIRPATH),$(DIRS));\ |
|||
set -e; echo -n $@ $(dir $@) > $@; $(CC) -MM $(COMMON_FLAGS) $< >> $@ |
|||
|
|||
|
|||
$(TMPDIRPATH)%.d: %.c |
|||
@$(DEPACTION) |
|||
|
|||
$(TMPDIRPATH)%.d: %.cc |
|||
@$(DEPACTION) |
|||
|
|||
|
|||
$(TMPDIRPATH)%.d: %.cpp |
|||
@$(DEPACTION) |
|||
|
|||
# Include dependency files. If a .d file is missing, a warning is created and the .d file is created
|
|||
# This warning is not a problem (gnu make manual, section 3.3 Including Other Makefiles)
|
|||
-include $(addprefix $(TMPDIRPATH),$(DEPFILES)) |
|||
|
|||
$(REMOVE) applet/$(TARGET).hex applet/$(TARGET).eep applet/$(TARGET).cof applet/$(TARGET).elf \
|
|||
applet/$(TARGET).map applet/$(TARGET).sym applet/$(TARGET).lss applet/core.a \
|
|||
$(OBJT) applet/$(TARGET).cpp.o \
|
|||
$(OBJ) $(LST) $(SRC:.c=.s) $(SRC:.c=.d) $(CXXSRC:.cpp=.s) $(CXXSRC:.cpp=.d) |
|||
|
|||
.PHONY: all build elf hex eep lss sym program coff extcoff clean applet_files sizebefore sizeafter |
|||
|
@ -1,10 +0,0 @@ |
|||
#ifndef __LCDH |
|||
#define __LCDH |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
#endif |
@ -1 +0,0 @@ |
|||
|
@ -0,0 +1,69 @@ |
|||
WARNING: THIS IN A PROCESS OF HEAVY OVERWORKING. |
|||
DO NOT USE THIS ON YOUR MACHINE UNTIL FURTHER NOTICE!!! |
|||
|
|||
=========================================== |
|||
|
|||
This RepRap firmware is a mashup between <a href="https://github.com/kliment/Sprinter">Sprinter</a>, <a href="https://github.com/simen/grbl/tree">grbl</a> and many original parts. |
|||
|
|||
Derived from Sprinter and Grbl by Erik van der Zalm. |
|||
Sprinters lead developers are Kliment and caru. |
|||
Grbls lead developer is Simen Svale Skogsrud. |
|||
Some features have been added by and configuration has been added by: |
|||
Bernhard Kubicek, Matthijs Keuper, Bradley Feldman, and others... |
|||
|
|||
|
|||
Features: |
|||
- Interrupt based movement with real linear acceleration |
|||
- High steprate |
|||
- Look ahead (Keep the speed high when possible. High cornering speed) |
|||
- Interrupt based temperature protection |
|||
- preliminary support for Matthew Roberts advance algorithm |
|||
For more info see: http://reprap.org/pipermail/reprap-dev/2011-May/003323.html |
|||
- Full endstop support |
|||
- Simple LCD support (16x2) |
|||
- SD Card support |
|||
- Provisions for Bernhard Kubicek's new hardware control console and 20x4 lcd |
|||
|
|||
This firmware is optimized for Ultimaker's gen6 electronics (including the Ultimaker 1.5.x daughterboard and Arduino Mega 2560). |
|||
|
|||
The default baudrate is 115200. |
|||
|
|||
|
|||
======================================================================================== |
|||
|
|||
Configuring and compilation |
|||
|
|||
|
|||
Install the latest arduino software IDE/toolset (currently 0022) |
|||
http://www.arduino.cc/en/Main/Software |
|||
|
|||
Install Ultimaker's RepG 25 build |
|||
http://software.ultimaker.com |
|||
(or alternatively install Kliment's printrun/pronterface https://github.com/kliment/Printrun_) |
|||
|
|||
Copy the Ultimaker Marlin firmware |
|||
https:/github.com/bkubicek/Marlin |
|||
(Use the download button) |
|||
|
|||
Start the arduino IDE. |
|||
Select Tools -> Board -> Arduino Mega 2560 |
|||
Select the correct serial port in Tools ->Serial Port |
|||
Open Marlin.pde |
|||
|
|||
Click the Verify/Compile button |
|||
|
|||
Click the Upload button |
|||
If all goes well the firmware is uploading |
|||
|
|||
Start Ultimaker's Custom RepG 25 |
|||
Make sure Show Experimental Profiles is enabled in Preferences |
|||
Select Sprinter as the Driver |
|||
|
|||
Press the Connect button. |
|||
|
|||
KNOWN ISSUES: RepG will display: Unknown: marlin x.y.z |
|||
|
|||
That's ok. Enjoy Silky Smooth Printing. |
|||
|
|||
|
|||
|
@ -0,0 +1,58 @@ |
|||
files to compare manually: |
|||
planner.cpp |
|||
stepper.cpp |
|||
temperature.cpp |
|||
|
|||
--- |
|||
things that changed: |
|||
* planner.cpp |
|||
estimate_acc_distance now works with floats. |
|||
in calculate_trapezoid:for_block |
|||
long acceleration_rate=(long)((float)acceleration*8.388608) is gone |
|||
so is block_>acceleration_rate |
|||
void planner_reverse_pass: |
|||
some stuff I don't understand right now changed |
|||
in planner_forward_pass: |
|||
done: BLOCK_BUFFER_SIZE is now necessarily power of 2 (aka 8 16, 32). Inportant to document this somewhere. |
|||
no more inline in void plan_discard_current_block() |
|||
no more inline in plan_get_current_block() |
|||
in plan_buffer_line(...) |
|||
the long target[4]; and calculations of thoose should go after the while(block_buffer_tail==..). if the axis_steps_per_unit are changed from the gcode (M92) the calculation for the currently planned buffer move will be corrupt, because Target is calculated with one value, and the stuff afterwards with another. At least this solved the problem I had with the M92 E* changes in the code. Very sure about this, I took me 20min to find this as the solution for the bug I was hunting. |
|||
around if(feed_rate<minimumfeedrate) this only should be done if it is not a pure extrusion. I think there is a bug right now. |
|||
~line 447 blockcount= |
|||
not sure if this also works if the difference is negative, as it would happen if the ringbuffer runs over the end and start at 0. |
|||
~line 507 tmp_aceleration. not sure whats going on, but a lot changed. |
|||
|
|||
|
|||
* stepper.cpp |
|||
~214: if (busy) should be a echoln, maybe |
|||
~331: great, The Z_M_PIN checks are in :) |
|||
|
|||
*temperature.cpp |
|||
done: enum for heater, bed, |
|||
manage_heater() is seriously different. |
|||
done: if tem_meas_ready ==true->!true+return? |
|||
done #define K1 0.95 maybe in the configuration.h? |
|||
semi-done: PID-C checking needed. Untested but added. |
|||
---- |
|||
|
|||
still needed to finish the merge, before testin! |
|||
|
|||
manage_heater |
|||
ISR |
|||
movement planner |
|||
|
|||
TODO: |
|||
|
|||
remove traveling at maxpseed |
|||
remove Simplelcd |
|||
|
|||
remove DEBUG_STEPS? |
|||
|
|||
block_t |
|||
pid_dt ->0.1 whats the changes to the PID, checking needed |
|||
|
|||
|
|||
---- |
|||
second merge saturday morning: |
|||
done: PID_dt->0.1 |
Loading…
Reference in new issue