eynarcalle / glcd-arduino

Automatically exported from code.google.com/p/glcd-arduino
0 stars 0 forks source link

PROGMEM, const and avr-gcc 4.8.1 / Arduino 1.5.7 [patch] #57

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Arduino 1.5.7 / avr-gcc 4.8.1 reports multiple:
error:  variable ... must be const in order to be put into read-only section by 
means of ‘__attribute__((progmem))’

The fix is to make the variable 'const'. Patch below.

What version of the product are you using? On what operating system?
glcd-v3-20111205
Arduino 1.5.7 (which includes avr-gcc 4.8.1)
OS X 10.9.4

Please provide any additional information below.

diff -wur glcd-v3-20111205/bitmaps/ArduinoIcon32.h glcd/bitmaps/ArduinoIcon32.h
--- glcd-v3-20111205/bitmaps/ArduinoIcon32.h    2011-12-05 01:50:18.000000000 +1100
+++ glcd/bitmaps/ArduinoIcon32.h    2014-07-24 20:00:37.000000000 +1000
@@ -10,7 +10,7 @@
 #ifndef ArduinoIcon32_H
 #define ArduinoIcon32_H

-static uint8_t ArduinoIcon32[] PROGMEM = {
+static const uint8_t ArduinoIcon32[] PROGMEM = {
   34, // width
   32, // height

diff -wur glcd-v3-20111205/bitmaps/ArduinoIcon32x32.h 
glcd/bitmaps/ArduinoIcon32x32.h
--- glcd-v3-20111205/bitmaps/ArduinoIcon32x32.h 2011-12-05 01:50:18.000000000 
+1100
+++ glcd/bitmaps/ArduinoIcon32x32.h 2014-07-24 20:02:01.000000000 +1000
@@ -8,7 +8,7 @@
 #ifndef ArduinoIcon32x32_H
 #define ArduinoIcon32x32_H

-static uint8_t ArduinoIcon32x32[] PROGMEM = {
+static const uint8_t ArduinoIcon32x32[] PROGMEM = {
   32, // width
   32, // height

diff -wur glcd-v3-20111205/bitmaps/ArduinoIcon64x32.h 
glcd/bitmaps/ArduinoIcon64x32.h
--- glcd-v3-20111205/bitmaps/ArduinoIcon64x32.h 2011-12-05 01:50:18.000000000 
+1100
+++ glcd/bitmaps/ArduinoIcon64x32.h 2014-07-24 20:02:06.000000000 +1000
@@ -22,7 +22,7 @@
 #include <inttypes.h>
 #include <avr/pgmspace.h>

-static unsigned char ArduinoIcon64x32[] PROGMEM ={
+static const unsigned char ArduinoIcon64x32[] PROGMEM ={
 64,    // bitmap width  (arduino glcdlib format)
 32,    // bitmap height (arduino glcdlib format)
 0x00, 0x00, 0xc0, 0x20, 0x10, 0x08, 0xc8, 0x88, 0x08, 0x08, 0x10, 0x20, 0xc0, 0x00, 0x00, 0x00, 
diff -wur glcd-v3-20111205/bitmaps/ArduinoIcon64x64.h 
glcd/bitmaps/ArduinoIcon64x64.h
--- glcd-v3-20111205/bitmaps/ArduinoIcon64x64.h 2011-12-05 01:50:18.000000000 
+1100
+++ glcd/bitmaps/ArduinoIcon64x64.h 2014-07-24 20:02:09.000000000 +1000
@@ -8,7 +8,7 @@
 #ifndef ArduinoIcon64x64_H
 #define ArduinoIcon64x64_H

-static uint8_t ArduinoIcon64x64[] PROGMEM = {
+static const uint8_t ArduinoIcon64x64[] PROGMEM = {
   64, // width
   64, // height

diff -wur glcd-v3-20111205/bitmaps/ArduinoIcon96x32.h 
glcd/bitmaps/ArduinoIcon96x32.h
--- glcd-v3-20111205/bitmaps/ArduinoIcon96x32.h 2011-12-05 01:50:18.000000000 
+1100
+++ glcd/bitmaps/ArduinoIcon96x32.h 2014-07-24 20:02:14.000000000 +1000
@@ -13,7 +13,7 @@
 #ifndef ArduinoIcon96x32_H
 #define ArduinoIcon96x32_H

-static unsigned char  ArduinoIcon96x32[] PROGMEM={
+static const unsigned char  ArduinoIcon96x32[] PROGMEM={
    96, // width
    32, //height
 0x00, 0x00, 0xc0, 0x20, 0x10, 0x08, 0xc8, 0x88, 0x08, 0x08, 0x10, 0x20, 0xc0, 0x00, 0x00, 0x00, 
diff -wur glcd-v3-20111205/fonts/Arial14.h glcd/fonts/Arial14.h
--- glcd-v3-20111205/fonts/Arial14.h    2011-12-05 01:50:16.000000000 +1100
+++ glcd/fonts/Arial14.h    2014-07-24 19:59:00.000000000 +1000
@@ -52,7 +52,7 @@

 #define Arial14 Arial_14 

-static uint8_t Arial_14[] PROGMEM = {
+static const uint8_t Arial_14[] PROGMEM = {
     0x1E, 0x6C, // size
     0x0A, // width
     0x0E, // height
diff -wur glcd-v3-20111205/fonts/Arial_bold_14.h glcd/fonts/Arial_bold_14.h
--- glcd-v3-20111205/fonts/Arial_bold_14.h  2011-12-05 01:50:16.000000000 +1100
+++ glcd/fonts/Arial_bold_14.h  2014-07-24 19:59:00.000000000 +1000
@@ -45,7 +45,7 @@
 #define ARIAL_BOLD_14_WIDTH 10
 #define ARIAL_BOLD_14_HEIGHT 14

-static uint8_t Arial_bold_14[] PROGMEM = {
+static const uint8_t Arial_bold_14[] PROGMEM = {
     0x22, 0x08, // size
     0x0A, // width
     0x0E, // height
diff -wur glcd-v3-20111205/fonts/Corsiva_12.h glcd/fonts/Corsiva_12.h
--- glcd-v3-20111205/fonts/Corsiva_12.h 2011-12-05 01:50:16.000000000 +1100
+++ glcd/fonts/Corsiva_12.h 2014-07-24 19:59:00.000000000 +1000
@@ -45,7 +45,7 @@
 #define CORSIVA_12_WIDTH 10
 #define CORSIVA_12_HEIGHT 11

-static uint8_t Corsiva_12[] PROGMEM = {
+static const uint8_t Corsiva_12[] PROGMEM = {
     0x16, 0x3A, // size
     0x0A, // width
     0x0B, // height
diff -wur glcd-v3-20111205/fonts/SystemFont5x7.h glcd/fonts/SystemFont5x7.h
--- glcd-v3-20111205/fonts/SystemFont5x7.h  2011-12-05 01:50:16.000000000 +1100
+++ glcd/fonts/SystemFont5x7.h  2014-07-24 19:58:50.000000000 +1000
@@ -45,7 +45,7 @@

 #define SystemFont5x7 System5x7

-static uint8_t System5x7[] PROGMEM = {
+static const uint8_t System5x7[] PROGMEM = {
     0x0, 0x0, // size of zero indicates fixed width font, actual length is width * height
     0x05, // width
     0x07, // height
diff -wur glcd-v3-20111205/fonts/Verdana_digits_24.h 
glcd/fonts/Verdana_digits_24.h
--- glcd-v3-20111205/fonts/Verdana_digits_24.h  2011-12-05 01:50:16.000000000 
+1100
+++ glcd/fonts/Verdana_digits_24.h  2014-07-24 19:58:55.000000000 +1000
@@ -46,7 +46,7 @@
 #define VERDANA24_WIDTH 10
 #define VERDANA24_HEIGHT 24

-static uint8_t Verdana24[] PROGMEM = {
+static const uint8_t Verdana24[] PROGMEM = {
     0x0E, 0xF9, // size
     0x0A, // width
     0x18, // height
diff -wur glcd-v3-20111205/fonts/fixednums15x31.h glcd/fonts/fixednums15x31.h
--- glcd-v3-20111205/fonts/fixednums15x31.h 2011-12-05 01:50:16.000000000 +1100
+++ glcd/fonts/fixednums15x31.h 2014-07-24 19:59:00.000000000 +1000
@@ -20,7 +20,7 @@
 #include <avr/pgmspace.h>

-static uint8_t fixednums15x31[] PROGMEM = {
+static const uint8_t fixednums15x31[] PROGMEM = {
     0x0, 0x0,  // size of zero indicates fixed width font
     15,        // width
     31,        // height
diff -wur glcd-v3-20111205/fonts/fixednums7x15.h glcd/fonts/fixednums7x15.h
--- glcd-v3-20111205/fonts/fixednums7x15.h  2011-12-05 01:50:16.000000000 +1100
+++ glcd/fonts/fixednums7x15.h  2014-07-24 19:59:00.000000000 +1000
@@ -18,7 +18,7 @@
 #include <avr/pgmspace.h>

-static uint8_t fixednums7x15[] PROGMEM = {
+static const uint8_t fixednums7x15[] PROGMEM = {
     0x0, 0x0,  // size of zero indicates fixed width font
     7,     // width
     15,        // height
diff -wur glcd-v3-20111205/fonts/fixednums8x16.h glcd/fonts/fixednums8x16.h
--- glcd-v3-20111205/fonts/fixednums8x16.h  2011-12-05 01:50:16.000000000 +1100
+++ glcd/fonts/fixednums8x16.h  2014-07-24 19:58:44.000000000 +1000
@@ -23,7 +23,7 @@
 #include <avr/pgmspace.h>

-static uint8_t fixednums8x16[] PROGMEM = {
+static const uint8_t fixednums8x16[] PROGMEM = {
     0x0, 0x0,  // size of zero indicates fixed width font
     8,     // width
     15,        // height

Original issue reported on code.google.com by b...@bdlow.net on 24 Jul 2014 at 10:13

GoogleCodeExporter commented 8 years ago
I'm assuming this showed up when trying to use the library on the new Arduino 
1.5.7 IDE?

As an FYI, I'm no longer maintaining this code and haven't been for quite some 
time.
Michael may jump in to make some updates.

In the mean time you may want to have a look at another library that I am 
maintaining: (openGLCD)
which can be found here:
https://bitbucket.org/bperrybap/openglcd/wiki/Home

It handles progmem very differently and has no issues with Arduino 1.5.7 and 
the newer versions of gcc.

Original comment by bperry...@gmail.com on 24 Jul 2014 at 3:32

GoogleCodeExporter commented 8 years ago
Righto, and thanks for the pointer to openglcd.

Original comment by b...@bdlow.net on 24 Jul 2014 at 11:32