Browse Source

magic PROGMEM defines to avoid hundreds of wrong GCC warnings

MaikStohn 12 years ago
parent
commit
3682d9bd5b
2 changed files with 14 additions and 7 deletions
  1. 7
    0
      Marlin/Marlin.h
  2. 7
    7
      Marlin/thermistortables.h

+ 7
- 0
Marlin/Marlin.h View File

@@ -20,6 +20,13 @@
20 20
 #include  <avr/wdt.h>
21 21
 #include  <avr/interrupt.h>
22 22
 
23
+//do some magic defines in order to prevent hundreds of wrong warnings in gcc
24
+//more info here: http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&p=646359
25
+typedef short prog_short PROGMEM;
26
+#undef PROGMEM
27
+#define PROGMEM __attribute__(( section(".progmem.data") )) 
28
+#undef PSTR 
29
+#define PSTR(s) (__extension__({static prog_char __c[] PROGMEM = (s); &__c[0];})) 
23 30
 
24 31
 #include "fastio.h"
25 32
 #include "Configuration.h"

+ 7
- 7
Marlin/thermistortables.h View File

@@ -7,7 +7,7 @@
7 7
 
8 8
 #if (THERMISTORHEATER_0 == 1) || (THERMISTORHEATER_1 == 1)  || (THERMISTORHEATER_2 == 1) || (THERMISTORBED == 1) //100k bed thermistor
9 9
 
10
-const short temptable_1[][2] PROGMEM = {
10
+const prog_short temptable_1[][2] = {
11 11
 {       23*OVERSAMPLENR ,       300     },
12 12
 {       25*OVERSAMPLENR ,       295     },
13 13
 {       27*OVERSAMPLENR ,       290     },
@@ -72,7 +72,7 @@ const short temptable_1[][2] PROGMEM = {
72 72
 };
73 73
 #endif
74 74
 #if (THERMISTORHEATER_0 == 2) || (THERMISTORHEATER_1 == 2) || (THERMISTORHEATER_2 == 2) || (THERMISTORBED == 2) //200k bed thermistor
75
-const short temptable_2[][2] PROGMEM = {
75
+const prog_short temptable_2[][2] = {
76 76
    {1*OVERSAMPLENR, 848},
77 77
    {54*OVERSAMPLENR, 275},
78 78
    {107*OVERSAMPLENR, 228},
@@ -98,7 +98,7 @@ const short temptable_2[][2] PROGMEM = {
98 98
 
99 99
 #endif
100 100
 #if (THERMISTORHEATER_0 == 3) || (THERMISTORHEATER_1 == 3) || (THERMISTORHEATER_2 == 3) || (THERMISTORBED == 3) //mendel-parts
101
-const short temptable_3[][2] PROGMEM = {
101
+const prog_short temptable_3[][2] = {
102 102
                 {1*OVERSAMPLENR,864},
103 103
                 {21*OVERSAMPLENR,300},
104 104
                 {25*OVERSAMPLENR,290},
@@ -131,7 +131,7 @@ const short temptable_3[][2] PROGMEM = {
131 131
 
132 132
 #endif
133 133
 #if (THERMISTORHEATER_0 == 4) || (THERMISTORHEATER_1 == 4) || (THERMISTORHEATER_2 == 4) || (THERMISTORBED == 4) //10k thermistor
134
-const short temptable_4[][2] PROGMEM = {
134
+const prog_short temptable_4[][2] = {
135 135
    {1*OVERSAMPLENR, 430},
136 136
    {54*OVERSAMPLENR, 137},
137 137
    {107*OVERSAMPLENR, 107},
@@ -156,7 +156,7 @@ const short temptable_4[][2] PROGMEM = {
156 156
 #endif
157 157
 
158 158
 #if (THERMISTORHEATER_0 == 5) || (THERMISTORHEATER_1 == 5) || (THERMISTORHEATER_2 == 5) || (THERMISTORBED == 5) //100k ParCan thermistor (104GT-2)
159
-const short temptable_5[][2] PROGMEM = {
159
+const prog_short temptable_5[][2] = {
160 160
 {1*OVERSAMPLENR, 713},
161 161
 {18*OVERSAMPLENR, 316},
162 162
 {35*OVERSAMPLENR, 266},
@@ -222,7 +222,7 @@ const short temptable_5[][2] PROGMEM = {
222 222
 #endif
223 223
 
224 224
 #if (THERMISTORHEATER_0 == 6) || (THERMISTORHEATER_1 == 6) || (THERMISTORHEATER_2 == 6) || (THERMISTORBED == 6) // 100k Epcos thermistor
225
-const short temptable_6[][2] PROGMEM = {
225
+const prog_short temptable_6[][2] = {
226 226
    {28*OVERSAMPLENR, 250},
227 227
    {31*OVERSAMPLENR, 245},
228 228
    {35*OVERSAMPLENR, 240},
@@ -263,7 +263,7 @@ const short temptable_6[][2] PROGMEM = {
263 263
 #endif
264 264
 
265 265
 #if (THERMISTORHEATER_0 == 7) || (THERMISTORHEATER_1 == 7) || (THERMISTORHEATER_2 == 7) || (THERMISTORBED == 7) // 100k Honeywell 135-104LAG-J01
266
-const short temptable_7[][2] PROGMEM = {
266
+const prog_short temptable_7[][2] = {
267 267
    {46*OVERSAMPLENR, 270},
268 268
    {50*OVERSAMPLENR, 265},
269 269
    {54*OVERSAMPLENR, 260},

Loading…
Cancel
Save