From patchwork Thu Dec 1 14:28:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georg-Johann Lay X-Patchwork-Id: 86065 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp717503qgi; Thu, 1 Dec 2016 06:29:10 -0800 (PST) X-Received: by 10.84.197.1 with SMTP id m1mr83403411pld.75.1480602550024; Thu, 01 Dec 2016 06:29:10 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id z62si376536pgz.214.2016.12.01.06.29.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Dec 2016 06:29:10 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-443216-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-443216-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-443216-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:cc:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=tzfF+ESxFwCVdTE1LJtaAqU6x/yr8W8MFnl7afhsIZiBlDdQj2 orAwWZo4gLcCSu+5AE/BR8q4LOuqVX+k23OQA9pWvExIjSlM/dalJpEguEKXWNix W/qZGHyA0t3A6MYBwrR8JHT+uTtHG+uy5MJ7QleMnPqG54K+k/sYgWXkQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:cc:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=lKRylrurrBZCdLTepltciT9U3B4=; b=VVCbFCi6+weG/jDmkos8 jodD0I4kfLTo02YPW7RZjVNH2VYPq510Vnt7s2Y974UDzUjdZqgLax5o3SoseNt3 SDZAG0PeVrwDp6DCI7AvEKgcg3FRWidnn/0k82/jrLbpWMh1CyTRPllS094bwf/t rutq2Xfw09RVirISqoQfNZg= Received: (qmail 31871 invoked by alias); 1 Dec 2016 14:28:44 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 31815 invoked by uid 89); 1 Dec 2016 14:28:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=0x4000, patch, avr, Tiny, patchavr X-HELO: mo4-p00-ob.smtp.rzone.de Received: from mo4-p00-ob.smtp.rzone.de (HELO mo4-p00-ob.smtp.rzone.de) (81.169.146.163) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 01 Dec 2016 14:28:33 +0000 X-RZG-AUTH: :LXoWVUeid/7A29J/hMvvT3ol15ykJcYwTPLBCxG2PQt7BpWLF2I= X-RZG-CLASS-ID: mo00 Received: from [192.168.0.123] (ip5f5871bb.dynamic.kabel-deutschland.de [95.88.113.187]) by smtp.strato.de (RZmta 39.10 DYNA|AUTH) with ESMTPSA id 40b43esB1EST3tX (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Thu, 1 Dec 2016 15:28:29 +0100 (CET) Cc: Denis Chertykov , Senthil Kumar Selvaraj , Pitchumani Sivanupandi To: gcc-patches From: Georg-Johann Lay Subject: [patch,avr] Document how to avoid progmem on AVR_TINY. Message-ID: Date: Thu, 1 Dec 2016 15:28:29 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 X-IsSubscribed: yes This adds to the documentation a hint how to set up a linker description file that avoids progmem altogether any without the usual overhead of locating read-only data in RAM. The proposed linker description file is completely transparent to the compiler, and no start-up code has to be adjusted. IIUC there are currently no plans to fix this in the default linker description file avrtiny.x, cf. http://sourceware.org/PR20849 Also, link between -mabsdata option and absdata variable attribute. Ok for trunk? Johann gcc/ * doc/invoke.texi (AVR Options) [-mabsdata]: Point to absdata. * doc/extend.texi (AVR Variable Attributes) [progmem]: Hint about linker description to avoid progmem altogether. [absdata]: Point to -mabsdata option. Index: doc/extend.texi =================================================================== --- doc/extend.texi (revision 243111) +++ doc/extend.texi (working copy) @@ -5929,6 +5929,30 @@ int read_var (int i) @} @end smallexample +Please notice that on these devices, there is no need for @code{progmem} +at all. Just use an appropriate linker description file like outlined below. + +@smallexample + .text : + @{ ... + @} > text + /* Leave .rodata in flash and add an offset of 0x4000 to all + addresses so that respective objects can be accessed by LD + instructions and open coded C/C++. This means there is no + need for progmem in the source and no overhead by read-only + data in RAM. */ + .rodata ADDR(.text) + SIZEOF (.text) + 0x4000 : + @{ + *(.rodata) + *(.rodata*) + *(.gnu.linkonce.r*) + @} AT> text + /* No more need to put .rodata into .data: + Removed all .rodata entries from .data. */ + .data : + @{ ... +@end smallexample + @end table @item io @@ -6001,6 +6025,8 @@ warning like @end itemize +See also the @option{-mabsdata} @ref{AVR Options,command-line option}. + @end table @node Blackfin Variable Attributes Index: doc/invoke.texi =================================================================== --- doc/invoke.texi (revision 243111) +++ doc/invoke.texi (working copy) @@ -15402,7 +15402,8 @@ GCC supports the following AVR devices a Assume that all data in static storage can be accessed by LDS / STS instructions. This option has only an effect on reduced Tiny devices like -ATtiny40. +ATtiny40. See also the @code{absdata} +@ref{AVR Variable Attributes,variable attribute}. @item -maccumulate-args @opindex maccumulate-args