Skip to main content

IAR Embedded Workbench for RX 5.20

Customizing and building your own runtime library

In this section:

If the prebuilt library configurations do not meet your requirements, you can customize your own library configuration, but that requires that you rebuild relevant parts of the library.

Note

Customizing and building your own runtime library requires access to the library source code, which is not available for all types of IAR Embedded Workbench licenses.

Building a customized library is a complex process. Therefore, consider carefully whether it is really necessary. You must build your own runtime library when:

  • There is no prebuilt library for the required combination of compiler options or hardware support, for example, locked registers or 16-bit int

  • You want to build a library for applications that use either ROPI or RWPI separately, but not both.

  • You want to define your own library configuration with support for locale, file descriptors, multibyte characters, etc. This will include or exclude certain parts of the DLIB runtime environment.

In those cases, you must:

  • Make sure that you have installed the library source code (src\lib). If not already installed, you can install it using the IAR License Manager, see the Licensing Guide.

  • Set up a library project

  • Make the required library customizations

  • Build your customized runtime library

  • Finally, make sure your application project will use the customized runtime library.

To set up a library project:
  • In the IDE, choose Project>Create New Project and use any of the library project templates that are available for the prebuilt libraries and that matches the project settings you need as closely as possible. See Prebuilt runtime libraries.

    Note

    When you create a new library project from a template, the majority of the files included in the new project are the original installation files. If you are going to modify these files, make copies of them first and replace the original files in the project with these copies.

To customize the library functionality:
  1. The library functionality is determined by a set of configuration symbols. The default values of these symbols are defined in the file DLib_Defaults.h which you can find in rx\inc\c. This read-only file describes the configuration possibilities. Note that you should not modify this file.

    In addition, your custom library has its own library configuration filelibraryname.h—which you can find in the rx\config\template\project directory—and which sets up that specific library with the required library configuration. Customize this file by setting the values of the configuration symbols according to the application requirements.

    For information about configuration symbols that you might want to customize, see:

  2. When you are finished, build your library project with the appropriate project options.

    After you build your library, you must make sure to use it in your application project.

    Danger

    To build IAR Embedded Workbench projects from the command line, use the IAR Command Line Build Utility (iarbuild.exe). However, no make or batch files for building the library from the command line are provided.For information about the build process and the IAR Command Line Build Utility, see Building projects.

To use the customized runtime library in your application project:
  1. In the IDE, choose Project>Options>General Options and click the Library Configuration tab.

  2. From the Library drop-down menu, choose Custom.

  3. In the Configuration file text box, locate your library configuration file.

  4. Click the Library tab, also in the Linker category. Use the Additional libraries text box to locate your library file.