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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.unit0.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Last chance handler on a PC Date: Fri, 31 Jan 2020 14:30:06 +0200 Organization: Tidorum Ltd Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: individual.net SdPU6sVHnVrn1OiI6RyXJQguiGR3lKc7VN1TZ6PSwMx3m8o6nY Cancel-Lock: sha1:dYDTgfSm3HFW3DYyTK7nriHbUqY= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 In-Reply-To: Content-Language: en-US Xref: reader01.eternal-september.org comp.lang.ada:58001 Date: 2020-01-31T14:30:06+02:00 List-Id: On 2020-01-31 13:19, Simon Wright wrote: > Simon Wright writes: > >> Niklas Holsti writes: >> >>> I had a similar elaboration problem some time ago in an embedded >>> application, where I wanted to set up some HW error-trap handlers that >>> I would like to be active also during elaboration, but I found no easy >>> way to ensure that the trap-handling package would be elaborated >>> before all other packages. >> >> Could you have used pragma Restrictions (No_Elaboration_Code); ? >> >> Or pragma No_Elaboration_Code_All -- >> This is a program unit pragma (there is also an equivalent aspect of >> the same name) that establishes the restriction No_Elaboration_Code >> for the current unit and any extended main source units (body and >> subunits). It also has the effect of enforcing a transitive >> application of this aspect, so that if any unit is implicitly or >> explicitly with’ed by the current unit, it must also have the >> No_Elaboration_Code_All aspect set. It may be applied to package or >> subprogram specs or their generic versions. >> >> (I've done this in Cortex GNAT RTS, so that I could write the startup >> code in Ada). > > Sorry, that was stupid: you needed the package to have elaboration code > so that it could set up the error-trap handlers! Yes. Moreover, this application relied on elaboration for essentially all of its SW and HW initialization (after the startup code), which I thought worked well for the most part -- any package that accessed a particular HW part of the SoC "withed" the driver package for that HW part, and the elaboration of the driver package initialized the HW part. However, we did have many elaboration circularity problems when we tried to use VectorCAST to define unit tests for this application, because the "test environments" constructed by VectorCAST added many dependencies. We ended up using VectorCAST only for measuring test coverage, while writing the unit test procedures directly in Ada. -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .