This is the mail archive of the newlib@sourceware.org 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]
Other format: [Raw text]

Re: Steps for porting Newlib to a new Target processor without any OS


Sriharsha wrote:
Hello Everyone,
   we have a new 16-bit processor for which GCC 3.2 is ported as a
cross compiler. Now, I want to port Newlib also, as the default C
library for gcc. I tried following the steps described in the newlib
site (http://sources.redhat.com/newlib) for porting newlib to a new
processor, but I feel that those steps are insufficient. The following
are the questions I have. I'd be glad if anyone can take time to answer
them. I tried searching the archieves, but couldnt get all the answers.

1. Our processor does'nt yet have an OS, so no system calls are available.

As previously pointed out by Jon Beniston, you only have to supply a modest set of syscalls via libgloss to support newlib. These can be anything you want and they can even be stubs that fail. A library of stubs (libnosys.a) is created just for such an occasion. You will still need to supply an _exit and crt0 in that case, but that is relatively easy to do.


2. Our processor does not support IEEE floating point numbers (and their
arithmetic ofcourse), but supports real numbers in Q.15 format. So, can
I modify the floating point functions to deal with Q.15 numbers?

No, you should not modify the libm routines.


gcc supports IEEE floating-point via integer math for platforms that don't have hardware float support (i.e. libgcc). This would apply to your chip. Newlib libm in conjunction with the basic floating-point operators supplied by gcc does not require hardware floating-point support on the platform.

You can optionally supply a library of Q.15 routines for the end-user that map directly to the functionality of the processor.

3. I want to port only the non-OS dependent part of the library (and
preferably math library using Q.15 format for real numbers). Is this
possible?

As specified in the answers above, there is no point to this. A stub syscall library is already created for you and the math routines are a non-issue.


4. I also want some standard functions like printf use specific hardware
(like serial port) for I/O. Where and how do I change this?

See Jon's note about this.


5. Last but not the least, I tried adding my processor name to
configure.host in newlib1.13.0/newlib/ directory, but it is not
recognizing my processor.

You have to modify the top-level files (in the parent directory of newlib and libgloss) to recognize your processor.


-- Jeff J.


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