SEGGER RunTime Library

From SEGGER Wiki
Jump to: navigation, search

The SEGGER RunTime Library is the replacement from SEGGER for newlib, newlib-nano, and glibc used in most GCC toolchains. These libraries have significant disadvantages over professional runtime libraries for embedded systems. The SEGGER RunTime Library converts any GCC-based toolchain into a professional development choice.

In many cases, the ROM-savings of the SEGGER RunTime Library enable the use of a smaller microcontroller with less on-chip memory. This can result in significant cost savings, especially for devices built in large quantities for the mass market.

For detailed information visit the SEGGER Runtime Library product page on segger.com.

Who benefits from this product?

There are three classes of customer for this product and three variants:

  • End users that wish to replace newlib, newlib-nano, or some other vendor-supplied library with the SEGGER Runtime Library in order to reduce code footprint. In this case, the library is already configured for the target architecture and delivered ready for customer integration into the IDE.
  • Silicon vendors that wish to license the SEGGER Runtime Library in order to offer it to their customers in place of newlib or newlib-nano as a competitive advantage. In this case, the silicon vendor receives a library configured for the processor architecture and ABI and integrates this into their IDE on behalf of all customers.
  • Processor IP vendors that wish to bring up a processor and associated toolset, for a proprietary architecture, where there is no pre-existing runtime library. In this case, the customer receives an architecture-neutral version of the runtime library, with supporting C functions, and integrates this into the compiler toolchain for their architecture.

What does the library contain?

The SEGGER Runtime Library contains implementations of all Embedded C Subset functions required by the ISO standard. In addition it contains some functions that you will find in POSIX.1 and Linux that extend the C library with useful functionality.

However, an implementation of the user-facing C library API is not all that is required to run a C program on a microcontroller. All C operations that do not directly map to machine instructions must be emulated in software. Therefore the SEGGER Runtime Library contains implementations of basic floating point operations, floating point conversions, and integer operations such as multiply, divide, and long shifts which use only fundamental integer data types, addition, subtraction, and shifting.

What parts of the library are machine specific?

Although the SEGGER Runtime Library has C implementations of the required C API and runtime API, implementation of setjmp() and longjmp() are highly compiler, ABI, and machine specific. The SEGGER Runtime Library contains implementations for Arm and RISC-V using standard ABIs, but if you are bringing up the library on a different processor, or using a nonstandard ABI, you will need to implement both setjmp() and longjmp() yourself.

What ports exist for the library?

The SEGGER Runtime Library is already widely deployed and is built into SEGGER's Embedded Studio for both Arm and RISC-V processor architectures.

Arm port

The Arm port confirms to Arm's procedure calling standard for all supported architectures and also the run-time ABI for the Arm Architecture. It provides all required C functions and also the required runtime ABI functions with the correct ABI names. 32-bit and 64-bit integer operations (where required) are written in assembly language. Floating point emulation is written entirely in assembly language, for processors that have no hardware floating point, for both speed and compactness.

RISC-V port

The RISC-V port integrates with the GNU C compiler and provides runtime support using the standard GNU runtme support naming scheme (such as __addsf3 which implements single-precision floating-point addition).

Architecture-neutral port

The architecture-neutral distribution contains functions written in C that allow toolset bootstrapping. The requirements made of the compiler are rudimentary, all that is required is basic integer and unsigned operations, up to 32 bits in width, to be provided. For machines without multiply or divide instructions, runtime support is emulated in plain C. IEEE single-precision and double-precision floating-point and 64-bit arithmetic is written in C. Once basic functionality is attained, the compiler and runtime system can be enhanced by replacing runtime support in C with runtime support in assembly language, one function at a time.

IDE specific content