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!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: ANN: gcc 4.9.1bis for Darwin Date: Sat, 21 Feb 2015 12:10:01 +0000 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="4eba6dd55c03f4a8d448cad2a88d67ef"; logging-data="26915"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1924VyBMX3eW9tYOqO0ktWJ6Gph9utQzWs=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (darwin) Cancel-Lock: sha1:O828KgVet6im+zv9j/RBf+4GOBM= sha1:80s1F90+LabNH0Mlgsv38KE3hdo= Xref: news.eternal-september.org comp.lang.ada:24996 Date: 2015-02-21T12:10:01+00:00 List-Id: vincent.diemunsch@gmail.com writes: > Thank you very much Simon. > Your compiler release has become my main compiler. Same for me ... > Just a small question : is it possible to use INTEL syntax for on-line > assembly, in mean among Ada source code ? > If not, how can I link assembly language routines with Ada code ? For inline assembly, you need to use GNU syntax. As a simple(?) ARM example, function In_ISR return Boolean is IPSR : Interfaces.Unsigned_32; use type Interfaces.Unsigned_32; begin System.Machine_Code.Asm ("mrs %0, ipsr", Outputs => Interfaces.Unsigned_32'Asm_Output ("=r", IPSR), Volatile => True); return (IPSR and 16#ff#) /= 0; end In_ISR; Looking at some of the AdaCore STM32 code, there are two other things that might be helpful. First, there is convention Asm: System_Vectors : constant System.Address; pragma Import (Asm, System_Vectors, "__vectors"); which is fine for data objects like this, not so sure what calling convention might be expected from an ASM subprogram. Second, there is pragma Machine_Attribute: procedure Pend_SV_Handler; pragma Machine_Attribute (Pend_SV_Handler, "naked"); pragma Export (Asm, Pend_SV_Handler, "__gnat_pend_sv_trap"); -- This assembly routine needs to save and restore registers without -- interference. The "naked" machine attribute communicates this to GCC.