newlib without OS
J. Johnston
jjohnstn@redhat.com
Thu Apr 25 12:12:00 GMT 2002
Mark Salter wrote:
>
> >>>>> Paulo Eduardo Ferreira de Castro writes:
>
> > Hello.
>
> > I have some conceptual questions. Any help will be appreciated.
>
> > Is it possible to use newlib for an embedded processor without
> > using an operational system? Certainly, several functions
> > shouldn't work, like "printf" or other I/O in general, because
> > they might depend on a specific hardware/OS. On the other hand,
> > I'd like to be able to use functions like "strcpy" (string.h),
> > "sin" (math.h) and "malloc" (would malloc work?!) without an OS.
>
> Sure this is fairly common, actually. And there's no reason you
> couldn't get "printf" to work on an embedded system without OS.
>
> > In newlib's source code, what are the directories or files that
> > are OS-specific? Are those files the only place where I would
> > find system calls?
>
> Check out the libgloss module. This is where the glue between
> newlib and an embedded system (with or without OS/monitor) is
> found. There are lots of examples there.
>
In libgloss, a special no-OS library is built called libnosys. If
you link your application with -lnosys you can solve the majority of newlib
dependencies and run programs that don't use I/O. You will have
to supply an _exit routine of some sort as libnosys is generic whereas
stopping the program is platform-specific.
-- Jeff J.
More information about the Newlib
mailing list