comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: ANN: gcc 4.9.1bis for Darwin
Date: Sat, 21 Feb 2015 12:10:01 +0000
Date: 2015-02-21T12:10:01+00:00	[thread overview]
Message-ID: <lyioevbh46.fsf@pushface.org> (raw)
In-Reply-To: d4bba070-a0f3-441e-bdcf-51f104be3ef8@googlegroups.com

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.


  reply	other threads:[~2015-02-21 12:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-25 16:41 ANN: gcc 4.9.1bis for Darwin Simon Wright
2015-01-25 18:26 ` David Botton
2015-01-27 14:49 ` RasikaSrinivasan
2015-01-29  0:08 ` Jerry
2015-02-21 10:22 ` vincent.diemunsch
2015-02-21 12:10   ` Simon Wright [this message]
2015-02-24 21:53     ` Vincent
2015-02-24 22:05       ` Simon Wright
2015-02-26 21:45         ` vdiem
2015-02-22 11:48   ` Simon Wright
2015-02-24 21:19     ` vdiem
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox