From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,69431b06fe9a3239 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!feedme.ziplink.net!news.swapon.de!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: How do I disable elaboration code on this Date: Sat, 09 Apr 2011 20:19:18 +0100 Organization: A noiseless patient Spider Message-ID: References: <58bc4fb4-5f6a-48d6-9c98-0dde7ac619df@p16g2000vbo.googlegroups.com> <87ipunqpyv.fsf@ludovic-brenta.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx03.eternal-september.org; posting-host="dFCm8HWntFqmDIilBLqEJQ"; logging-data="1848"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX190r4OXRboPZUBZdhTKfRcZvgoT9atvCSY=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (darwin) Cancel-Lock: sha1:tQoKuen1XkjpV3t4xFZ+wLS5MRs= sha1:fmzFnvD0YFbcKWkd6jtVBMRvMKA= Xref: g2news2.google.com comp.lang.ada:19703 Date: 2011-04-09T20:19:18+01:00 List-Id: Ludovic Brenta writes: > Simon Wright writes on comp.lang.ada: >> Jeffrey Carter writes: >> >>> On 04/09/2011 06:58 AM, Lucretia wrote: >>>> The following code will not compile no matter what I do. Basically, I >>>> want to write the startup code for Cortex-M3 in Ada with no assembly. >>>> So, the ISR code needs to be elaboration free as it's the first bit of >>>> code that would run on reset. >>> >>>> Vector : constant Vectors := >>>> (Dummy'Access, >>>> Dummy'Access, >>>> Dummy'Access, >>>> Dummy'Access); >>>> pragma Convention (C, Vector); >>>> for Vector'Address use Addr; >>> >>> I think what you need here is >>> >>> Vector : constant Vectors; >>> pragma Import (Ada, Vector); >>> for Vector'Address use Addr; >>> >>> since you don't want Vector to be initialized. >>> >>> Vector will not be initialized because you have pragma Import for it. >>> >>> Note that you don't need procedure Dummy. >> >> But the real code will have actual ISR procedures. OP is merely sparing >> us the unnecessary detail of the real ISRs. > > But the vector being in Flash ROM, the Ada code needs not and indeed may > not initialize it, so I think Jeffrey's reply is correct. The pragma > Import and the address clause will make the actual vectors (in ROM) > visible to the Ada program. That would be true if the vector was built in a separate C or ASM file, but Luke wants to do the whole thing in Ada and then write it to Flash. See above: "Basically, I want to write the startup code for Cortex-M3 in Ada with no assembly."