Просмотр исходного кода

Merge pull request #123 from buserror-uk/for-upstream

For upstream
ErikZalm 13 лет назад
Родитель
Сommit
8b785f75a6
3 измененных файлов: 246 добавлений и 49 удалений
  1. 3
    1
      Marlin/Configuration.h
  2. 88
    48
      Marlin/Makefile
  3. 155
    0
      Marlin/pins.h

+ 3
- 1
Marlin/Configuration.h Просмотреть файл

@@ -29,7 +29,9 @@
29 29
 // Ultimaker = 7
30 30
 // Teensylu = 8
31 31
 // Gen3+ =9
32
+#ifndef MOTHERBOARD
32 33
 #define MOTHERBOARD 7
34
+#endif
33 35
 
34 36
 //===========================================================================
35 37
 //=============================Thermal Settings  ============================
@@ -193,7 +195,7 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
193 195
 //#define ULTRA_LCD  //general lcd support, also 16x2
194 196
 //#define SDSUPPORT // Enable SD Card Support in Hardware Console
195 197
 
196
-#define ULTIPANEL
198
+//#define ULTIPANEL
197 199
 #ifdef ULTIPANEL
198 200
 //  #define NEWPANEL  //enable this if you have a click-encoder panel
199 201
   #define SDSUPPORT

+ 88
- 48
Marlin/Makefile Просмотреть файл

@@ -35,14 +35,31 @@
35 35
 # $Id$
36 36
 
37 37
 #For "old" Arduino Mega
38
-MCU = atmega1280
38
+#MCU = atmega1280
39 39
 #For Arduino Mega2560
40 40
 #MCU = atmega2560
41 41
 #For Sanguinololu
42
-#MCU = atmega644p 
42
+MCU = atmega644p 
43 43
 
44
-#Arduino install directory
45
-INSTALL_DIR = ../../arduino-0022/
44
+# Here you select "arduino", "Sanguino", "Gen7", ...
45
+HARDWARE_VARIANT 		= Sanguino
46
+# This defined the board you are compiling for
47
+HARDWARE_MOTHERBOARD	= 91
48
+
49
+# Arduino source install directory
50
+INSTALL_DIR = ../../arduino-0022
51
+
52
+# Arduino containd the main source code for the Arduino
53
+# Libraries, the "hardware variant" are for boards
54
+# that derives from that, and their source are present in
55
+# the main Marlin source directory
56
+ARDUINO = $(INSTALL_DIR)/hardware/arduino/cores/arduino
57
+
58
+ifeq (${HARDWARE_VARIANT}, arduino)
59
+HARDWARE_SRC= $(ARDUINO)
60
+else
61
+HARDWARE_SRC= $(HARDWARE_VARIANT)/cores/arduino
62
+endif
46 63
 
47 64
 # Be sure to regenerate speed_lookuptable.h with create_speed_lookuptable.py
48 65
 # if you are setting this to something other than 16MHz
@@ -54,21 +71,32 @@ PORT = /dev/arduino
54 71
 
55 72
 TARGET = $(notdir $(CURDIR))
56 73
 
74
+# VPATH tells make to look into these directory for source files,
75
+# there is no need to specify explicit pathnames as long as the
76
+# directory is added here
77
+
78
+VPATH = .
79
+VPATH += applet
80
+VPATH += $(HARDWARE_SRC)
81
+VPATH += $(ARDUINO)
82
+VPATH += $(INSTALL_DIR)/libraries/LiquidCrystal
57 83
 
58 84
 ############################################################################
59 85
 # Below here nothing should be changed...
60 86
 
61
-ARDUINO = $(INSTALL_DIR)/hardware/arduino/cores/arduino
62 87
 AVR_TOOLS_PATH = 
