From 3682d9bd5b34bdc6560d97278d6d7eff3243bddc Mon Sep 17 00:00:00 2001 From: MaikStohn Date: Thu, 3 May 2012 15:43:23 +0200 Subject: [PATCH] magic PROGMEM defines to avoid hundreds of wrong GCC warnings --- Marlin/Marlin.h | 7 +++++++ Marlin/thermistortables.h | 14 +++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index 5bb728c..5982302 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -20,6 +20,13 @@ #include #include +//do some magic defines in order to prevent hundreds of wrong warnings in gcc +//more info here: http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&p=646359 +typedef short prog_short PROGMEM; +#undef PROGMEM +#define PROGMEM __attribute__(( section(".progmem.data") )) +#undef PSTR +#define PSTR(s) (__extension__({static prog_char __c[] PROGMEM = (s); &__c[0];})) #include "fastio.h" #include "Configuration.h" diff --git a/Marlin/thermistortables.h b/Marlin/thermistortables.h index 3071a6b..0ac03d5 100644 --- a/Marlin/thermistortables.h +++ b/Marlin/thermistortables.h @@ -7,7 +7,7 @@ #if (THERMISTORHEATER_0 == 1) || (THERMISTORHEATER_1 == 1) || (THERMISTORHEATER_2 == 1) || (THERMISTORBED == 1) //100k bed thermistor -const short temptable_1[][2] PROGMEM = { +const prog_short temptable_1[][2] = { { 23*OVERSAMPLENR , 300 }, { 25*OVERSAMPLENR , 295 }, { 27*OVERSAMPLENR , 290 }, @@ -72,7 +72,7 @@ const short temptable_1[][2] PROGMEM = { }; #endif #if (THERMISTORHEATER_0 == 2) || (THERMISTORHEATER_1 == 2) || (THERMISTORHEATER_2 == 2) || (THERMISTORBED == 2) //200k bed thermistor -const short temptable_2[][2] PROGMEM = { +const prog_short temptable_2[][2] = { {1*OVERSAMPLENR, 848}, {54*OVERSAMPLENR, 275}, {107*OVERSAMPLENR, 228}, @@ -98,7 +98,7 @@ const short temptable_2[][2] PROGMEM = { #endif #if (THERMISTORHEATER_0 == 3) || (THERMISTORHEATER_1 == 3) || (THERMISTORHEATER_2 == 3) || (THERMISTORBED == 3) //mendel-parts -const short temptable_3[][2] PROGMEM = { +const prog_short temptable_3[][2] = { {1*OVERSAMPLENR,864}, {21*OVERSAMPLENR,300}, {25*OVERSAMPLENR,290}, @@ -131,7 +131,7 @@ const short temptable_3[][2] PROGMEM = { #endif #if (THERMISTORHEATER_0 == 4) || (THERMISTORHEATER_1 == 4) || (THERMISTORHEATER_2 == 4) || (THERMISTORBED == 4) //10k thermistor -const short temptable_4[][2] PROGMEM = { +const prog_short temptable_4[][2] = { {1*OVERSAMPLENR, 430}, {54*OVERSAMPLENR, 137}, {107*OVERSAMPLENR, 107}, @@ -156,7 +156,7 @@ const short temptable_4[][2] PROGMEM = { #endif #if (THERMISTORHEATER_0 == 5) || (THERMISTORHEATER_1 == 5) || (THERMISTORHEATER_2 == 5) || (THERMISTORBED == 5) //100k ParCan thermistor (104GT-2) -const short temptable_5[][2] PROGMEM = { +const prog_short temptable_5[][2] = { {1*OVERSAMPLENR, 713}, {18*OVERSAMPLENR, 316}, {35*OVERSAMPLENR, 266}, @@ -222,7 +222,7 @@ const short temptable_5[][2] PROGMEM = { #endif #if (THERMISTORHEATER_0 == 6) || (THERMISTORHEATER_1 == 6) || (THERMISTORHEATER_2 == 6) || (THERMISTORBED == 6) // 100k Epcos thermistor -const short temptable_6[][2] PROGMEM = { +const prog_short temptable_6[][2] = { {28*OVERSAMPLENR, 250}, {31*OVERSAMPLENR, 245}, {35*OVERSAMPLENR, 240}, @@ -263,7 +263,7 @@ const short temptable_6[][2] PROGMEM = { #endif #if (THERMISTORHEATER_0 == 7) || (THERMISTORHEATER_1 == 7) || (THERMISTORHEATER_2 == 7) || (THERMISTORBED == 7) // 100k Honeywell 135-104LAG-J01 -const short temptable_7[][2] PROGMEM = { +const prog_short temptable_7[][2] = { {46*OVERSAMPLENR, 270}, {50*OVERSAMPLENR, 265}, {54*OVERSAMPLENR, 260}, -- 2.30.2