The Newlib is a collection of simple ANSI C library, math library
and collection of board support packages. Newlib documentation is available
on the net via:
Newlib Documentation.
1. Using the Libraries
- Compiling
To use these libraries, there is nothing special to do. The gcc
front-end passes the good -I options so that include files are
searched correctly.
- Linking
At link time, gcc does not pass the -lc library.
This library must be passed manually.
They should be passed as -lc. The -mshort and
-fshort-double options must also be passed as they tell gcc
which multi-lib library it has to get.
The -m68hc11 and -m68hc12 options may be used also.
They operate on the target CPU type during the code generation and
also at link time to choose the correct set of libraries. If the
option is forgotten or wrong, a mix of 68HC11 and 68HC12 object files
and/or libraries can occur. The linker will issue an error if such
situation happens.
2. Problems
The libc and libm libraries can make your program quite
huge. This is the case if you use printf or sprintf because
these function support the floating point translations.
This libc is however useful if you only use small functions such as
strcpy, strcmp, memmove, and other things like that.
|