From 39fae9e3a3f1e627058c594d4d1efd5e6262bb32 Mon Sep 17 00:00:00 2001 From: odewdney Date: Sat, 3 Jan 2015 21:30:16 +0000 Subject: [PATCH 1/5] Fix progmem warning Borrow code from https://github.com/arduino/Arduino/issues/1793 --- Marlin/Marlin.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index d8012976c..e0915ad64 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -38,6 +38,23 @@ #include "HardwareSerial.h" #endif + +#ifdef __GNUC__ +#ifndef GCC_VERSION +#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) +#endif +#if GCC_VERSION < 40602 // Test for GCC < 4.6.2 +#ifdef PROGMEM +#undef PROGMEM +#define PROGMEM __attribute__((section(".progmem.data"))) // Workaround for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34734#c4 +#ifdef PSTR +#undef PSTR +#define PSTR(s) (__extension__({static const char __c[] PROGMEM = (s); &__c[0];})) // Copied from pgmspace.h in avr-libc source +#endif +#endif +#endif +#endif + #include "MarlinSerial.h" #ifndef cbi @@ -269,4 +286,4 @@ extern void digipot_i2c_init(); #endif -extern void calculate_volumetric_multipliers(); \ No newline at end of file +extern void calculate_volumetric_multipliers(); From 652895d6562af8fe69530e516652fabedeebd218 Mon Sep 17 00:00:00 2001 From: odewdney Date: Sun, 4 Jan 2015 11:15:23 +0000 Subject: [PATCH 2/5] try different proproc for CI failure --- Marlin/Marlin.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index e0915ad64..2648a78ad 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -40,10 +40,11 @@ #ifdef __GNUC__ -#ifndef GCC_VERSION -#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) +#ifndef GCC_VERSION2 +#define GCC_VERSION2 (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) #endif -#if GCC_VERSION < 40602 // Test for GCC < 4.6.2 + +#if GCC_VERSION2 < 40602 // Test for GCC < 4.6.2 #ifdef PROGMEM #undef PROGMEM #define PROGMEM __attribute__((section(".progmem.data"))) // Workaround for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34734#c4 From 538859669d40b83a1100cb391c1be729db6b3fb9 Mon Sep 17 00:00:00 2001 From: odewdney Date: Sun, 11 Jan 2015 18:14:21 +0000 Subject: [PATCH 3/5] Removing compiler warnings for progmem --- Marlin/ConfigurationStore.cpp | 12 ++++++------ Marlin/LiquidCrystalRus.cpp | 2 +- Marlin/Marlin.h | 7 ++++--- Marlin/Marlin_main.cpp | 6 +++--- Marlin/planner.cpp | 2 +- Marlin/speed_lookuptable.h | 8 ++++---- Marlin/temperature.cpp | 1 + 7 files changed, 20 insertions(+), 18 deletions(-) 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 2648a78ad..4f4238a85 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -46,16 +46,17 @@ #if GCC_VERSION2 < 40602 // Test for GCC < 4.6.2 #ifdef PROGMEM -#undef PROGMEM -#define PROGMEM __attribute__((section(".progmem.data"))) // Workaround for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34734#c4 +#define MARLIN_PROGMEM __attribute__((section(".progmem.data"))) #ifdef PSTR #undef PSTR -#define PSTR(s) (__extension__({static const char __c[] PROGMEM = (s); &__c[0];})) // Copied from pgmspace.h in avr-libc source +#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 e3e5ef358..71d073d24 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 c8942251e..64746bbac 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 94d257d55..21809b7c7 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" From 23bfe30036b0c87c813f33cbd8b0cfd5802fcaf0 Mon Sep 17 00:00:00 2001 From: odewdney Date: Sun, 11 Jan 2015 18:18:32 +0000 Subject: [PATCH 4/5] moved include themister to temperature.c --- Marlin/Configuration.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index fe6e371c5..8c560834e 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -785,6 +785,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 From cd55a93a13e153355bf352a4f522067227a9f34e Mon Sep 17 00:00:00 2001 From: odewdney Date: Sun, 11 Jan 2015 19:22:35 +0000 Subject: [PATCH 5/5] re-add blank line --- Marlin/Marlin.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index 4f4238a85..2d6943676 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -289,3 +289,4 @@ extern void digipot_i2c_init(); #endif extern void calculate_volumetric_multipliers(); +