comp.lang.ada
 help / color / mirror / Atom feed
From: anon@anon.org (anon)
Subject: Re: Restricted or no run time in Ada
Date: Thu, 03 Jan 2008 03:50:29 GMT
Date: 2008-01-03T03:50:29+00:00	[thread overview]
Message-ID: <9YYej.101546$MJ6.52947@bgtnsc05-news.ops.worldnet.att.net> (raw)
In-Reply-To: 699060d5-9968-4148-b8d6-801058e8f0fa@i12g2000prf.googlegroups.com

There are 100s of books on how an os is booted. More detailed than will 
ever be posted here.

To boot a program by the Boot ROM or to use boot loader you must create 
a program that loads at 0000:7C00 which is the address that all MBR will 
be loaded and executed on x86 machines. GNAT can not build a MBR code 
block. Plus, size of the MBR and its complete function depends of the 
filesystem on that drive. Like under the FAT the size is limited to 512 
bytes. 

Commercial compilers have the options that allows the creation of the 
MBR block aka startup code. Then appends this MBR to the main 
procedure (program) during linking instead of using the normal Ada 
startup code.

MaRTE and RTEMS appends two small assembly routines (MBR) to 
startup the system. Then the ROM executes this MBR code which 
later jumps to the Ada program. 

Most big companies use a non-Ada MBR that boots the new kernel. 

Some other companies rewrite the GNATBIND, and GNATLINK programs 
since the normal GNATBIND create code that must be link to 
"a-adaint.c" and other c routines that links the Ada startup code to an 
existing OS.

Note: The GNATBIND and GNATLINK programs basically have not changed 
since their creation. So, rebuilding might be as easy as patching and 
recompiling the new source code. 

For GNAT, unless you write an RTS you will not be able to use 
"exception" or other main Ada lib routines which links to the OS.



In <699060d5-9968-4148-b8d6-801058e8f0fa@i12g2000prf.googlegroups.com>, Lucretia <lucretia9@lycos.co.uk> writes:
>On Jan 2, 8:49 pm, a...@anon.org (anon) wrote:
>> Your going down the wrong path!
>>
>> First, there is no "pragma" other than "pragma No_Run_Time;" that
>> will allow GNAT to build code without a runtime code. Even then,
>> the code is not ROM bootable.
>
>That pragma is deprecated for a start.
>
>Why wouldn't it be ROM bootable?
>
>> Second, The Ada main procedure (Ada program) has no startup address
>> or routine that can be directly linked and make a kernel, that can be
>> executed by a ROM startup! You must use the BINDER process to build
>> that start code. But the "GNAT BIND" does not allow stand-alone aka
>> ROM bootable kernel.
>
>In my test I create a simple bit of asm that gets called by grub and
>then it boots into my main Ada application. I also link with LD.
>
>> The GNAT binder perform a number of steps, that have to be preform
>> to insure that the program will work properly. Such as:
>>         1. Checks that a program is consistent [ RM 10 ].
>
>True enough.
>
>>         2. Checks that an acceptable order of elaboration exists
>>            for the program [ RM 10 ].
>
>This was something I was worried about.
>
>>         3. Generates a main program incorporating the given
>>            elaboration order. This program is a small Ada package
>>            (body and spec) that must be subsequently compiled
>>            using the GNAT compiler.
>>         4. Determines the set of object files required by the
>>            given main program.
>>
>> So, for Ada only code, you must write a new Ada binder to preform
>> those steps to build a stand-alone code. And create the main program
>> (describe in step 3) that allows ROM bootable programs..
>
>Or use the gnatbind as a base.
>
>> Time allowed just to write and test as new binder 6 months at least!
>>
>> Another way is to use existing Ada 95 code projects that are out there.
>> That you can download the source code and study how they got around
>> this. But this way mean no Ada only code, and does violates the Ada RM.
>
>MarteOS actually uses gnat, they have ported the compiler to their os.
>I don't know if it uses gnatbind. Not sure of pragmas either.
>
>How do big companies use GNAT to create ROM bootable applications
>then?
>
>Luke.




  reply	other threads:[~2008-01-03  3:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-02 19:19 Restricted or no run time in Ada Lucretia
2008-01-02 20:49 ` anon
2008-01-02 21:33   ` Lucretia
2008-01-03  3:50     ` anon [this message]
2008-01-02 22:23   ` Simon Wright
2008-01-02 23:06     ` Lucretia
2008-01-03  5:14       ` roderick.chapman
2008-01-03  7:30         ` Lucretia
2008-01-03  8:00         ` Lucretia
2008-01-03  8:40           ` Lucretia
2008-01-03  9:58         ` anon
2008-01-03 10:22           ` Lucretia
2008-01-03 17:30             ` anon
2008-01-03 20:05               ` Vadim Godunko
2008-01-03 20:22                 ` Lucretia
2008-01-04  9:23                   ` Maxim Reznik
2008-01-04 23:23                     ` Brian May
2008-01-04 12:46                   ` Georg Bauhaus
2008-01-04 13:53                     ` Vadim Godunko
2008-01-04 14:13                     ` Maxim Reznik
2008-01-04 14:15   ` Lucretia
replies disabled

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