What are Redlib and Newlib?

Showing results for 
Search instead for 
Did you mean: 

What are Redlib and Newlib?

Senior Contributor I

The LPCXpresso IDE is shipped with three C libraries:

  • Newlib - GNU C library
  • NewlibNano - a version of the GNU C library optimized for embedded.
  • Redlib - Our own (non-GNU) ISO C90 standard C library, with some C99 extensions.

By default, LPCXpresso will use the Redlib (family of) libraries for C projects and the Newlib (family of) libraries for C++ projects. Newlib provides complete C99 and C++ library support at the expense of a larger (in some cases, much larger) code size in your application. If you prefer a smaller application and don't need the additional functionality of the C99 or C++ libraries, you should use Redlib, which can can produce much smaller applications.

Redlib extensions to C90

Redlib does implement a number of extensions to the C90 C library specification, including some from the C99 specification. These include

    • Single precision math functions
      • Single precision implementations of some of the math.h functions such as sinf() and cosf() are provided.
    • stdbool.h
      • An implementation of the C99 stdbool.h header is provided.
    • itoa
      • itoa() is non-standard library function which is provided in many other toolchains to convert an integer to a string. To ease porting, an implementation of this function is provided, accessible via stdlib.h. For more details, please see the FAQ "itoa() and uitoa() in Redlib".

Library variants

Each C library is also provided in three variants (None, Nohost and Semihost).

For details please see the FAQ "What are none, nohost and semihost libraries?".

For details on how to switch the selected C library, please see the FAQ "Switching the selected C library".

Labels (1)
0 Replies