This is the mail archive of the newlib@sourceware.cygnus.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: libgloss and newlib



Thank you Doug,

I also just got useful reply from the crossgcc list:

From: Kai Ruottu <karuottu@freenet.hut.fi>
Sender: crossgcc-owner@sourceware.cygnus.com
To: Mark Pulver <mpulver@research.canon.com.au>
Cc: crossgcc@sourceware.cygnus.com
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
'newlib/libc/sys/arm/syscalls.c'.
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
'startfile'
('crt0.o' or perhaps something else) will be used...

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

*lib:
-lc

*libgcc:
-lgcc

*startfile:
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
ELF...)

 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, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]