63
-SRC =  $(ARDUINO)/pins_arduino.c $(ARDUINO)/wiring.c \
64
-	$(ARDUINO)/wiring_analog.c $(ARDUINO)/wiring_digital.c \
65
-	$(ARDUINO)/wiring_pulse.c \
66
-	$(ARDUINO)/wiring_shift.c $(ARDUINO)/WInterrupts.c
67
-CXXSRC = $(ARDUINO)/WMath.cpp $(ARDUINO)/WString.cpp\
68
-	$(ARDUINO)/Print.cpp applet/Marlin.cpp MarlinSerial.cpp Sd2Card.cpp SdBaseFile.cpp SdFatUtil.cpp SdFile.cpp SdVolume.cpp motion_control.cpp planner.cpp stepper.cpp temperature.cpp cardreader.cpp
88
+SRC =  pins_arduino.c wiring.c \
89
+	wiring_analog.c wiring_digital.c \
90
+	wiring_pulse.c \
91
+	wiring_shift.c WInterrupts.c
92
+CXXSRC = WMath.cpp WString.cpp Print.cpp \
93
+	Marlin.cpp MarlinSerial.cpp Sd2Card.cpp SdBaseFile.cpp \
94
+	SdFatUtil.cpp SdFile.cpp SdVolume.cpp motion_control.cpp \
95
+	planner.cpp stepper.cpp temperature.cpp cardreader.cpp
96
+#CXXSRC += LiquidCrystal.cpp ultralcd.cpp
97
+#CXXSRC += ultralcd.cpp
69 98
 FORMAT = ihex
70 99
 
71
-
72 100
 # Name of this Makefile (used for "make depend").
73 101
 MAKEFILE = Makefile
74 102
 
@@ -83,9 +111,9 @@ OPT = s
83 111
 CDEFS = -DF_CPU=$(F_CPU)
84 112
 CXXDEFS = -DF_CPU=$(F_CPU)
85 113
 
86
-# Place -I options here
87
-CINCS = -I$(ARDUINO)
88
-CXXINCS = -I$(ARDUINO)
114
+# Add all the source directories as include directories too
115
+CINCS = ${patsubst %,-I%,${subst :, ,${VPATH}}}
116
+CXXINCS = ${patsubst %,-I%,${subst :, ,${VPATH}}}
89 117
 
90 118
 # Compiler flag to set the C Standard level.
91 119
 # c89   - "ANSI" C
@@ -95,7 +123,12 @@ CXXINCS = -I$(ARDUINO)
95 123
 #CSTANDARD = -std=gnu99
96 124
 CDEBUG = -g$(DEBUG)
97 125
 CWARN = -Wall -Wstrict-prototypes
98
-CTUNING = -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -w -ffunction-sections -fdata-sections -DARDUINO=22
126
+CTUNING = -funsigned-char -funsigned-bitfields -fpack-struct \
127
+	-fshort-enums -w -ffunction-sections -fdata-sections \
128
+	-DARDUINO=22
129
+ifneq (${HARDWARE_MOTHERBOARD},)
130
+CTUNING += -DMOTHERBOARD=${HARDWARE_MOTHERBOARD}
131
+endif
99 132
 #CEXTRA = -Wa,-adhlns=$(<:.c=.lst)
100 133
 
101 134
 CFLAGS = $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CWARN) $(CEXTRA) $(CTUNING)
@@ -124,7 +157,9 @@ REMOVE = rm -f
124 157
 MV = mv -f
125 158
 
126 159
 # Define all object files.
127
-OBJ = $(SRC:.c=.o) $(CXXSRC:.cpp=.o) $(ASRC:.S=.o) 
160
+OBJ = ${patsubst %.c, applet/%.o, ${SRC}}
161
+OBJ += ${patsubst %.cpp, applet/%.o, ${CXXSRC}}
162
+OBJ += ${patsubst %.S, applet/%.o, ${ASRC}}
128 163
 
129 164
 # Define all listing files.
130 165
 LST = $(ASRC:.S=.lst) $(CXXSRC:.cpp=.lst) $(SRC:.c=.lst)
@@ -132,30 +167,32 @@ LST = $(ASRC:.S=.lst) $(CXXSRC:.cpp=.lst) $(SRC:.c=.lst)
132 167
 # Combine all necessary flags and optional flags.
133 168
 # Add target processor to flags.
134 169
 ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS)
135
-ALL_CXXFLAGS = -mmcu=$(MCU) -I. $(CXXFLAGS)
136
-ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
170
+ALL_CXXFLAGS = -mmcu=$(MCU) $(CXXFLAGS)
171
+ALL_ASFLAGS = -mmcu=$(MCU) -x assembler-with-cpp $(ASFLAGS)
137 172
 
138 173
 
139 174
 # Default target.
140
-all: build sizeafter
175
+all: sizeafter
141 176
 
142
-build: elf hex 
177
+build: applet elf hex 
143 178
 
144
-applet/$(TARGET).cpp: $(TARGET).pde $(MAKEFILE)
179
+# Creates the object directory
180
+applet: 
181
+	@mkdir -p applet
182
+
183
+# the .cpp for Marlin depends on the .pde
184
+#applet/$(TARGET).cpp: $(TARGET).pde
185
+# ..and the .o depends from the .cpp
186
+#applet/%.o: applet/%.cpp
145 187
 
