setting up a custom libgloss platform

Jeff Lasslett jeff.lasslett@datataker.com.au
Sun Aug 27 15:43:00 GMT 2006


Greetings,

	I am in the process of creating a GNU toolchain and newlib for developing 
embedded software for a powerpc based embedded system.

I have built the powerpc-eabi toolchain and newlib and I have used it
to build a bootstrap application (bootstrap + other functionality).
So I'm going fairly well.

But sscanf and sprintf functions don't work properly yet because I
am still linking against libnosys.

I have assumed that I need to create a platform suited to my hardware
under the libgloss directory of newlib.

I have read the "What steps do I need to do to port newlib to a new platform?" 
question in the newlib FAQ.  The answer to that question is a list of seven 
steps.  The first 5 seem to be about the CPU so I have ignored them as I am
targetting a powerpc which is already supported.

Step 6 seems the most pertinent.  It briefly talks about setting up a platform 
dir under the libgloss dir, and looking at the fr30 or mn10300 platforms for
guidance.

So I copied the fr30 dir to my own dt8x dir.  I adjusted the contents of 
syscalls.c, made a few adjustments to configure.in and Makefile.in and, after 
recompiling newlib (the whole thing), I ended up with libdt8x.a in 
${TARGET}/powerpc-eabi/lib

All good except that my program won't link.  I replaced -lnosys with -ldt8x
in my gcc command line, but sbrk, read, write, lseek, etc aren't picked up
at link time.

What I don't get is that libnosys defines e.g _sbrk but what the linker says 
it can't find is sbrk.  Why is it so?

I also noted that my new libdt8x is only found at the top lib dir and not in
any of the subdirs.  Why wasn't it built for each configuration like libnosys?

So here are my questions ...

Could I please have some more details on what to change in the build scripts 
in order to properly build my own libgloss platform lib for newlib?

I'm also a little in the dark about the semantics of _read, _write, etc.  I 
think I get it if we're talking about IO via a serial port, but I'm calling
sscanf and sniprintf:  these routines read and write from/to strings.   What, 
if anything, is expected of a _read and _write in here?
Or are these routines purely for wrapping around third party filesystem API calls?

Lastly, can I configure newlib to just build one set of libs:  powerpc-eabi,
big-endian, soft floating-point?

I think that's all I have for now.  Thanks in advance for any help you can 
give me.

Cheers,
	Jeff





More information about the Newlib mailing list