How to use the SEGGER Runtime Library with NXP's MCUXpresso

From SEGGER Wiki
Jump to: navigation, search

In order to use the SEGGER Runtime Library in the MCUXpresso IDE, follow these steps:


  • Download and install MCUXpresso from
  • Download and unzip emLib-C from
  • This will yield two folders:

Create a new project for the NXP MCU of your choice or import an SDK example project

  • Skip this step if you already have your own project
  • Make sure the project builds without errors

Copy the SEGGER Runtime Library LIB folder into your MCUXpresso project


Make sure the LIB folder is part of the project

  • Right-click on the LIB folder and select “Properties”
  • In “C/C++ Build > Settings”, un-check the box that says “Exclude resource from build”


  • Click “Apply and Close”

Add LIB folder to the list of include paths

  • Right-click on the project node in the project explorer and select “Properties”
  • Go to “C/C++ Build > Settings > MCU C Compiler > Includes”
  • Click “Add”
  • Add “../LIB” as new directory path


  • Click “OK”
  • Click “Move Up” to move ../LIB to the first position in the list


Remove existing library from the project

  • In the project properties, go to: “C/C++ Build > Settings > MCU Linker > Managed Linker Script”
  • In the “Library” pull-down menu, choose “No libraries”


  • When prompted, click “Yes” to rebuild the index


In source files that make calls to the SEGGER Runtime Library, include “__libc.h” (starting with a double-underscore)


Build the project

  • You will most likely encounter linker errors related to functions like __assert(), __putchar(), and __getchar()
  • You need to implement these functions in your project according to your needs before the project will build correctly.
  • Dummy implementation of __putchar():
  int __putchar(int ch, __printf_tag_ptr pvoid) {
  return 1;
  • Dummy implementation of __getchar():
  int __getchar(void) {
  return 1;
  • Basic implementation of __assert():
  void __assert(const char *expression,
                const char *filename,
                int line) {
    for(;;) ;
  • After implementing these functions, your project should build without errors
  • Consider cleaning the project before building it

Refer to the SEGGER Runtime Library User Guide in the Doc folder for additional information