Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Re: Time and TimeAlarms Libraries – Ask here for help or suggestions on: October 31, 2012, 04:35:12 pm
I got the same errors here with arduino 18, 22 and 1.01. and different Time lib versions.

/usr/share/arduino/libraries/Time/DateStrings.cpp:18:18: error: variable 'monthStr1' must be const in order to be put into read-only section by means of '__attribute__((progmem))'

The fix for my debian system was:

go back to gcc-avr version 4.3.5-1 * and
go back to avr-libc version 1.6.8-2 *

Now everything compiles just fine

* i updated to gcc-avr 4.7.0-2 and avr-libc 1.8.0-2 which broke compiling TIME libs.

Having fun again

Same issue after updating to lubuntu 12.10 (not sure if that is related..)

To fix this, I think it's better to fix the actual error in stead of using an older compiler that ignores the error.
The compiler says the variables in DateStrings.cpp must be constants so we can fix this if we declare them as contants.

See the attachment for the new file

example on the changes that should be made:

char monthStr1[] PROGMEM = "January";
should be:
const char monthStr1[] PROGMEM = "January";
Make the same change on many lines..

And this (on lines 31 and 48)
PGM_P monthNames_P[] PROGMEM = ... etc
should be
PGM_P const monthNames_P[] PROGMEM = ... etc

I'll try to find out how to submit this change into the official release

Bye !
Pages: [1]