Configuring for bare hw ia32 PC's

Luke A. Guest laguest@archeia.com
Wed May 14 22:11:00 GMT 2008


On Tue, 2008-05-13 at 08:49 -0500, Joel Sherrill wrote:
> > Er, no. This is the way that Ada works. There are parts of the language
> > which when compiled, the compiler adds in extra bits of support.
> >   
> Right.  It assumes a lot of things exist.  For the tasking to
> work, you need a lot.  RTEMS uses the POSIX threads port
> which by default assumes pthreads, mutexes, condition
> variables and keys.   The GNAT run-time also includes

No need to have this. I'm going to be implementing my own tasking model,
so that when I come to port GNAT to work on top of my kernel, then I'll
have full Ada :D

> a socket binding.  The Ada run-time has a lot of nice
> formatted IO support which I have no idea how it is
> implemented in GNAT. 

The IO is all based on POSIX calls, so open, close, read, write, etc.

> >> Back up a second. You are, in effect, compiling Ada code to run on a
> >> bare board. The "hosted" specification of the standard C library assumes
> >> that you are running on top of an operating system. The "freestanding"
> >> version does not.
> >>
> >> It is okay if the Ada compiler emits things that rely on the
> >> freestanding version of libc. Pragmatically, it is also okay if it
> >>     
> >
> > Do you mean, "is it?" I would say, no that's fine. I want a basic
> > runtime, just not the extra bits. Unfortunately, the way the GNAT source
> > is built, there doesn't seem (I could be wrong) to be a way to say, I
> > only want this and this and this, not that.
> >
> >   
> They used to and may still have a bare non-tasking configuration.

There are options that you can set inside system.ads, so I'd have to
create a runtime directory in my build tree and copy over the parts I
need. I would then modify the system.ads file to say what I want to
include in the runtime.

I did actually do this already:
http://www.archeia.com/an-ada95-hello-world-style-kernel.html

> > The initialisation code will generate a call to memcpy. This is
> > something I will most probably want to include in *my runtime*.
> >   
> And it is not uncommon to find it automatically generating
> calls to lock a run-time structure either. 

Ah, but I won't be using tasking so it shouldn't generate those either,
this is a flag in system.ads as well, IIRC.

> > Also, to actually get the gnat tools (e.g. gnatmake, gnatclean, etc) you
> > have to build the runtime. Also, I suspect that to get ASIS (which may
> > be necessary) you also need the runtime and the tools. :(
> >   
> You can cross compile.  That's what we do.

Yes, but don't you use gnatmake for your build? This requires a full
toolset which you won't get until you've ported GNAT over to your OS for
that platform. The way I did it was to use the cross tool i386-elf-gcc
and i386-elf-gnatbind programs, I then link by hand.

Thanks,
Luke.




More information about the Newlib mailing list