bugAVR C Runtime Library - Bugs: bug #36933, Documentation no longer correctly...

 
 

bug #36933: Documentation no longer correctly describes how to declare strings for storage in program memory

Submitted by:  Stuart Cording <codinghead>
Submitted on:  Tue 24 Jul 2012 09:44:17 AM UTC  
 
Category: DocumentationSeverity: 3 - Normal
Priority: 9 - ImmediateItem Group: Documentation
Status: NonePercent Complete: 0%
Assigned to: NoneOpen/Closed: Open
Release: 1.8.0Fixed Release: None

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 24 Jul 2012 09:44:17 AM UTC, original submission:

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
> };

Stuart Cording <codinghead>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #27591:  36933.patch added by aurel32 (2kB - text/x-diff - Patch to fix the documentation)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by aurel32 (Updated the item)
  • -unavailable- added by arcanum (Updated the item)
  • -unavailable- added by codinghead (Submitted the item)
  •  

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 10 Mar 2013 06:35:28 PM UTCaurel32Attached File-=>Added 36933.patch, #27591
    Fri 16 Nov 2012 06:11:59 PM UTCarcanumPriority5 - Normal=>9 - Immediate

    Back to the top


    Powered by Savane 3.1-cleanup