Building gnat/rtems with gnat 3.12p and gcc2.8.1 (hello_world_ada)

Joel Sherrill joel.sherrill at OARcorp.com
Mon Aug 6 20:51:48 UTC 2001



lange92 at 2067.resnet.uni.edu wrote:
> 
> Hi all,
>   I found that I could successfully build the hello_world_ada example
> with the pc386 bsp using the attached Makefile and init.c files.
> Basically, the changes I made were to change the function named gnat_main
> to _ada_main in 2 places in the init.c file, and created 2 variables
> called libobjdir and libsrcdir in the Makefile, and added the parameters
> -aOdir and -aIdir to gnatmake in the `all' target, respectively.
>   Everything compiles fine, and it ends by running the i386-rtemscoff-size
> program, with the following results:
> 
>    text    data     bss     dec     hex filename
>  147808    7324   32756  187888   2ddf0 hello
> 
>   However, the web page says that it should create
>    hello_world_ada/o-optimize/<filename>.exe
> so that would be
>    hello_world_ada/o-optimize/hello.exe

This looks OK since the name of the executable is directly selected by
gnatmake.  The reference to o-XXX/*.exe is just a place where either
gnat versions have changed it or the manual is showing its C/C++ heritage.

>   Maybe I'm just being paranoid, since it did produce a binary, but there
> is no o-optimize directory created, and there is no reference to
> o-optimize in the Makefile. I'm quite happy to report that I no longer
> need any crt*.o files copies to the directory where I'm building
> hello_world_ada.

That's very good to hear. 

>   Now, the binary is 2161934 bytes in size, so it's too large to be
> written to a floppy and booted, if that is the proper way to test it. So
> how do I test the executable? Should I build a netboot floppy and send it
> over via a simple bootp/tftp bootstrapping method? The documentation just
> states that this step is dependent on the bsp selected (pc386).

It is that large because it has symbolic information.  You can do
an i386-rtemscoff-strip to SIGNIFICANTLY reduce its size.  It SHOULD
then boot from a grub floppy or the netboot/tftp method.  I recall 
people also having useds lilo and the bsd loader at various times.
 
>   I also have not figured out the use of "-n" and where to put a reference
> to call "adafinal", as Joel pointed out in a previous message.

You should call it once ada_main returns to do cleanup before exitting
the application.

>   Any ideas where to go from here?

Boot it up and try it.  Once it works, let's revisit your notes and
get the modifications in so the pc386 works again with gnat.

> DanL
> 
>   -------------------------------------------------------------------------------
>                Name: Makefile
>    Makefile    Type: Plain Text (TEXT/PLAIN)
>            Encoding: BASE64
> 
>              Name: init.c
>    init.c    Type: Plain Text (TEXT/PLAIN)
>          Encoding: BASE64

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985



More information about the users mailing list