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
 #include  <avr/wdt.h>
20
 #include  <avr/wdt.h>
21
 #include  <avr/interrupt.h>
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
 #include "fastio.h"
31
 #include "fastio.h"
25
 #include "Configuration.h"
32
 #include "Configuration.h"

+ 7
- 7
Marlin/thermistortables.h View File

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

Loading…
Cancel
Save