From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28524 invoked by alias); 9 Jun 2010 09:16:41 -0000 Received: (qmail 28363 invoked by uid 48); 9 Jun 2010 09:16:18 -0000 Date: Wed, 09 Jun 2010 09:16:00 -0000 Message-ID: <20100609091618.28362.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug target/34734] attribute((progmem)) not handled properly in C++ for AVRs In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "mschulze at ivs dot cs dot ovgu dot de" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-06/txt/msg00970.txt.bz2 ------- 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: [mschulze@teeth tst]$ cat progmem.cpp static char __attribute((section(".progmem.something"))) str[]="program memory data"; const char* test() { return str; } [mschulze@teeth tst]$ /usr/bin/avr-g++ -Wall -mmcu=atmega1281 -c progmem.cpp [mschulze@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. [mschulze@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