Browse Source

Merge branch 'Marlin_v1' of github.com:ErikZalm/Marlin into Marlin_v1

Daid 12 years ago
parent
commit
673577a31b
4 changed files with 38 additions and 27 deletions
  1. 27
    17
      Marlin/Makefile
  2. 5
    4
      Marlin/temperature.cpp
  3. 4
    4
      Marlin/thermistortables.h
  4. 2
    2
      Marlin/ultralcd.cpp

+ 27
- 17
Marlin/Makefile View File

229
 
229
 
230
 DEFINES ?=
230
 DEFINES ?=
231
 
231
 
232
+# Program settings
233
+CC = $(AVR_TOOLS_PATH)avr-gcc
234
+CXX = $(AVR_TOOLS_PATH)avr-g++
235
+OBJCOPY = $(AVR_TOOLS_PATH)avr-objcopy
236
+OBJDUMP = $(AVR_TOOLS_PATH)avr-objdump
237
+AR  = $(AVR_TOOLS_PATH)avr-ar
238
+SIZE = $(AVR_TOOLS_PATH)avr-size
239
+NM = $(AVR_TOOLS_PATH)avr-nm
240
+AVRDUDE = avrdude
241
+REMOVE = rm -f
242
+MV = mv -f
243
+
244
+# Tool for testing compiler flags
245
+cc-option=$(shell if test -z "`$(1) $(2) -S -o /dev/null -xc /dev/null 2>&1`" \
246
+    ; then echo "$(2)"; else echo "$(3)"; fi ;)
247
+
232
 # Place -D or -U options here
248
 # Place -D or -U options here
233
 CDEFS    = -DF_CPU=$(F_CPU) ${addprefix -D , $(DEFINES)}
249
 CDEFS    = -DF_CPU=$(F_CPU) ${addprefix -D , $(DEFINES)}
234
 CXXDEFS  = $(CDEFS)
250
 CXXDEFS  = $(CDEFS)
259
 endif
275
 endif
260
 #CEXTRA = -Wa,-adhlns=$(<:.c=.lst)
276
 #CEXTRA = -Wa,-adhlns=$(<:.c=.lst)
261
 
277
 
262
-CFLAGS = $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CWARN) $(CEXTRA) $(CTUNING)
263
-CXXFLAGS =         $(CDEFS) $(CINCS) -O$(OPT) -Wall    $(CEXTRA) $(CTUNING)
278
+CFLAGS := $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CWARN) $(CEXTRA) $(CTUNING) \
279
+    $(call cc-option,$(CC),-flto -fwhole-program,)
280
+CXXFLAGS :=         $(CDEFS) $(CINCS) -O$(OPT) -Wall    $(CEXTRA) $(CTUNING) \
281
+    $(call cc-option,$(CC),-flto -fwhole-program,)
264
 #ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs 
282
 #ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs 
265
-LDFLAGS = -lm
283
+LDFLAGS = -lm -Wl,--relax
266
 
284
 
267
 
285
 
268
 # Programming support using avrdude. Settings and variables.
286
 # Programming support using avrdude. Settings and variables.
272
 	-p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) \
290
 	-p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) \
273
 	-b $(UPLOAD_RATE)
291
 	-b $(UPLOAD_RATE)
274
 
292
 
275
-# Program settings
276
-CC = $(AVR_TOOLS_PATH)avr-gcc
277
-CXX = $(AVR_TOOLS_PATH)avr-g++
278
-OBJCOPY = $(AVR_TOOLS_PATH)avr-objcopy
279
-OBJDUMP = $(AVR_TOOLS_PATH)avr-objdump
280
-AR  = $(AVR_TOOLS_PATH)avr-ar
281
-SIZE = $(AVR_TOOLS_PATH)avr-size
282
-NM = $(AVR_TOOLS_PATH)avr-nm
283
-AVRDUDE = avrdude
284
-REMOVE = rm -f
285
-MV = mv -f
286
-
287
 # Define all object files.
293
 # Define all object files.
288
 OBJ = ${patsubst %.c, $(BUILD_DIR)/%.o, ${SRC}}
294
 OBJ = ${patsubst %.c, $(BUILD_DIR)/%.o, ${SRC}}
289
 OBJ += ${patsubst %.cpp, $(BUILD_DIR)/%.o, ${CXXSRC}}
295
 OBJ += ${patsubst %.cpp, $(BUILD_DIR)/%.o, ${CXXSRC}}
380
 	$(NM) -n $< > $@
386
 	$(NM) -n $< > $@
381
 
387
 
382
 	# Link: create ELF output file from library.
388
 	# Link: create ELF output file from library.
