From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.uzoreto.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Tero Koskinen Newsgroups: comp.lang.ada Subject: Re: How can I get this data into the .data section of the binary? Date: Tue, 16 Jun 2020 21:19:43 +0300 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net qAcLFj6QQkNLw2QurL3MUAkIaKi4QdsX5dTlvPz/ww4iYM0GPD Cancel-Lock: sha1:7/MQ52VueS6UZKvx2QJp+dEAcsE= User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 PostboxApp/7.0.18 In-Reply-To: Content-Language: en-US Xref: reader01.eternal-september.org comp.lang.ada:59102 List-Id: Hi, Luke A. Guest wrote on 16.6.2020 14.31: > Hi, > > I'm trying to get some static data tables into the data section rather > than be elaborated at runtime. I can see no reason why this particular > set of types, records and aggregates cannot go into the data section. I haven't tried with your example, but is GNAT specific pragma Linker_Section acceptable? https://docs.adacore.com/gnat_rm-docs/html/gnat_rm/gnat_rm/implementation_defined_pragmas.html#pragma-linker-section I use that for some AVR-Ada code when I want to relocate some of the stuff to progmem. Example: package PM_Strings is type Text_In_Progmem (Len : AVR.Nat8) is record Text : AVR.Strings.AVR_String(1..Len); end record; Select_Action_Str : constant AVR.Strings.AVR_String := "---- Select action ----"; Read_NFC_Str : constant AVR.Strings.AVR_String := "1 - Read NFC tag"; Select_Action_PM : constant Text_In_Progmem := (Select_Action_Str'Length, Select_Action_Str); Read_NFC_PM : constant Text_In_Progmem := (Read_NFC_Str'Length, Read_NFC_Str); pragma Linker_Section (Select_Action_PM, ".progmem"); pragma Linker_Section (Read_NFC_PM, ".progmem"); end PM_Strings; -Tero