Stdio redirection?

Aaron J. Grier aaron@frye.com
Thu Oct 5 11:55:00 GMT 2000


On Thu, Oct 05, 2000 at 09:31:10PM +1000, Russ.Shaw wrote:

> Kai Ruottu wrote:
> >  Why you should care about this?  Just remove the low-level routines
> > from all your libc.a's and provide your own glue libs with them inside.
> 
> If i knew what the right low-level functions were, i would. However,
> looking at stdio.h and the newlib sources, there's too many
> conditional compilations controlled by variables from unknown places,
> compounded by all the extra re-entrant library functions.

all the bare-bones low-level interfacing is done in libgloss.  no need
to wade through all of newlib.  I went through this routine when I
started with a bare m68k-elf compiler for an in-house embedded system.
it took me a while to get oriented, too.

all the details are laid out in libgloss/doc/porting.texi.  stubs can be
found in libgloss/libnosys.

> I was going to add to libgloss myself, but there was not sufficient
> information in the source docs, on the web, from newsgroups, or
> mail-lists.

after reading the "Embed with GNU" document, what's left?

> I had not found anywhere that definitely said that those functions
> were at the bottom level with all higher functions using them. A
> message by j.johnston referred to a build-time way that suggests these
> functions, by modifying configure.in etc (i'm still getting around to
> trying it).

I never worried about it at build time -- since it's easy enough to
change linker scripts to link in whatever you need, and you can drive
yourself crazy dealing with autoconf / automake.  I built an external
libgloss and crt0, and linked 'em in by hand/makefile.

> I wire-wrapped my own system and didn't want to add more variables by
> using a monitor. I'd be completely happy if there was a
> straight-forward obvious method for doing the low-level functions,
> knowing that nothing will get broken. And it should be stated
> prominantly in docs such as 'using gcc' or similar.

all there in libgloss/doc/porting.texi.  even information on writing a
gdb back end.  I'm surprised nobody's mentioned it.  it was one of the
first documents I stumbled upon.

here's an online version:
http://www.efm.leeds.ac.uk/~as/gnu/info_html/porting_toc.html

of special interest to you will be the section on porting newlib:
http://www.efm.leeds.ac.uk/~as/gnu/info_html/porting_3.html#SEC10

happy hacking.

-- 
  Aaron J. Grier   |    Frye Electronics, Tigard, OR   |   aaron@frye.com
  "Add [Windows] ME to an old PC with a `mere' 32 MB of memory, and your
   hard disk will be busier than a one-armed man juggling knives."
    --  Winn L. Rosch

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com



More information about the crossgcc mailing list