Newlib for embedded linux systems?
Wed Jun 11 09:42:00 GMT 2003
> Thanks for the pointers.
> Well, I happened to come across this comment on newlib and since I am
> evaluating the suitability of using newlib as the C library on an embedded
> powerpc system running Linux, I would put this here for clarification.
> "Newlib is a free C library intended for use on embedded systems, with less
> restrictive licensing than the GPL. However, it currently lacks the libgloss
> layer necessary to use it as the C library under Linux."
> May be, it is all the past.
> Does newlib(1.11) come with libgloss port for Linux OS?
Newlib now has linux support within newlib, however, it is currently
only supported for x86. It is worth noting that the majority of the linux
code is platform independent so adding another platform is certainly doable.
To start, you need to add the machine-dependent parts for powerpc. The
most important of these bits is the syscall assembler code.
The current linux code is LGPL which means you are free to grab stuff out of glibc.
There may be platform specific code that may need to be added because powerpc
doesn't support a syscall in the same way x86 does. Check out the glibc
sysdeps/unix/sysv/linux/powerpc directory. Since we don't support older kernels,
you don't need to worry about code that is specifically there to handle older kernels
that are missing certain syscalls. For example, you might find a piece of code that
is looking to see if a certain syscall exists and then performing alternative code if it
is not found. This code will likely be moot because the syscall is part of the
kernels we support.
The linux version of newlib has to be built natively to use libtool for
building shared libraries. If you look at the x86 stuff, you should be
able to copy the majority of it in newlib/configure.host for powerpc linux.
To configure and build you need to use --with-newlib when configuring
natively. You will also have to edit the top level configure.in so
it will allow you to build target-newlib.
If you have any questions after getting started, let me know.
> I mean, can I use newlib as the (shared or static) C-lib for powerpc
> embedded systems running Linux?
> What are the required modification/considerations, if I want to port it
> One more question, my intentions is to bring up a customized (I mean, with
> no unnecessary code in flash/ram) Linux system on a PowerPC (MPC8260) board,
> to run a couple of application tasks (threads/processes) concurrently.
> Glibc is massive in size, I understand. Is newlib a good choice here?
Newlib is smaller but not as robust. You can tailor the size of newlib that
you need by picking the level of EL/IX that supports your application.
The EL/IX level is configured in by specifying --enable-newlib-elix-level=[1-4].
For details on EL/IX and what functions are provided in the various levels, see:
-- Jeff J.
> Ramanathan G A
> -----Original Message-----
> From: J. Johnston [mailto:email@example.com]
> Sent: Wednesday, June 04, 2003 11:12 PM
> To: Anandapadmanabhan,Ramanathan
> Cc: firstname.lastname@example.org
> Subject: Re: err configuring newlib for powerpc-linux
> Anandapadmanabhan,Ramanathan wrote:
>>I am trying to setup an cross development envrn. for powerpc-linux on
>>Built binutils 220.127.116.11.4 and GCC (cross) 3.2 and was then trying to
>>configure and compile newlib 1.11.0
>>(anything wrong with using newlib here?. Mine is an embedded powerpc
>>-MPC8260- target system)
> Newlib is barred by the *-*-linux* catchall in the top-level configure.in
> (i.e. it is not newlib that is preventing this). However, do you really
> powerpc-linux? Would powerpc-eabi or powerpc-elf suffice for your embedded
> -- Jeff J.
More information about the Newlib