146 188
 applet/%.cpp: %.pde
147 189
 # Here is the "preprocessing".
148 190
 # It creates a .cpp file based with the same name as the .pde file.
149 191
 # On top of the new .cpp file comes the WProgram.h header.
150
-# At the end there is a generic main() function attached.
151
-# Then the .cpp file will be compiled. Errors during compile will
152
-# refer to this new, automatically generated, file. 
153
-# Not the original .pde file you actually edit...
154 192
 	@echo "  WR    $@"
155
-	@test -d $(dir $@) || mkdir $(dir $@)
156 193
 	@echo '#include "WProgram.h"' > $@
157
-	@cat $< >> $@
158
-	@cat $(ARDUINO)/main.cpp >> $@
194
+	@echo '#include "$<"' >>$@
195
+	@echo '#include "$(ARDUINO)/main.cpp"' >> $@
159 196
 
160 197
 elf: applet/$(TARGET).elf
161 198
 hex: applet/$(TARGET).hex
@@ -164,11 +201,15 @@ lss: applet/$(TARGET).lss
164 201
 sym: applet/$(TARGET).sym
165 202
 
166 203
 # Program the device.  
204
+# Do not try to reset an arduino if it's not one
167 205
 upload: applet/$(TARGET).hex
206
+ifeq (${AVRDUDE_PROGRAMMER}, arduino)
168 207
 	stty hup < $(PORT); true
208
+endif
169 209
 	$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH)
210
+ifeq (${AVRDUDE_PROGRAMMER}, arduino)
170 211
 	stty -hup < $(PORT); true
171
-
212
+endif
172 213
 
173 214
 	# Display size of file.
174 215
 HEXSIZE = $(SIZE) --target=$(FORMAT) applet/$(TARGET).hex
@@ -176,7 +217,7 @@ ELFSIZE = $(SIZE)  applet/$(TARGET).elf
176 217
 sizebefore:
