Patches to work around "register spill" compiler bug

2.0.x
Scott Lahteine 8 years ago
parent be7dd90382
commit 6618346148

@ -24,6 +24,8 @@
* temperature.cpp - temperature control * temperature.cpp - temperature control
*/ */
#include "Marlin.h" #include "Marlin.h"
#include "ultralcd.h" #include "ultralcd.h"
#include "temperature.h" #include "temperature.h"
@ -666,6 +668,17 @@ float Temperature::get_pid_output(int e) {
* - Apply filament width to the extrusion rate (may move) * - Apply filament width to the extrusion rate (may move)
* - Update the heated bed PID output value * - Update the heated bed PID output value
*/ */
/**
* The following line SOMETIMES results in the dreaded "unable to find a register to spill in class 'POINTER_REGS'"
* compile error.
* 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);
*
* 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.
*
* The work around is to add the compiler flag "__attribute__((__optimize__("O2")))" to the declaration for manage_heater()
*/
//void Temperature::manage_heater() __attribute__((__optimize__("O2")));
void Temperature::manage_heater() { void Temperature::manage_heater() {
if (!temp_meas_ready) return; if (!temp_meas_ready) return;

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

Loading…
Cancel
Save