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!news2.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: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: How do I disable elaboration code on this Date: Sat, 09 Apr 2011 21:35:05 +0200 Organization: A noiseless patient Spider Message-ID: <8739lrqkuu.fsf@ludovic-brenta.org> 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: mx02.eternal-september.org; posting-host="RdEkHrOTG4z9dP2owN6TLg"; logging-data="19180"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/OYkFi2mIUnUvX1IM8K27i" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) Cancel-Lock: sha1:WOOgVA1we6o2XIKWx5OFV3hFSyw= sha1:5bxfA4U+7Ry2QmBJBGqP/9YW2YE= Xref: g2news2.google.com comp.lang.ada:19705 Date: 2011-04-09T21:35:05+02:00 List-Id: Simon Wright writes on comp.lang.ada: > 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." The vector can and must be built and burned to Flash separately, by an Ada program of course :) This Ada program cannot write to Flash, it can only read the vector previously stored there with no elaboration and no initialization. This is very similar to things I did at Barco avionics a few years ago (I even wrote the driver for writing to the particular Flash device in pure Ada). -- Ludovic Brenta.