This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: platform initialisation
- From: Darin Johnson <chezdj at earthlink dot net>
- To: Bahadir Balban <bahadir dot balban at gmail dot com>, newlib at sourceware dot org
- Date: Mon, 10 Apr 2006 15:18:09 -0400 (EDT)
- Subject: Re: platform initialisation
- Reply-to: Darin Johnson <darin at usa dot net>
>Suppose we have a stand-alone application to run on bare-metal with no
>OS. Is the C library initialisation responsible for initialising
>platform devices in this case?
There's no hard rule about this, but I'd say that the C library is not
responsible for this. Generally, platform specific details should not
be in the C library, but in a separate platform library, or as part of
the application. Even crt0.s is very often not a part of the C
library for this reason (people often write their own, or do their
own initialization before branching to crt0.s).
Newlib blurs the line a bit here since it ships with both a C library
and "libgloss" which has some basic platform support. But even then I
suspect most projects don't have heavy dependence on libgloss, but use
it as a guide or for initial porting.
The reason for all this is that you often want the C library to be
standalone. That is the same library should be usable in many
different projects. If they use the same CPU then the library
shouldn't even need recompilation. In the same way that a C library
shouldn't be customized for specific applications, it shouldn't need
customization for specific platform details either.
--
Darin Johnson