Parcourir la source

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

Daid il y a 12 ans
Parent
révision
673577a31b
4 fichiers modifiés avec 38 ajouts et 27 suppressions
  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 Voir le fichier

@@ -229,6 +229,22 @@ OPT = s
229 229
 
230 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 248
 # Place -D or -U options here
233 249
 CDEFS    = -DF_CPU=$(F_CPU) ${addprefix -D , $(DEFINES)}
234 250
 CXXDEFS  = $(CDEFS)
@@ -259,10 +275,12 @@ CTUNING += -DMOTHERBOARD=${HARDWARE_MOTHERBOARD}
259 275
 endif
260 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 282
 #ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs 
265
-LDFLAGS = -lm
283
+LDFLAGS = -lm -Wl,--relax
266 284
 
267 285
 
268 286
 # Programming support using avrdude. Settings and variables.
@@ -272,18 +290,6 @@ AVRDUDE_FLAGS = -D -C $(ARDUINO_INSTALL_DIR)/hardware/tools/avrdude.conf \
272 290
 	-p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) \
273 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 293
 # Define all object files.
288 294
 OBJ = ${patsubst %.c, $(BUILD_DIR)/%.o, ${SRC}}
289 295
 OBJ += ${patsubst %.cpp, $(BUILD_DIR)/%.o, ${CXXSRC}}
@@ -380,9 +386,13 @@ extcoff: $(TARGET).elf
380 386
 	$(NM) -n $< > $@
381 387
 
382 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 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 397
 $(BUILD_DIR)/%.o: %.c Configuration.h Configuration_adv.h $(MAKEFILE)
388 398
 	$(Pecho) "  CC    $<"

+ 5
- 4
Marlin/temperature.cpp Voir le fichier

@@ -432,9 +432,9 @@ void manage_heater()
432 432
 	    soft_pwm_bed = 0;
433 433
 	  }
434 434
 
435
-    #elif not defined BED_LIMIT_SWITCHING
435
+    #elif !defined(BED_LIMIT_SWITCHING)
436 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 439
         if(current_temperature_bed >= target_temperature_bed)
440 440
         {
@@ -1042,6 +1042,7 @@ ISR(TIMER0_COMPB_vect)
1042 1042
 #if EXTRUDERS > 2
1043 1043
       current_temperature_raw[2] = raw_temp_2_value;
1044 1044
 #endif
1045
+      current_temperature_bed_raw = raw_temp_bed_value;
1045 1046
     }
1046 1047
     
1047 1048
     temp_meas_ready = true;
@@ -1101,9 +1102,9 @@ ISR(TIMER0_COMPB_vect)
1101 1102
   /* No bed MINTEMP error? */
1102 1103
 #if defined(BED_MAXTEMP) && (TEMP_SENSOR_BED != 0)
1103 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 1106
 #else
1106
-    if(current_temperature_bed >= bed_maxttemp_raw) {
1107
+    if(current_temperature_bed_raw >= bed_maxttemp_raw) {
1107 1108
 #endif
1108 1109
        target_temperature_bed = 0;
1109 1110
        bed_max_temp_error();

+ 4
- 4
Marlin/thermistortables.h Voir le fichier

@@ -474,7 +474,7 @@ const short temptable_55[][2] PROGMEM = {
474 474
 
475 475
 //Set the high and low raw values for the heater, this indicates which raw value is a high or low temperature
476 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 478
 #  define HEATER_0_RAW_HI_TEMP 0
479 479
 #  define HEATER_0_RAW_LO_TEMP 16383
480 480
 # else                          //In case of an thermocouple the highest temperature results in the highest ADC value
@@ -497,7 +497,7 @@ const short temptable_55[][2] PROGMEM = {
497 497
 
498 498
 //Set the high and low raw values for the heater, this indicates which raw value is a high or low temperature
499 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 501
 #  define HEATER_1_RAW_HI_TEMP 0
502 502
 #  define HEATER_1_RAW_LO_TEMP 16383
503 503
 # else                          //In case of an thermocouple the highest temperature results in the highest ADC value
@@ -520,7 +520,7 @@ const short temptable_55[][2] PROGMEM = {
520 520
 
521 521
 //Set the high and low raw values for the heater, this indicates which raw value is a high or low temperature
522 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 524
 #  define HEATER_2_RAW_HI_TEMP 0
525 525
 #  define HEATER_2_RAW_LO_TEMP 16383
526 526
 # else                          //In case of an thermocouple the highest temperature results in the highest ADC value
@@ -540,7 +540,7 @@ const short temptable_55[][2] PROGMEM = {
540 540
 
541 541
 //Set the high and low raw values for the heater, this indicates which raw value is a high or low temperature
542 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 544
 #  define HEATER_BED_RAW_HI_TEMP 0
545 545
 #  define HEATER_BED_RAW_LO_TEMP 16383
546 546
 # else                          //In case of an thermocouple the highest temperature results in the highest ADC value

+ 2
- 2
Marlin/ultralcd.cpp Voir le fichier

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

Chargement…
Annuler
Enregistrer