From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader02.eternal-september.org!news.gegeweb.eu!gegeweb.org!fdn.fr!proxad.net!feeder1-2.proxad.net!cleanfeed2-b.proxad.net!nnrp1-2.free.fr!not-for-mail Newsgroups: comp.lang.ada References: <5ff9779d$0$24281$426a74cc@news.free.fr> <5ffb311f$0$16185$426a74cc@news.free.fr> <5ffb7135$0$24247$426a74cc@news.free.fr> <5ffc8efd$0$8957$426a74cc@news.free.fr> From: DrPi <314@drpi.fr> Subject: Re: Record initialisation question Date: Thu, 14 Jan 2021 14:07:29 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Message-ID: <60004212$0$13563$426a34cc@news.free.fr> Organization: Guest of ProXad - France NNTP-Posting-Date: 14 Jan 2021 14:07:30 CET NNTP-Posting-Host: 82.65.30.55 X-Trace: 1610629650 news-4.free.fr 13563 82.65.30.55:52558 X-Complaints-To: abuse@proxad.net Xref: reader02.eternal-september.org comp.lang.ada:61121 List-Id: > The problem is that "static" in Ada means "known at compile time", while > addresses, although static in execution, are generally not known until > link time. A case where assembly language is more powerful :-( > Or C :( I use the manufacturer C code generated by their tool as reference. In C, initializing a structure element with an address is not a problem. >> I have to find a workaround. > > If addresses are the only problem, and you are in control of the flash > memory lay-out, you might be able to define static Ada constant > expressions that compute ("predict") the addresses of every boot data > structure record. But those expressions would need to use the sizes of > the records, I think, and unfortunately the 'Size of a record type is > not a static expression (IIRC), and that may hold also for the > GNAT-specific 'Max_Size_In_Storage_Units. I can redefine the records with UInt32 instead of System.Address. The problem is : What is the expression to convert from Address to UInt32 without using a function ?