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.uzoreto.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Ada in command / control systems Date: Wed, 27 Feb 2019 00:39:33 +0200 Organization: Tidorum Ltd Message-ID: References: <2199b15b-d704-403f-a6c4-00fab29792d5@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: individual.net COyz43+EorD21BnFQoBxFwzH95M6/0ygerPKejS6dzU2BiFwlr Cancel-Lock: sha1:WdZbX5CgjHCyku/G5KCFwDC0Ov4= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 In-Reply-To: Xref: reader01.eternal-september.org comp.lang.ada:55679 Date: 2019-02-27T00:39:33+02:00 List-Id: On 19-02-27 00:10 , lyttlec wrote: > On 2/26/19 10:50 AM, Simon Wright wrote: >> "J-P. Rosen" writes: >> >>> Le 25/02/2019 à 20:21, russ lyttle a écrit : >> >>>> Some items need to be specified to be >>>> allocated to EEPROM, some to RAM, etc. >>> You can do that with address clauses. >> >> The compiler will straightforwardly distinguish between text, read-only, >> read-write, and bss. >> >> If you need more, you can (GNAT) use pragma Linker_Section: for >> interrupt vectors for an STM32F4, >> >> Vectors : array (-14 .. Ada.Interrupts.Names.FPU_IRQ) of Handler := >> (-9 .. -6 | -4 .. -3 => null, -- reserved >> -14 => Dummy_Handler'Access, -- NMI >> -13 => HardFault_Handler'Access, -- HardFault >> -12 => Dummy_Handler'Access, -- MemManagement >> -11 => Dummy_Handler'Access, -- BusFault >> -10 => Dummy_Handler'Access, -- UsageFault >> -5 => SVC_Handler'Access, -- SVCall >> -2 => PendSV_Handler'Access, -- PendSV >> -1 => SysTick_Handler'Access, -- SysTick >> others => IRQ_Handler'Access) >> with >> Export, >> Convention => Ada, >> External_Name => "isr_vector"; >> pragma Linker_Section (Vectors, ".isr_vector"); >> >> and then use the linker script to place that section appropriately. >> > The "use linker script" part is where I am having difficulty with gnat > targeting a PC. Haven't tried the STM32F4 yet. > All I've found so far, including tutorial on AdaCore, apply only to > Windows and produce errors in Linux. Simon is talking about targeting embedded, bare metal platforms, where things like placing certain data or code in EEPROM, or at certain addresses, make sense. For an OS like Windows or Linux on a PC, usually there is no EEPROM (accessible to an application), and all special addreses (such as I/O control registers) are reserved for OS use. > For example the advice to use > "-Xlinker -Wl --stack = ..." is Windows only. Yes, the way you set the stack size of the Ada environment task is different for each host OS (there was some discussion of this on comp.lang.ada a while ago, and it was agreed that a portable, standard method should be defined for Ada, such as using Pragma Storage_Size in the main subprogram). For Linux, I believe the environment stack size is not set when linking the program, but through the shell "ulimit" command when starting the program. > We may have to give up and switch back to using Makefile, which > probably isn't such a bad idea anyway. I don't see how a Makefile would help with the stack-size setting. It should be possible to pass all required command-line switches and arguments through GPS and gprbuild. I would recommend using a Makefile only if you must run some other tools in connection with the build. If your build uses only gprbuild or gnatmake, stick with the GNAT project file, or just with the gnatmake environment variables (ADA_INCLUDE_PATH, ADA_OBJECTS_PATH). -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .