From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,1ea992d578e9f621 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!204.127.161.8.MISMATCH!wn14feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!53ab2750!not-for-mail Newsgroups: comp.lang.ada From: anon@anon.org (anon) Subject: Re: Restricted or no run time in Ada Reply-To: anon@anon.org (anon) References: <699060d5-9968-4148-b8d6-801058e8f0fa@i12g2000prf.googlegroups.com> X-Newsreader: IBM NewsReader/2 2.0 Message-ID: <9YYej.101546$MJ6.52947@bgtnsc05-news.ops.worldnet.att.net> Date: Thu, 03 Jan 2008 03:50:29 GMT NNTP-Posting-Host: 12.65.138.231 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1199332229 12.65.138.231 (Thu, 03 Jan 2008 03:50:29 GMT) NNTP-Posting-Date: Thu, 03 Jan 2008 03:50:29 GMT Organization: AT&T Worldnet Xref: g2news1.google.com comp.lang.ada:19163 Date: 2008-01-03T03:50:29+00:00 List-Id: 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 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.