comp.lang.ada
 help / color / mirror / Atom feed
From: Rolf <rolf.ebert_nospam_@gmx.net>
Subject: Re: GPS and assembly language files
Date: Tue, 30 Mar 2010 01:13:18 -0700 (PDT)
Date: 2010-03-30T01:13:18-07:00	[thread overview]
Message-ID: <87ac252f-dae0-482a-b654-1f8ba50e7bac@h27g2000yqm.googlegroups.com> (raw)
In-Reply-To: 9c34859d-ce4e-4989-865e-d044f6e84176@v34g2000prm.googlegroups.com

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



      reply	other threads:[~2010-03-30  8:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-30  6:35 GPS and assembly language files brian
2010-03-30  8:13 ` 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