------- Comment #4 from mschulze at ivs dot cs dot ovgu dot de  2010-06-09 
09:16 -------
I found a way to place data in program memory for C++ without producing the
annoying warnings. The trick is omiting __attribute__((__progmem__)) and
instead always use __attribute__((section(".progmem.something"))) for placing
your data into a special section beginning with ".progmem.". I tested this with
different avr-g++ compiler versions (3.4.4, 4.1.1, 4.2.1, 4.3.3, 4.4.0, and
4.4.3), and it always results in the desired behavior.

Example:
[mschu...@teeth tst]$ cat progmem.cpp 
static char __attribute((section(".progmem.something"))) str[]="program memory
data";

const char* test() {
    return str;
}
[mschu...@teeth tst]$ /usr/bin/avr-g++ -Wall -mmcu=atmega1281 -c progmem.cpp 
[mschu...@teeth tst]$ /usr/bin/avr-g++ --version
avr-g++ (GCC) 4.3.3
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[mschu...@teeth tst]$ 

Regards,
Michael


-- 

mschulze at ivs dot cs dot ovgu dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mschulze at ivs dot cs dot
                   |                            |ovgu dot de


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34734

Reply via email to