URL: <http://savannah.nongnu.org/bugs/?36933>
Summary: Documentation no longer correctly describes how to declare strings for storage in program memory Project: AVR C Runtime Library Submitted by: codinghead Submitted on: Tue 24 Jul 2012 09:44:17 GMT Category: Documentation Severity: 3 - Normal Priority: 5 - Normal Item Group: Documentation Status: None Percent Complete: 0% Assigned to: None Open/Closed: Open Discussion Lock: Any Release: 1.8.0 Fixed Release: None _______________________________________________________ Details: The documentation page as described below no longer correctly describes how to define strings that are to be stored in program memory using the PGM_P and PROGMEM definition s. This issue occurs when moving from version 1.7.1 to 1.8.0. Description of the issue with the 1.8.0 library and how to solve it below. > The strings were defined as per the AVR Libc homepage - > http://www.nongnu.org/avr-libc/user-manual/pgmspace.html > > They suggest: > char string_1[] PROGMEM = "String 1"; > char string_2[] PROGMEM = "String 2"; > char string_3[] PROGMEM = "String 3"; > char string_4[] PROGMEM = "String 4"; > char string_5[] PROGMEM = "String 5"; > > PGM_P string_table[] PROGMEM = > { > string_1, > string_2, > string_3, > string_4, > string_5 > }; > > However, on compiling my code I received the following error for each such defined line of code: > > Error 1 variable 'string_B01' must be const in order to be put into read-only section by means of '__attribute__((progmem))' > > Changing the code to the following resolves the issue: > > const char string_1[] PROGMEM = "String 1"; const char string_2[] > PROGMEM = "String 2"; const char string_3[] PROGMEM = "String 3"; > const char string_4[] PROGMEM = "String 4"; const char string_5[] > PROGMEM = "String 5"; > > PGM_P const string_table[] PROGMEM = > { > string_1, > string_2, > string_3, > string_4, > string_5 > }; _______________________________________________________ Reply to this item at: <http://savannah.nongnu.org/bugs/?36933> _______________________________________________ Message sent via/by Savannah http://savannah.nongnu.org/ _______________________________________________ AVR-libc-dev mailing list AVR-libc-dev@nongnu.org https://lists.nongnu.org/mailman/listinfo/avr-libc-dev