From: anon@anon.org (anon)
Subject: Exceptions (was Re: How do I go about creating a minimal GNAT runtime?)
Date: Tue, 10 Feb 2009 02:34:06 GMT
Date: 2009-02-10T02:34:06+00:00 [thread overview]
Message-ID: <yI5kl.18507$4m1.7959@bgtnsc05-news.ops.worldnet.att.net> (raw)
In-Reply-To: eb511600-6446-4bad-b859-0d7444416a4c@d36g2000prf.googlegroups.com
To compile and execute a simple program that uses a raise statement
such as in the following code:
--
-- Sample code
--
procedure test is
begin
raise Program_Error ;
end test ;
you will need the following list of packages in your "rts/adainclude" and
the *.ali stored in "rts/adalib". You will also need to build the
"libgnat.a" by using the "ar r <list of object files>" command and store
in the "rts/adalib" dir.
a-except.adb -- Ada.Exceptions Edited to conform to RM.
a-except.ads Simpler design. That removes
most Import/Exports except for
exports for the RChecks
routines.
Rchecks routines defined in
body and are rewritten to use
Raise_Exception instead of
GNAT's complex algorithm.
a-unccon.ads -- Ada.Unchecked_Conversion
ada.ads -- Ada
s-secsta.adb -- System.Secondary_Stack Compiler uses this package for
s-secsta.ads functions that return a string
value. Also requires
System.Storage_Elements.
s-memory.adb -- System.Memory This is a test environmental
s-memory.ads package that simulates a heap
Needs a true hardware memory
management. That can handle
static and virtual system.
s-stalib.adb -- System.Standard_Library Defines standard Exceptions
s-stalib.ads and storage. Basically copied
from GNAT.
s-stoele.adb -- System.Storage_Elements
s-stoele.ads
system.ads -- System GNAT compiler based.
--
-- Extra packages use for output of exception message
--
g-io.adb -- GNAT.IO use for Put/Put_Line/New_Line
g-io.ads connects to Video_IO
gnat.ads -- GNAT
video_io.adb -- Video_IO Text/Graphic SAGA device driver
video_io.ads
The reason you must rewrite "Ada.Exceptions" is that it uses multiple
c-to-os functions, which some are defined in:
System.CRTL -- defines C RTL ( not used in an Ada only OS )
System.Memory -- defines C memory functions. ( Needs be defined
Ada to CPU Memory routines first )
-- In other words a complete memory management system
-- is needs to make this package fully functional, but
-- it can be simulate by using a large array of bytes.
--
cio.c -- defines C RTS to OS for I/O operations. Must be
-- converted to a complete sub-system. In my example
-- I used a modified "GNAT.IO" and the "Video_IO"
-- device driver.
Then there the "System.Soft_Links" package. Do you really need
it. In most cases, for the core of the kernel the answer is No!
Now there are some binder variables are procedures that needs to be
define in Ada, they are normally found in "Initialize.c", "init.c",
"finalize.c". In my example I create a package called "gnat_library"
to store these in Ada routines and variables.
#
#
#
rm test
gnat compile gnat_library.adb --RTS=rts
#
gnat compile test.adb --RTS=rts
gnat bind test.ali --RTS=rts
#
# To make the routine executable, must move the "function main" to
# the beginning of the ada_main package before compiling.
#
gnat compile b~test.adb --RTS=rts -gnatA -gnatWb -gnatiw -gnatws
#
# gnatlink test.ali gnat_library.o -n -v -v --RTS=rts
#
# Problem: Adds all gcc libraries and includes host Ada Library Path
# and in some case will cause linker to stop processing. So
# it still better to use the "gcc" program.
#
gcc b~test.o gnat_library.o ./test.o text_io.o video_io.o --RTS=rts \
-o test -L./ -L/example/ada/gnat/rts/adalib/ \
/example/ada/gnat/rts/adalib/libgnat.a
#
#
#
In <eb511600-6446-4bad-b859-0d7444416a4c@d36g2000prf.googlegroups.com>, Lucretia <lucretia9@lycos.co.uk> writes:
>Hi (again),
>
>It's been a while, but I'm coming back to my Ada kernel again. I've
>been messing with my helo_world_kernel which I built using no runtime
>(see http://www.archeia.com for more info).
>
>Having just spoken to Ludovic on #Ada, he pointed out that the gnat
>tools can use a basic cross tool set, like the ones I have built
>myself (again, see the above link). My toolset comprises of a gnat1
>compiler and a gnatbind for my targets. I found that it does work
>using the --GCC and --GNATBIND flags, and I need to make sure the
>cross tools and the host tools are of the same GCC version otherwise
>GNAT throws up ALI format errors.
>
>The thing is, I've been trying to enable exceptions, but keep coming
>across big problems in that the runtime requires features that are
>being restricted, such as returning aggregates and assigning
>composites, returning unconstrained objects which requires the
>secondary stack. So, what I really need to know is, how do I create a
>runtime which is restricted in this way for bare hw access?
>
>Thanks,
>Luke.
next prev parent reply other threads:[~2009-02-10 2:34 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-24 20:47 How do I go about creating a minimal GNAT runtime? Lucretia
2009-01-25 11:13 ` Ludovic Brenta
2009-01-25 11:18 ` Ludovic Brenta
2009-01-25 14:00 ` Lucretia
2009-01-25 14:00 ` Lucretia
2009-01-25 19:43 ` Ludovic Brenta
2009-01-25 20:30 ` xavier grave
2009-01-26 6:52 ` anon
2009-01-26 21:36 ` anon
2009-02-10 2:34 ` anon [this message]
2009-02-16 1:41 ` Hibou57 (Yannick Duchêne)
2009-02-21 9:11 ` Dimonax
2009-02-21 16:41 ` anon
2009-02-21 21:14 ` Dimonax
2009-02-22 1:36 ` anon
2009-02-27 23:42 ` Randy Brukardt
2009-03-01 1:12 ` Dimonax
2009-03-01 19:13 ` anon
2009-03-02 22:07 ` Randy Brukardt
2009-03-03 2:00 ` anon
2009-03-03 22:23 ` lucretia
2009-03-04 0:03 ` anon
2009-03-11 12:54 ` gautier_niouzes
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox