comp.lang.ada
 help / color / mirror / Atom feed
From: Vincent <vincent.diemunsch@gmail.com>
Subject: Re: ANN: gcc 4.9.1bis for Darwin
Date: Tue, 24 Feb 2015 13:53:16 -0800 (PST)
Date: 2015-02-24T13:53:16-08:00	[thread overview]
Message-ID: <70cff979-0231-40b5-aa88-793927d67975@googlegroups.com> (raw)
In-Reply-To: <lyioevbh46.fsf@pushface.org>

Le samedi 21 février 2015 13:10:04 UTC+1, Simon Wright a écrit :
> vincent wrote:
> 
> > 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.

Ok, so I have to resign myself to use GNU syntax.. :-(
I thought that GCC could use both. But maybe not GNAT.

I suppose that if I want to call a routine written in assembly,
I need to use pragma Import (Asm, MyRoutine, "myroutine").

Thank you very much,

Vincent

  reply	other threads:[~2015-02-24 21:53 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
2015-02-24 21:53     ` Vincent [this message]
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