Re: String array in ROM gives error in spite of following example code.

Francois Lorrain <[email protected]>
Newsgroups gmane.comp.hardware.avr.gcc
Message-ID <CAJERwX4hQsz1s0R9zOHg276JhbG7Ywe8GN1c2NtYvQE36f+P5g@mail.gmail.com>
Hello,

Newer version of gcc have changed the progmem behaviour, it cannot be
applied to typedef anymore if I remember well.

const char * pgtmp_msg[] should solve your issue

Regards

Francois


On Thu, Jun 12, 2014 at 12:23 PM, Royce Pereira <[email protected]> wrote:

> Hi,
>
> I recently updated WinAVR to a newer version of the AVR-GCC toolchain,
> downloaded from the Atmel site.
>
> My version is this:
>
> avr-gcc (AVR_8_bit_GNU_Toolchain_3.4.3_1072) 4.8.1
>
> My code was compiling without errors before, but with this version, it
> is giving errors in spite of following the instructions in the faq
> section of the avr-libc document.
> //---------------------------------------------
> #include <avr/io.h>
> #include <avr/pgmspace.h>
>
> const char ptmpUP_msg[]      PROGMEM = "Upper Temp" ;
> const char ptmpDN_msg[]      PROGMEM = "Lower Temp" ;
> const char ptmpCLG_msg[]     PROGMEM = "Chiller Temp" ;
>
> PGM_P  pgtmp_msg[]    PROGMEM =
>    { ptmpUP_msg, ptmpDN_msg,  ptmpCLG_msg,} ;
>
> //------------------------------------------------------
> The above code gives the following error:
>
> error: variable 'pgtmp_msg' must be const in order to be put into
> read-only section by means of  '__attribute__((progmem))'
> //-----------------------------------------------------
>
> But I have followed the avr-libc example exactly.
> So why is this error thrown and whats the correct way to do this ?
>
> Thank You.
> --
> Best Regards,
>
> -- Royce Pereira
>
> _______________________________________________
> AVR-GCC-list mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/avr-gcc-list
>

_______________________________________________
AVR-GCC-list mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/avr-gcc-list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.