AnsweredAssumed Answered

Switching the selected C library

Question asked by LPCware Support on Mar 31, 2016

Overview

 

The LPCXpresso IDE is provided with two different C libraries - Redlib and Newlib, each of which is supplied in a number of library variants. LPCXpresso v7 also introduced a further library, Newlib-Nano, a space optimized version of Newlib.

 

Normally the library and library variant used by a project are set up when the project is first created using the New Project Wizard. However it is quite simple to switch the selected C library from Redlib <-> Newlib, and switching the library variant in use from Semihost <-> Nohost <-> None. To switch go to:

 

Quickstart -> Quick Settings -> Set library/header type

 

and select the required library and variant.

Alternatively, you can make the required changes to your project properties manually as follows...

 

  • The 2 libraries use different header files. When switching between Newlib and Redlib libraries you must also switch the headers. To do this:

 

    1. Select the project in Project Explorer
    2. Right-click and select Properties
    3. Expand C/C++ Build and select Settings
    4. In the Tools settings tab, select Miscellaneous under MCU C Compiler. Note that Redlib is not available for C++ projects
    5. In Use Library headers, select Newlib or Redlib
    6. In the Tools setting tab, select Architectcure & Headers under MCU Assembler
    7. In Library headers, select Newlib or Redlib

 

Repeat the above sequence for all Build Configurations (typically Debug and Release).

 

  • To then change the libraries actually being linked with (assuming you are using Managed linker scripts):

 

    1. Select the project in Project Explorer
    2. Right-click and select Properties
    3. Expand C/C++ Build and select Settings
    4. In the Tools settings tab, select Managed Linker Script under MCU Linker
    5. In the Library drop-down, select the Newlib, NewlibNano or Redlib library variant that you require (None, Nohost, Semihost).

 

Again repeat the above sequence for all Build Configurations (typically Debug and Release). Note the Redlb is not available for C++ projects

 

Note that if you are providing your own linker script (you are not using the "Manage linker script" option), you will need to add appropriate entries to the linker script detailing the library/variants to use. For more details, please see the FAQ: Using your own linker scripts.

 

For more information

 

Outcomes