383
-$(BUILD_DIR)/$(TARGET).elf: $(OBJ) Configuration.h
389
+$(BUILD_DIR)/$(TARGET).elf: $(BUILD_DIR)/$(TARGET).o
390
+	$(Pecho) "  CXX   $@"
391
+	$P $(CC) $(ALL_CXXFLAGS) -Wl,--gc-sections -o $@ -L. $^ $(LDFLAGS)
392
+
393
+$(BUILD_DIR)/$(TARGET).o: $(OBJ) Configuration.h
384
 	$(Pecho) "  CXX   $@"
394
 	$(Pecho) "  CXX   $@"
385
-	$P $(CC) $(ALL_CXXFLAGS) -Wl,--gc-sections -o $@ -L. $(OBJ) $(LDFLAGS)
395
+	$P $(CC) $(ALL_CXXFLAGS) -nostdlib -Wl,-r -o $@ $(OBJ)
386
 
396
 
387
 $(BUILD_DIR)/%.o: %.c Configuration.h Configuration_adv.h $(MAKEFILE)
397
 $(BUILD_DIR)/%.o: %.c Configuration.h Configuration_adv.h $(MAKEFILE)
388
 	$(Pecho) "  CC    $<"
398
 	$(Pecho) "  CC    $<"

+ 5
- 4
Marlin/temperature.cpp View File

432
 	    soft_pwm_bed = 0;
432
 	    soft_pwm_bed = 0;
433
 	  }
433
 	  }
434
 
434
 
435
-    #elif not defined BED_LIMIT_SWITCHING
435
+    #elif !defined(BED_LIMIT_SWITCHING)
436
       // Check if temperature is within the correct range
436
       // Check if temperature is within the correct range