177 218
 	@if [ -f applet/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(HEXSIZE); echo; fi
178 219
 
179
-sizeafter:
220
+sizeafter: build
180 221
 	@if [ -f applet/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
181 222
 
182 223
 
@@ -220,16 +261,22 @@ applet/$(TARGET).elf: applet/$(TARGET).cpp applet/core.a Configuration.h
220 261
 	@echo "  CXX   $@"
221 262
 	@$(CC) $(ALL_CXXFLAGS) -Wl,--gc-sections -o $@ applet/$(TARGET).cpp -L. applet/core.a $(LDFLAGS)
222 263
 
223
-applet/core.a: $(OBJ) Configuration.h
264
+applet/core.a: $(OBJ)
224 265
 	@for i in $(OBJ); do echo "  AR    $$i"; $(AR) rcs applet/core.a $$i; done
225 266
 
226
-%.o: %.c Configuration.h $(MAKEFILE)
267
+applet/%.o: %.c
227 268
 	@echo "  CC    $@"
228
-	@$(CC) -c $(ALL_CFLAGS) $< -o $@
269
+	@$(CC) -MMD -c $(ALL_CFLAGS) $< -o $@
270
+
271
+applet/%.o: %.cpp
272
+	@echo "  CXX   $@"
273
+	@$(CXX) -MMD -c $(ALL_CXXFLAGS) $< -o $@
229 274
 
230
-%.o: %.cpp Configuration.h $(MAKEFILE)
275
+# special rule for autogenerated files...
276
+applet/%.o: applet/%.cpp
231 277
 	@echo "  CXX   $@"
232
-	@$(CXX) -c $(ALL_CXXFLAGS) $< -o $@
278
+	@$(CXX) -MMD -c $(ALL_CXXFLAGS) $< -o $@
279
+
233 280
 
234 281
 # Target: clean project.
235 282
 clean:
@@ -238,17 +285,10 @@ clean:
238 285
 		applet/$(TARGET).map applet/$(TARGET).sym applet/$(TARGET).lss applet/$(TARGET).cpp applet/core.a \
239 286
 		$(OBJ) $(LST) $(SRC:.c=.s) $(SRC:.c=.d) $(CXXSRC:.cpp=.s) $(CXXSRC:.cpp=.d)
240 287
 	@echo "  RMDIR applet/"
241
-	@rmdir applet
242
-
243
-depend:
244
-	if grep '^# DO NOT DELETE' $(MAKEFILE) >/dev/null; \
245
-	then \
246
-		sed -e '/^# DO NOT DELETE/,$$d' $(MAKEFILE) > \
247
-			$(MAKEFILE).$$$$ && \
248
-		$(MV) $(MAKEFILE).$$$$ $(MAKEFILE); \
249
-	fi
250
-	echo '# DO NOT DELETE THIS LINE -- make depend depends on it.' \
251
-		>> $(MAKEFILE); \
252
-	$(CC) -M -mmcu=$(MCU) $(CDEFS) $(CINCS) $(SRC) $(ASRC) >> $(MAKEFILE)
288
+	@rm -rf applet
289
+
253 290
 
254 291
 .PHONY:	all build elf hex eep lss sym program coff extcoff clean depend applet_files sizebefore sizeafter
292
+
293
+# Automaticaly include the dependency files created by gcc
294
+-include ${wildcard applet/*.d}

+ 155
- 0
Marlin/pins.h Просмотреть файл

@@ -934,6 +934,161 @@
934 934
 
935 935
 
936 936
 
937
+/****************************************************************************************
938
+* Open Motion controller with enable based extruders
939
+*
940
+*                        ATMega644
941
+*
942
+*                        +---\/---+
943
+*            (D 0) PB0  1|        |40  PA0 (AI 0 / D31)
944
+*            (D 1) PB1  2|        |39  PA1 (AI 1 / D30)
945
+*       INT2 (D 2) PB2  3|        |38  PA2 (AI 2 / D29)
946
+*        PWM (D 3) PB3  4|        |37  PA3 (AI 3 / D28)
947
+*        PWM (D 4) PB4  5|        |36  PA4 (AI 4 / D27)
948
+*       MOSI (D 5) PB5  6|        |35  PA5 (AI 5 / D26)
949
+*       MISO (D 6) PB6  7|        |34  PA6 (AI 6 / D25)
950
+*        SCK (D 7) PB7  8|        |33  PA7 (AI 7 / D24)
951
+*                  RST  9|        |32  AREF
952
+*                  VCC 10|        |31  GND 
953
+*                  GND 11|        |30  AVCC
954
+*                XTAL2 12|        |29  PC7 (D 23)
955
+*                XTAL1 13|        |28  PC6 (D 22)
956
+*       RX0 (D 8)  PD0 14|        |27  PC5 (D 21) TDI
957
+*       TX0 (D 9)  PD1 15|        |26  PC4 (D 20) TDO
958
+*  INT0 RX1 (D 10) PD2 16|        |25  PC3 (D 19) TMS
959
+*  INT1 TX1 (D 11) PD3 17|        |24  PC2 (D 18) TCK
960
+*       PWM (D 12) PD4 18|        |23  PC1 (D 17) SDA
961
+*       PWM (D 13) PD5 19|        |22  PC0 (D 16) SCL
962
+*       PWM (D 14) PD6 20|        |21  PD7 (D 15) PWM
963
+*                        +--------+
964
+*
965
+****************************************************************************************/
966
+#if MOTHERBOARD == 90 //Alpha OMCA board
967
+#define KNOWN_BOARD 1
968
+
969
+#ifndef __AVR_ATmega644__
970
+#error Oops!  Make sure you have 'SanguinoA' selected from the 'Tools -> Boards' menu.
971
+#endif
972
+
973
+#define X_STEP_PIN         21
974
+#define X_DIR_PIN          20
975
+#define X_ENABLE_PIN       24
976
+#define X_MIN_PIN          0
977
+#define X_MAX_PIN          -1
978
+
979
+#define Y_STEP_PIN         23
980
+#define Y_DIR_PIN          22
981
+#define Y_ENABLE_PIN       24
982
+#define Y_MIN_PIN          1
983
+#define Y_MAX_PIN          -1
984
+
985
+#define Z_STEP_PIN         26
986
+#define Z_DIR_PIN          25
987
+#define Z_ENABLE_PIN       24
988
+#define Z_MIN_PIN          2
989
+#define Z_MAX_PIN          -1
990
+
991
+#define E0_STEP_PIN         28
992
+#define E0_DIR_PIN          27
993
+#define E0_ENABLE_PIN       24
994
+
995
+#define E1_STEP_PIN         -1 // 19
996
+#define E1_DIR_PIN          -1 // 18
997
+#define E1_ENABLE_PIN       24
998
+
999
+#define E2_STEP_PIN         -1 // 17
1000
+#define E2_DIR_PIN          -1 // 16
1001
+#define E2_ENABLE_PIN       24
1002
+
1003
+#define SDPOWER            -1
1004
+#define SDSS               11
1005
+#define SDCARDDETECT       -1 // 10 optional also used as mode pin
1006
+#define LED_PIN            -1
1007
+#define FAN_PIN            3
1008
+#define PS_ON_PIN          -1
1009
+#define KILL_PIN           -1
1010
+
1011
+#define HEATER_0_PIN       4
1012
+#define HEATER_1_PIN       -1 // 12 
1013
+#define HEATER_2_PIN       -1 // 13
1014
+#define TEMP_0_PIN          0 //D27   // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!!
1015
+#define TEMP_1_PIN         -1 // 1
1016
+#define TEMP_2_PIN         -1 // 2
1017
+#define HEATER_BED_PIN     -1 // 14/15
1018
+#define TEMP_BED_PIN       -1 // 1,2 or I2C
1019
+/*  Unused (1) (2) (3) 4 5 6 7 8 9 10 11 12 13 (14) (15) (16) 17 (18) (19) (20) (21) (22) (23) 24 (25) (26) (27) 28 (29) (30) (31)  */
1020
+
1021
+#endif
1022
+
1023
+#if MOTHERBOARD == 91  // Final OMCA board -- REF http://sanguino.cc/hardware
1024
+#define KNOWN_BOARD 1
1025
+
1026
+#if !defined(__AVR_ATmega644P__) && !defined(__AVR_ATmega644__)
1027
+#error Oops!  Make sure you have 'Sanguino' selected from the 'Tools -> Boards' menu. (Final OMCA board)
1028
+#endif
1029
+
1030
+#define X_STEP_PIN         26
1031
+#define X_DIR_PIN          25
1032
+#define X_ENABLE_PIN       10
1033
+#define X_MIN_PIN          0
1034
+#define X_MAX_PIN          -1
1035
+
1036
+#define Y_STEP_PIN         28
1037
+#define Y_DIR_PIN          27
1038
+#define Y_ENABLE_PIN       10
1039
+#define Y_MIN_PIN          1
1040
+#define Y_MAX_PIN          -1
1041
+
1042
+#define Z_STEP_PIN         23
1043
+#define Z_DIR_PIN          22
1044
+#define Z_ENABLE_PIN       10
1045
+#define Z_MIN_PIN          2
1046
+#define Z_MAX_PIN          -1
1047
+
1048
+#define E0_STEP_PIN         24
1049
+#define E0_DIR_PIN          21
1050
+#define E0_ENABLE_PIN       10
1051
+
1052
+/* future proofing */
1053
+#define __FS	20
1054
+#define __FD	19
1055
+#define __GS	18
1056
+#define __GD	13
1057
+
1058
+#define UNUSED_PWM           14	/* PWM on LEFT connector */
1059
+
1060
+#define E1_STEP_PIN         -1 // 21
1061
+#define E1_DIR_PIN          -1 // 20
1062
+#define E1_ENABLE_PIN       -1 // 19
1063
+
1064
+#define E2_STEP_PIN         -1 // 21
1065
+#define E2_DIR_PIN          -1 // 20
1066
+#define E2_ENABLE_PIN       -1 // 18
1067
+
1068
+#define SDPOWER            -1
1069
+#define SDSS               11
1070
+#define SDCARDDETECT       -1 // 10 optional also used as mode pin
1071
+#define LED_PIN            -1
1072
+#define FAN_PIN            14 /* PWM on MIDDLE connector */
1073
+#define PS_ON_PIN          -1
1074
+#define KILL_PIN           -1
1075
+
1076
+#define HEATER_0_PIN        3 /*DONE PWM on RIGHT connector */
1077
+#define HEATER_1_PIN       -1 
1078
+#define HEATER_2_PIN       -1
1079
+#define HEATER_1_PIN       -1 
1080
+#define HEATER_2_PIN       -1
1081
+#define TEMP_0_PIN          0 // ANALOG INPUT NUMBERING 
1082
+#define TEMP_1_PIN          1 // ANALOG
1083
+#define TEMP_2_PIN         -1 // 2
1084
+#define HEATER_BED_PIN      4
1085
+#define TEMP_BED_PIN        2 // 1,2 or I2C
1086
+
1087
+#define I2C_SCL				16
1088
+#define I2C_SDA				17
1089
+
1090
+#endif
1091
+
937 1092
 
938 1093
 #ifndef KNOWN_BOARD
939 1094
 #error Unknown MOTHERBOARD value in configuration.h

Загрузка…
Отмена
Сохранить