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: 701552 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tV05p6154z9t1B for ; Fri, 2 Dec 2016 01:29:02 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="R0W/znxf"; dkim-atps=neutral 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=dWofHxn7wmia4QL9p6TXA9bJuJdu558OfmVDsqm99ilNwh3cWK Ucl89VzyvIYfVWuXH/Qf7B6+OZpxrsrSCqtePjy73xPOW1KOv4zruFkM0jitleep 25jJOKc+LBzxE49dH/6bfGsyH4yIU8FhG0XEvSOfObK//qfKtGrXpePEE= 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=R0W/znxftjGFogP3/LNW NJ3Z0cGID2gf+Wz/dA9Rmk/1pBDDyRiHMsyPjhE9pGzs0dzovSO949ooQYpd4Jia JHJR+lLufNF3gBMeBlbUgwStRgTZCAImTQoOF+Pqz4c1HSSfUQcqf7SAyC/GZ4Vj NoC/n2+/gYdtirChqMCg3ok= 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