diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index dfc1965e6..c8ad44e4d 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -789,6 +789,5 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #include "Configuration_adv.h" -#include "thermistortables.h" #endif //__CONFIGURATION_H diff --git a/Marlin/ConfigurationStore.cpp b/Marlin/ConfigurationStore.cpp index 8e4a32805..f0ad14905 100644 --- a/Marlin/ConfigurationStore.cpp +++ b/Marlin/ConfigurationStore.cpp @@ -369,14 +369,14 @@ void Config_RetrieveSettings() void Config_ResetDefault() { - float tmp1[]=DEFAULT_AXIS_STEPS_PER_UNIT; - float tmp2[]=DEFAULT_MAX_FEEDRATE; - long tmp3[]=DEFAULT_MAX_ACCELERATION; + const static float tmp1[] MARLIN_PROGMEM =DEFAULT_AXIS_STEPS_PER_UNIT; + const static float tmp2[] MARLIN_PROGMEM =DEFAULT_MAX_FEEDRATE; + const static long tmp3[] MARLIN_PROGMEM =DEFAULT_MAX_ACCELERATION; for (short i=0;i<4;i++) { - axis_steps_per_unit[i]=tmp1[i]; - max_feedrate[i]=tmp2[i]; - max_acceleration_units_per_sq_second[i]=tmp3[i]; + axis_steps_per_unit[i]=pgm_read_float(&tmp1[i]); + max_feedrate[i]=pgm_read_float(&tmp2[i]); + max_acceleration_units_per_sq_second[i]=pgm_read_float(&tmp3[i]); #ifdef SCARA axis_scaling[i]=1; #endif diff --git a/Marlin/LiquidCrystalRus.cpp b/Marlin/LiquidCrystalRus.cpp index 6ee2c112e..a9204a8a6 100644 --- a/Marlin/LiquidCrystalRus.cpp +++ b/Marlin/LiquidCrystalRus.cpp @@ -13,7 +13,7 @@ // it is a Russian alphabet translation // except 0401 --> 0xa2 = ╗, 0451 --> 0xb5 -const PROGMEM uint8_t utf_recode[] = +const prog_uint8_t utf_recode[] PROGMEM = { 0x41,0xa0,0x42,0xa1,0xe0,0x45,0xa3,0xa4,0xa5,0xa6,0x4b,0xa7,0x4d,0x48,0x4f, 0xa8,0x50,0x43,0x54,0xa9,0xaa,0x58,0xe1,0xab,0xac,0xe2,0xad,0xae,0x62,0xaf,0xb0,0xb1, 0x61,0xb2,0xb3,0xb4,0xe3,0x65,0xb6,0xb7,0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0x6f, diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index 7a1afa351..da1b4891b 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -41,6 +41,25 @@ #include "HardwareSerial.h" #endif + +#ifdef __GNUC__ +#ifndef GCC_VERSION2 +#define GCC_VERSION2 (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) +#endif + +#if GCC_VERSION2 < 40602 // Test for GCC < 4.6.2 +#ifdef PROGMEM +#define MARLIN_PROGMEM __attribute__((section(".progmem.data"))) +#ifdef PSTR +#undef PSTR +#define PSTR(s) (__extension__({static const prog_char __c[] MARLIN_PROGMEM = (s); &__c[0];})) // Copied from pgmspace.h in avr-libc source +#endif +#endif +#endif +#endif + + + #include "MarlinSerial.h" #ifndef cbi diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 0862e1fe0..40e4285a9 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -338,8 +338,8 @@ bool cancel_heatup = false ; int meas_delay_cm = MEASUREMENT_DELAY_CM; //distance delay setting #endif -const char errormagic[] PROGMEM = "Error:"; -const char echomagic[] PROGMEM = "echo:"; +const prog_char errormagic[] MARLIN_PROGMEM = "Error:"; +const prog_char echomagic[] MARLIN_PROGMEM = "echo:"; //=========================================================================== //=============================Private Variables============================= @@ -865,7 +865,7 @@ DEFINE_PGM_READ_ANY(float, float); DEFINE_PGM_READ_ANY(signed char, byte); #define XYZ_CONSTS_FROM_CONFIG(type, array, CONFIG) \ -static const PROGMEM type array##_P[3] = \ +static const type array##_P[3] MARLIN_PROGMEM = \ { X_##CONFIG, Y_##CONFIG, Z_##CONFIG }; \ static inline type array(int axis) \ { return pgm_read_any(&array##_P[axis]); } diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp index 5d9fba948..7c43ef65c 100644 --- a/Marlin/planner.cpp +++ b/Marlin/planner.cpp @@ -80,7 +80,7 @@ unsigned long axis_steps_per_sqr_second[NUM_AXIS]; matrix_3x3 plan_bed_level_matrix = { 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, - 0.0, 0.0, 1.0, + 0.0, 0.0, 1.0 }; #endif // #ifdef ENABLE_AUTO_BED_LEVELING diff --git a/Marlin/speed_lookuptable.h b/Marlin/speed_lookuptable.h index b7c00f1ae..67530a455 100644 --- a/Marlin/speed_lookuptable.h +++ b/Marlin/speed_lookuptable.h @@ -5,7 +5,7 @@ #if F_CPU == 16000000 -const uint16_t speed_lookuptable_fast[256][2] PROGMEM = {\ +const prog_uint16_t speed_lookuptable_fast[256][2] MARLIN_PROGMEM = {\ { 62500, 55556}, { 6944, 3268}, { 3676, 1176}, { 2500, 607}, { 1893, 369}, { 1524, 249}, { 1275, 179}, { 1096, 135}, { 961, 105}, { 856, 85}, { 771, 69}, { 702, 58}, { 644, 49}, { 595, 42}, { 553, 37}, { 516, 32}, { 484, 28}, { 456, 25}, { 431, 23}, { 408, 20}, { 388, 19}, { 369, 16}, { 353, 16}, { 337, 14}, @@ -40,7 +40,7 @@ const uint16_t speed_lookuptable_fast[256][2] PROGMEM = {\ { 31, 0}, { 31, 0}, { 31, 0}, { 31, 1}, { 30, 0}, { 30, 0}, { 30, 0}, { 30, 0} }; -const uint16_t speed_lookuptable_slow[256][2] PROGMEM = {\ +const prog_uint16_t speed_lookuptable_slow[256][2] MARLIN_PROGMEM = {\ { 62500, 12500}, { 50000, 8334}, { 41666, 5952}, { 35714, 4464}, { 31250, 3473}, { 27777, 2777}, { 25000, 2273}, { 22727, 1894}, { 20833, 1603}, { 19230, 1373}, { 17857, 1191}, { 16666, 1041}, { 15625, 920}, { 14705, 817}, { 13888, 731}, { 13157, 657}, { 12500, 596}, { 11904, 541}, { 11363, 494}, { 10869, 453}, { 10416, 416}, { 10000, 385}, { 9615, 356}, { 9259, 331}, @@ -77,7 +77,7 @@ const uint16_t speed_lookuptable_slow[256][2] PROGMEM = {\ #elif F_CPU == 20000000 -const uint16_t speed_lookuptable_fast[256][2] PROGMEM = { +const uint16_t speed_lookuptable_fast[256][2] MARLIN_PROGMEM = { {62500, 54055}, {8445, 3917}, {4528, 1434}, {3094, 745}, {2349, 456}, {1893, 307}, {1586, 222}, {1364, 167}, {1197, 131}, {1066, 105}, {961, 86}, {875, 72}, {803, 61}, {742, 53}, {689, 45}, {644, 40}, {604, 35}, {569, 32}, {537, 28}, {509, 25}, {484, 23}, {461, 21}, {440, 19}, {421, 17}, @@ -112,7 +112,7 @@ const uint16_t speed_lookuptable_fast[256][2] PROGMEM = { {39, 0}, {39, 0}, {39, 1}, {38, 0}, {38, 0}, {38, 0}, {38, 0}, {38, 0}, }; -const uint16_t speed_lookuptable_slow[256][2] PROGMEM = { +const uint16_t speed_lookuptable_slow[256][2] MARLIN_PROGMEM = { {62500, 10417}, {52083, 7441}, {44642, 5580}, {39062, 4340}, {34722, 3472}, {31250, 2841}, {28409, 2368}, {26041, 2003}, {24038, 1717}, {22321, 1488}, {20833, 1302}, {19531, 1149}, {18382, 1021}, {17361, 914}, {16447, 822}, {15625, 745}, {14880, 676}, {14204, 618}, {13586, 566}, {13020, 520}, {12500, 481}, {12019, 445}, {11574, 414}, {11160, 385}, diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 8bdb7647f..5b33c0079 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -33,6 +33,7 @@ #include "ultralcd.h" #include "temperature.h" #include "watchdog.h" +#include "thermistortables.h" #include "Sd2PinMap.h"