comp.lang.ada
 help / color / mirror / Atom feed
From: "Rolf" <rolf.ebert_nospam_@gmx.net>
Subject: Re: Linking Ada with large Assembler libs?
Date: 8 Mar 2007 00:58:27 -0800
Date: 2007-03-08T00:58:27-08:00	[thread overview]
Message-ID: <1173344306.890836.307350@30g2000cwc.googlegroups.com> (raw)
In-Reply-To: <1172093396.490201.203630@a75g2000cwd.googlegroups.com>

On Feb 21, 10:29 pm, "freejack" <freej...@tds.net> wrote:
> The Machine Code Insertions sections of the relevant reference manuals
> have been informative.
>
> However, I'm linking my Ada code with pre-existing libs written in
> Assembler. The GNAT manuals are a little sketchy on how to do this
> properly. I'm using NASM and FASM Assembler code. Most of the
> Assembler code deals primarily with I/O. I'm using Pragma No_Run_Time
> and writing my own Binder files, with a good bit of success.
> It's not such a big problem, as I can do it by fiddling with the
> linker and manipulating the object code. But the result is messy and
> error prone.
>
> What are the best methods you guys have come up with for doing this
> sort of manipulation?

I either used inline assembly code in the body of an Ada procedure
(preferred) or pragma Import (Convention => C, ...) when programming
the AVR microprocessors.  In the latter case you have to follow
exactly gcc's parameter passing mechanism in the assembly code (e.g.
for AVR the first arg is in r24/r25, the second arg in r26/r27, etc.).

In the recent AVR-Ada releases we don't use assembly anymore;
everything is Ada now with almost identical asm code.  I'm considering
to use Asm code for bin->ascii conversions, though.

In the beginning I also used my own hand written binder file, now I
have a patch to gcc in order to generate a binder file that fits my
needs.

Have a look at pragma Linker_Options. You can use it for simple things
like including the object file for your assembler code, but also for
using special linker scripts.

HTH

    Rolf





      parent reply	other threads:[~2007-03-08  8:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-21 21:29 Linking Ada with large Assembler libs? freejack
2007-02-25 22:47 ` Gene
2007-03-08  8:58 ` Rolf [this message]
replies disabled

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