Variable 'bitmap_array' must be const in order to be put into read-only section...
TojoDojo opened this issue · comments
Upon uploading the code, I get an error. Sorry in advance for the long copy and paste, but here's the message.
`
Arduino: 1.8.1 (Windows 10), Board: "Arduino/Genuino Uno"
In file included from C:\Users\TJ\Desktop\retrowatch-master\RetroWatch_Arduino\RetroWatchArduino_u8glib_no_button\RetroWatchArduino_u8glib_no_button.ino:32:0:
bitmap.h:1269: error: variable 'bitmap_array' must be const in order to be put into read-only section by means of 'attribute((progmem))'
PROGMEM const unsigned char* bitmap_array[] = {
^
RetroWatchArduino_u8glib_no_button:123: error: variable 'weekString' must be const in order to be put into read-only section by means of 'attribute((progmem))'
PROGMEM const char* weekString[] = {"", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
^
RetroWatchArduino_u8glib_no_button:124: error: variable 'ampmString' must be const in order to be put into read-only section by means of 'attribute((progmem))'
PROGMEM const char* ampmString[] = {"AM", "PM"};
^
RetroWatchArduino_u8glib_no_button:161: error: variable 'strIntro' must be const in order to be put into read-only section by means of 'attribute((progmem))'
PROGMEM const char* strIntro[] = {"Retro", "Watch", "Arduino v1.0"};
^
exit status 1
variable 'bitmap_array' must be const in order to be put into read-only section by means of 'attribute((progmem))'
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
`
Nvm, just had to add an additional const to each of the lines so that
bitmap.h:
PROGMEM const unsigned char* bitmap_array[] = {
Would be
PROGMEM const unsigned char* const bitmap_array[] = {
RetroWatchArduino_no_button:
PROGMEM const char* weekString[] = {"", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
PROGMEM const char* ampmString[] = {"AM", "PM"};
to
PROGMEM const char* const weekString[] = {"", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
PROGMEM const char* const ampmString[] = {"AM", "PM"};
To solve the problem: variable 'bitmap_array' must be const in order to be put into read-only section by means of 'attribute((progmem))'
PROGMEM const unsigned char* bitmap_array[] = {
You must change it as: PROGMEM const unsigned char* const bitmap_array[] = {
Good luck!!