comp.lang.ada
 help / color / mirror / Atom feed
* GPS and assembly language files
@ 2010-03-30  6:35 brian
  2010-03-30  8:13 ` Rolf
  0 siblings, 1 reply; 2+ messages in thread
From: brian @ 2010-03-30  6:35 UTC (permalink / raw)


I'm trying to create a standalone (run on the bare metal) program for
a PC using GPS GPL 2009.  Obviously, I need an assembly language file
(to setup the stack and transition the CPU to 32-bit mode), which
would then call my Ada main entry point.  Is it possible to have GPS
compile and build this?  I cannot figure out how to tell GPS about my
assembly language file.

 -Brian



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: GPS and assembly language files
  2010-03-30  6:35 GPS and assembly language files brian
@ 2010-03-30  8:13 ` Rolf
  0 siblings, 0 replies; 2+ messages in thread
From: Rolf @ 2010-03-30  8:13 UTC (permalink / raw)


On 30 Mrz., 08:35, brian <brian.cat...@gmail.com> wrote:
> I'm trying to create a standalone (run on the bare metal) program for
> a PC using GPS GPL 2009.  Obviously, I need an assembly language file
> (to setup the stack and transition the CPU to 32-bit mode), which
> would then call my Ada main entry point.  Is it possible to have GPS
> compile and build this?  I cannot figure out how to tell GPS about my
> assembly language file.
>
>  -Brian

First a caveat: the gnat runtime system relies on an operating system
for quite some functionality. e.g. file access, task scheduling, etc.
If you want to run your program on a bare voard you need a
corresponding run time system.

You have (at least) two ways to include assembler routines in your
program, you either use inline assembly (see System.Machine_Code and
the corresponding chapter in the GNAt user's guide
http://gcc.gnu.org/onlinedocs/gcc-4.4.3/gnat_ugn_unw/Inline-Assembler.html#Inline-Assembler)
or you write your assembly code in a separate file and access it via
pragma Import.

Next look in your linker script (and the GNU ld info pages).  There
are different init sctions and you can place your code into one of the
sections via pragma Linker_Section.  This obviously only works for Ada
code (i.e. inline assembly), not for imported routines.

procedure My_Startup_Code;
pragma Linker_Section (My_Startup_Code, ".init3");

I don't use GPS and connot tell anything about it.

HTH
    Rolf



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-03-30  8:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-30  6:35 GPS and assembly language files brian
2010-03-30  8:13 ` Rolf

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