Parcourir la source

Patches to work around "register spill" compiler bug

Scott Lahteine il y a 7 ans
Parent
révision
6618346148
2 fichiers modifiés avec 15 ajouts et 1 suppressions
  1. 13
    0
      Marlin/temperature.cpp
  2. 2
    1
      Marlin/temperature.h

+ 13
- 0
Marlin/temperature.cpp Voir le fichier

@@ -24,6 +24,8 @@
24 24
  * temperature.cpp - temperature control
25 25
  */
26 26
 
27
+
28
+
27 29
 #include "Marlin.h"
28 30
 #include "ultralcd.h"
29 31
 #include "temperature.h"
@@ -666,6 +668,17 @@ float Temperature::get_pid_output(int e) {
666 668
  *  - Apply filament width to the extrusion rate (may move)
667 669
  *  - Update the heated bed PID output value
668 670
  */
671
+
672
+/**
673
+ * The following line SOMETIMES results in the dreaded "unable to find a register to spill in class 'POINTER_REGS'"
674
+ * compile error.
675
+ *    thermal_runaway_protection(&thermal_runaway_state_machine[e], &thermal_runaway_timer[e], current_temperature[e], target_temperature[e], e, THERMAL_PROTECTION_PERIOD, THERMAL_PROTECTION_HYSTERESIS);
676
+ *
677
+ * This is due to a bug in the C++ compiler used by the Arduino IDE from 1.6.10 to at least 1.8.1.
678
+ *
679
+ * The work around is to add the compiler flag "__attribute__((__optimize__("O2")))" to the declaration for manage_heater()
680
+ */
681
+//void Temperature::manage_heater()  __attribute__((__optimize__("O2")));
669 682
 void Temperature::manage_heater() {
670 683
 
671 684
   if (!temp_meas_ready) return;

+ 2
- 1
Marlin/temperature.h Voir le fichier

@@ -241,7 +241,8 @@ class Temperature {
241 241
     /**
242 242
      * Call periodically to manage heaters
243 243
      */
244
-    static void manage_heater();
244
+    //static void manage_heater(); // changed to address compiler error
245
+    static void manage_heater()  __attribute__((__optimize__("O2")));
245 246
 
246 247
     /**
247 248
      * Preheating hotends

Chargement…
Annuler
Enregistrer