Prev: Interpreted vs. Compiled
Next: XML Serializer for ADA
From: brian on 30 Mar 2010 02:35 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
From: Rolf on 30 Mar 2010 04:13 On 30 Mrz., 08:35, brian <brian.cat...(a)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
|
Pages: 1 Prev: Interpreted vs. Compiled Next: XML Serializer for ADA |