libgloss and newlib

Mark Pulver
Wed Sep 29 18:12:00 GMT 1999

Thank you Doug,

I also just got useful reply from the crossgcc list:

From: Kai Ruottu <>
To: Mark Pulver <>
Subject: Re: libgloss and newlib
Date: Thu, 30 Sep 1999 01:08:05 +0200

Mark Pulver wrote:
> I'm trying to build an embedded system using a GNU  tool chain
> on a StrongArm board (Brutus).  I have no problem running under gdb
> as IO is handled via SWI to the Angel monitor.
> Reading the "porting" info pages in newlib, mentions that libgloss
> should be used to embed the system.  I have code I can used for crt0.o
> and inbyte() and outbyte(), but how do I hook them into the
> existing newlib (libc.a) code.  Do I put them into my owm libgloss.a?

 The 'write()' implementation for ARM is in
Perhaps it's easiest just to modify the 'write()' there for your own
purposes and rebuild newlib.

> How does the linker choose the my crt0.o not the one in libc.a?

 The GCC 'specs' file and the used linker script will say which
('crt0.o' or perhaps something else) will be used...

-------- clip ----------
-m armcoff %{mbig-endian:-EB} -X



crt0.o%s	<-------
-------- clip ----------

 Here it searches (%s) 'crt0.o' from the path got by using the command
'arm-coff-gcc -print-search-dirs' (or something else if your format is

 Or you can use the '-L' option to force GCC to look for the 'crt0' from
somewhere else first...

> Ideally, I would like stdin/stdout to use a serial port, and stderr
> to write to the LCD.  I have code that does this, I just don't know
> how to use it with newlib.

Making a :
   switch (fd)
       case 1:
         < write to the serial port >
       case 2:
         < write to the LCD >

into your 'write(fd, buffer, size)' implementation would do it...

Cheers, Kai

Want more information?  See the CrossGCC FAQ,
Want to unsubscribe? Send a note to

More information about the Newlib mailing list