From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by sourceware.org (Postfix) with ESMTPS id 2A5093858D35 for ; Fri, 25 Feb 2022 16:45:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2A5093858D35 Received: by mail-io1-xd29.google.com with SMTP id m185so7115522iof.10 for ; Fri, 25 Feb 2022 08:45:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=vHwDLhnwFbzq3y+ioGkYtY2A/n3QTtC4kvo+w80S4p8=; b=rQ5Xv/UiC+sJQ4VzrN9UHbTX5lRkjFMjuPfe+Lbq8Co+Qnmzv3pBVTmq2fIKymWqA6 8SCuJ9PJ6Zg6FvpnXRGaZTTknuOQuQe6uomcw4z9TAw5uJIZfrb4x5FHU7G4JL/F1JRt Ficah5xS08x1l6zLFgggNh0P4XPhydxhvryLdSJESuakvmuuvn13DHRl3Q/ysVgOaHIJ 0w9iQ25H6svO+DixMMEjN1/3RlC6BSk96aSiGl/b1juKEqlrFftVE+rcxIKm7xvYiIrS Xr8HecH4bhPobmeEAIyI1NkjBYumM/2wtul74ptEtJC/1Bcf1IWHzY0/t1mR92fz9uv4 e/Yw== X-Gm-Message-State: AOAM530l3NwhCJzoW8W2JX9ROhOMJMHV5huIFWKgiEB1gIC7zUF/rwUb opN87IcknFHKrxe502AjntILDz+VfRc= X-Google-Smtp-Source: ABdhPJwfNsH3zbVRMQKelQJuT4RyxMVEvAazPYSBoix5cYzAxc/XbPC62WTvca0yKeAdH1gTES6Hrw== X-Received: by 2002:a02:63c9:0:b0:314:ec67:e68c with SMTP id j192-20020a0263c9000000b00314ec67e68cmr6672465jac.217.1645807516076; Fri, 25 Feb 2022 08:45:16 -0800 (PST) Received: from [192.168.0.41] (184-96-252-215.hlrn.qwest.net. [184.96.252.215]) by smtp.gmail.com with ESMTPSA id g4-20020a92cda4000000b002c24724f23csm1878652ild.13.2022.02.25.08.45.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 25 Feb 2022 08:45:15 -0800 (PST) Message-ID: <723b5ea5-7cbb-a36e-0734-9cae443eda70@gmail.com> Date: Fri, 25 Feb 2022 09:45:15 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: Constant at fixed address Content-Language: en-US To: Henrique Coser , "gcc-help@gcc.gnu.org" References: From: Martin Sebor In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Feb 2022 16:45:18 -0000 On 2/25/22 09:01, Henrique Coser wrote: > Hello, > > I need a help. I'm trying to solve a problem for weeks. > I have a embeded software that is a boot loader. It puts the boot load version at a specific address. > My memmory starts at 0x400000 with 0x1400 size. My constant version string value must be placed @0x401000 with 8bytes length. > If I place this const value into a section like this: > > const unsigned char Version[8] __attribute__ ((section (".bootversion"))) = "V1.0.1a"; > > I got this error: > > section .bootversion LMA [00401000,00401007] overlaps section .text LMA [00400000,00401013]collect2.exe(0,0): error: ld returned 1 exit status > > I have already tried to split flash memmory using linker script but it does not worked. > I wish to find something like "automatic" split. > > For example, this code was compiled using ARM Keil. With ARM Keil I have the attribute that makes all the magic : > const unsigned char Version[8] __attribute__((at(0x0401000))) = "V1.0.1a"; > > I dont know if is possible to have something as pratical as ARM Keil attribute in GCC. GCC for the AVR target supports a couple of attributes that can be used to pin a variable declaration to a fixed address: address and io. It doesn't look to me like they're put in their own sections like in the ARM Keil compiler (but the section attribute can be used for that). Beside your use case, exposing at least the address attribute in all targets would make would also solve a long-standing problem with GCC issuing warnings for accesses to hardwired addresses). I suggest opening an enhancement request in Bugzilla. Martin > > I really need make this thing work. > If this is not the best channel to ask, please, could you recommend me one? > > Thank you very much! > > > > Henrique Coser > > Engenharia > > > > TEX Equip.Eletronicos Ind.e Com.Ltda. > > Fone: (+5511) 4591-2825 > > henrique.coser@tex.com.br > > MEDIR PARA MELHORAR!