437
-      if((current_temperature_bed > BED_MAXTEMP) && (current_temperature_bed < BED_MINTEMP))
437
+      if((current_temperature_bed > BED_MINTEMP) && (current_temperature_bed < BED_MAXTEMP))
438
       {
438
       {
439
         if(current_temperature_bed >= target_temperature_bed)
439
         if(current_temperature_bed >= target_temperature_bed)
440
         {
440
         {
1042
 #if EXTRUDERS > 2
1042
 #if EXTRUDERS > 2
1043
       current_temperature_raw[2] = raw_temp_2_value;
1043
       current_temperature_raw[2] = raw_temp_2_value;
1044
 #endif
1044
 #endif
1045
+      current_temperature_bed_raw = raw_temp_bed_value;
1045
     }
1046
     }
1046
     
1047
     
1047
     temp_meas_ready = true;
1048
     temp_meas_ready = true;
1101
   /* No bed MINTEMP error? */
1102
   /* No bed MINTEMP error? */
1102
 #if defined(BED_MAXTEMP) && (TEMP_SENSOR_BED != 0)
1103
 #if defined(BED_MAXTEMP) && (TEMP_SENSOR_BED != 0)
1103
 # if HEATER_BED_RAW_LO_TEMP > HEATER_BED_RAW_HI_TEMP
1104
 # if HEATER_BED_RAW_LO_TEMP > HEATER_BED_RAW_HI_TEMP
1104
-    if(current_temperature_bed <= bed_maxttemp_raw) {
1105
+    if(current_temperature_bed_raw <= bed_maxttemp_raw) {
1105
 #else
1106
 #else
1106
-    if(current_temperature_bed >= bed_maxttemp_raw) {
1107
+    if(current_temperature_bed_raw >= bed_maxttemp_raw) {
1107
 #endif
1108
 #endif
1108
        target_temperature_bed = 0;
1109
        target_temperature_bed = 0;
1109
        bed_max_temp_error();
1110
        bed_max_temp_error();

+ 4
- 4
Marlin/thermistortables.h View File

474
 
474
 
475
 //Set the high and low raw values for the heater, this indicates which raw value is a high or low temperature
475
 //Set the high and low raw values for the heater, this indicates which raw value is a high or low temperature
476
 #ifndef HEATER_0_RAW_HI_TEMP
476
 #ifndef HEATER_0_RAW_HI_TEMP
477
-# if HEATER_0_USES_THERMISTOR   //In case of a thermistor the highest temperature results in the lowest ADC value
477
+# ifdef HEATER_0_USES_THERMISTOR   //In case of a thermistor the highest temperature results in the lowest ADC value
478
 #  define HEATER_0_RAW_HI_TEMP 0
478
 #  define HEATER_0_RAW_HI_TEMP 0
479
 #  define HEATER_0_RAW_LO_TEMP 16383
479
 #  define HEATER_0_RAW_LO_TEMP 16383
480
 # else                          //In case of an thermocouple the highest temperature results in the highest ADC value
480
 # else                          //In case of an thermocouple the highest temperature results in the highest ADC value
497
 
497
 
498
 //Set the high and low raw values for the heater, this indicates which raw value is a high or low temperature
498
 //Set the high and low raw values for the heater, this indicates which raw value is a high or low temperature
499
 #ifndef HEATER_1_RAW_HI_TEMP
499
 #ifndef HEATER_1_RAW_HI_TEMP
500
-# if HEATER_1_USES_THERMISTOR   //In case of a thermistor the highest temperature results in the lowest ADC value
500
+# ifdef HEATER_1_USES_THERMISTOR   //In case of a thermistor the highest temperature results in the lowest ADC value
501
 #  define HEATER_1_RAW_HI_TEMP 0
501
 #  define HEATER_1_RAW_HI_TEMP 0
502
 #  define HEATER_1_RAW_LO_TEMP 16383
502
 #  define HEATER_1_RAW_LO_TEMP 16383
503
 # else                          //In case of an thermocouple the highest temperature results in the highest ADC value
503
 # else                          //In case of an thermocouple the highest temperature results in the highest ADC value
520
 
520
 
521
 //Set the high and low raw values for the heater, this indicates which raw value is a high or low temperature
521
 //Set the high and low raw values for the heater, this indicates which raw value is a high or low temperature
522
 #ifndef HEATER_2_RAW_HI_TEMP
522
 #ifndef HEATER_2_RAW_HI_TEMP
523
-# if HEATER_2_USES_THERMISTOR   //In case of a thermistor the highest temperature results in the lowest ADC value
523
+# ifdef HEATER_2_USES_THERMISTOR   //In case of a thermistor the highest temperature results in the lowest ADC value
524
 #  define HEATER_2_RAW_HI_TEMP 0
524
 #  define HEATER_2_RAW_HI_TEMP 0
525
 #  define HEATER_2_RAW_LO_TEMP 16383
525
 #  define HEATER_2_RAW_LO_TEMP 16383
526
 # else                          //In case of an thermocouple the highest temperature results in the highest ADC value
526
 # else                          //In case of an thermocouple the highest temperature results in the highest ADC value
540
 
540
 
541
 //Set the high and low raw values for the heater, this indicates which raw value is a high or low temperature
541
 //Set the high and low raw values for the heater, this indicates which raw value is a high or low temperature
542
 #ifndef HEATER_BED_RAW_HI_TEMP
542
 #ifndef HEATER_BED_RAW_HI_TEMP
543
-# if BED_USES_THERMISTOR   //In case of a thermistor the highest temperature results in the lowest ADC value
543
+# ifdef BED_USES_THERMISTOR   //In case of a thermistor the highest temperature results in the lowest ADC value
544
 #  define HEATER_BED_RAW_HI_TEMP 0
544
 #  define HEATER_BED_RAW_HI_TEMP 0
545
 #  define HEATER_BED_RAW_LO_TEMP 16383
545
 #  define HEATER_BED_RAW_LO_TEMP 16383
546
 # else                          //In case of an thermocouple the highest temperature results in the highest ADC value
546
 # else                          //In case of an thermocouple the highest temperature results in the highest ADC value

+ 2
- 2
Marlin/ultralcd.cpp View File

476
 #if TEMP_SENSOR_BED != 0
476
 #if TEMP_SENSOR_BED != 0
477
     MENU_ITEM_EDIT(int3, MSG_BED, &plaPreheatHPBTemp, 0, BED_MAXTEMP - 15);
477
     MENU_ITEM_EDIT(int3, MSG_BED, &plaPreheatHPBTemp, 0, BED_MAXTEMP - 15);
478
 #endif
478
 #endif
479
-#if EEPROM_SETTINGS
479
+#ifdef EEPROM_SETTINGS
480
     MENU_ITEM(function, MSG_STORE_EPROM, Config_StoreSettings);
480
     MENU_ITEM(function, MSG_STORE_EPROM, Config_StoreSettings);
481
 #endif
481
 #endif
482
     END_MENU();
482
     END_MENU();
491
 #if TEMP_SENSOR_BED != 0
491
 #if TEMP_SENSOR_BED != 0
492
     MENU_ITEM_EDIT(int3, MSG_BED, &absPreheatHPBTemp, 0, BED_MAXTEMP - 15);
492
     MENU_ITEM_EDIT(int3, MSG_BED, &absPreheatHPBTemp, 0, BED_MAXTEMP - 15);
493
 #endif
493
 #endif
494
-#if EEPROM_SETTINGS
494
+#ifdef EEPROM_SETTINGS
495
     MENU_ITEM(function, MSG_STORE_EPROM, Config_StoreSettings);
495
     MENU_ITEM(function, MSG_STORE_EPROM, Config_StoreSettings);
496
 #endif
496
 #endif
497
     END_MENU();
497
     END_MENU();

Loading…
Cancel
Save