PROGMEM const syntax

Go To Last Post
2 posts / 0 new
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am dusting off the butterfly and successfully compiled the the port of the demo program.  With the changes in the compiler the const term must be included in the assignments.  This is well covered in and

the port of the demo program. 



unsigned int LCD_character_table[] PROGMEM = ...

gives:  Error    1    variable 'LCD_character_table' must be const in order to be put into read-only section by means of '__attribute__((progmem))'


const unsigned int LCD_character_table[] PROGMEM = ...

is OK although It should be global or have "static" in front.


All this I am clear on  My confusion is with PROGMEM Pointers


Gives the same error.

So following Dean's PDF (page 8)

const uint8_t * const DATE_FORMAT_NR[] PROGMEM = { ...

This compiles without error.

I suppose that I should just say "it works, be quiet".  However my curiosity is eating at me. What are we saying in C with this?

const uint8_t * const








  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Both the pointer and the thing it is pointing to are BOTH const so it needs to appear twice. One to make the pointer const and one to say that the target is const.


BTW have you heard of __flash yet? ;-)


EDIT: forgot to say that there's a useful utility called "cdecl" (in either "cdecl" or "cutils" packages if you use Debian/Ubuntu) that can decode things like this. There's also cundecl. You can also find cdecl online:


It can help to build or decode sequences like this:



(sadly it hasn't heard of <stdint.h> so I had to use "unsigned char" rather than "uint8_t")

Last Edited: Thu. Feb 26, 2015 - 09:47 AM