Utilizziamo i cookie per rendere migliore la tua esperienza di navigazione. Per rispettare la nuova direttiva sulla privacy, è necessario chiedere il tuo consenso per impostare i cookie. Per saperne di più.
Most toolchains using GCC also use either newlib, newlib-nano or glibc. Unfortunately, these libraries have significant disadvantages over professional runtime libraries for embedded systems.
This is where emRun, the SEGGER Runtime Library, comes in. It can be used with GCC, LLVM, and other toolchains to provide a runtime library designed and architected for embedded systems.
- Requires no heap or memory management.
- Reduces RAM usage.
- Reduces ROM usage.
- Significantly improves performance.
- Contains no viral licensing or attribution clause.
What Is emRun?
The SEGGER Runtime Library emRun is a complete C runtime library to be used with any toolchain. It converts any GCC-based toolchain into a professional development choice. It is is used in SEGGER's Embedded Studio IDE and has proven its value for years.
The SEGGER Runtime Library emRun has been designed and written from the ground up for embedded devices to enable high optimization with low requirements.
- Significant code size reduction (typically around 5 kB)
- High performance, with time-critical routines written in assembly language
- Highly optimized functions that, when used, don't cause the inclusion of many additional support functions (e.g. printf)
- Formatted input and output functions are customizable from basic I/O to fully featured I/O, enabling reduction of final code footprint
- Full support for localization, UTF-8, code pages, and locale codecs is linked only if used
In many cases, the ROM-savings of emRun 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.
Being a simple replacement for libraries, such as newlib or newlib-nano, emRun shrinks and accelerates embedded applications. Whether the main concern with newlib is flash size, performance, or the attribution clause of the viral licensing, the SEGGER Runtime Library emRun is the solution.
Optimized Floating-Point Library
A key component of emRun is emFloat, a highly optimized, IEEE 754 compliant, floating-point library designed from the ground up for embedded systems.
Very fast and very small, it delivers FPU-like performance in pure software.
Even where an FPU is available emFloat boosts the FPU’s performance for complex mathematical functions.
Developed and honed over a period of more than two decades, emFloat is configurable for small code size or increased execution speed or a combination, with calculated results identical in all modes.
SEGGER's Runtime Library emRun can be licensed in source code to individual companies as well as to be included as libraries by providers of toolchains.
- Source code makes it possible to step through library functions
- Many functions can be tuned with different implementations for size-optimized code and speed-optimized code
SEGGER's Runtime Library emRun is available in generic "C" code to run on any system. Additionally assembly optimized variants are available for:
- ARM (Cortex-M and Cortex-A 32-bit)
- RISC-V (RV32M)
Ports for other CPUs can be made available on request. If you are interested, please contact us for more information.
SEGGER's Runtime Library emRun offers significant savings in flash memory. This is due to some functionality being written in assembly language, but primarily due to a structure that minimizes library internal dependencies, for example the file I/O not being linked in with printf() or scanf().
SEGGER's Runtime Library emRun also uses less static RAM due to a structure designed from the ground up for embedded systems.
1: mcuxpresso ide v3.1.0-2200 and sdk 2.5.0 for the freedom k66f board
2: embedded studio 4.16 with the kinetis k60 cpu support package v1.02
SEGGER did some benchmarking on emRun using NXP’s MCUXpresso as a representative IDE that might benefit from using emRun. The benchmark consists of a simple "printf()" with output to a debug terminal. We compared the results for emRun with the results for three other C libraries (Newlib, Newlib-nano, and Redlib). In each case, printf() was configured for the smallest possible size (size-optimized libraries, no floating point...). We then also tested with our own IDE, Embedded Studio, with the same code, using emRun, in one case using the GNU Linker, in another case using the SEGGER Linker.
The performance of a runtime library can have a huge impact on the speed of your application. You might actively use or try to avoid library functions, such as sprintf(), memcpy(), memcmp(), .... But especially when dealing with floating point or 64-bit operations, the compiler will make you call library functions, such as for division and multiplication, that you do not see. Here the choice of the right runtime library can make the difference.
SEGGER's Runtime Library emRun uses improved, highly advanced low-level implementations for such operations, which can be tuned for speed or size. With the assembly optimized variants, performance can be even more optimized by using the target platform to its full potential.
To verify the correct functionality of emRun, we created and used our verification test suite. It checks the entire functionality of all library functions, including the entire floating point library with all corner cases.
More than 450 different tests with millions of test cases are executed. Below an exert for just a single test for sys_float64_add(), adding 64-bit doubles:
IEEE-754 Floating-point Library Tests Copyright (c) 2018-2019 SEGGER Microcontroller GmbH. sys_float64_add: 0 failures (47256 tests) Totals: 0 failures (47256 tests)
If you are interested in replaying our results, or if you want to verify the library you currently use, or if you are going to develop your own runtime library, you can get the SEGGER Runtime Library Verification Test Suite.
How to Use emRun
SEGGER's Runtime Library emRun can be used with any GCC-based IDE/toolchain by replacing the runtime library delivered with that toolchain (usually newlib, newlib-nano, or some other variant) with emRun.
- AC6 System Workbench for STM32 (SW4STM32)
- Atmel Studio 7
- Atollic TrueStudio for STM32
- NXP MCUXpresso
- Renesas e2 studio (for Synergy or RZ targets)
- SiLabs Simplicity Studio
In SEGGER Embedded Studio and Rowley CrossWorks, emRun is already included as the default C library.
SEGGER's Runtime Library emRun is provided in source code and contains everything needed.
We recommend keeping emRun separate from your application files. It is good practice to keep all the associated program files (including the header files) together in the LIB subdirectory of your project’s root directory. This practice has the advantage of being very easy to update to newer versions of emRun by simply replacing the LIB directory. Your application files can be stored anywhere.
Please make sure that the list of included directories in your project contains the LIB directory and that any other runtime libraries are removed from the project.
Include "__libc.h" in any application source files that make calls to emRun.
You will also need to implement functions like __assert(), __putchar(), and __getchar() in your project according to your needs before the project will build correctly.
SEGGER's Runtime Library emRun is exposed to the user by a set of header files that provide an interface to the library. The actual implementation is done in a small number of C source and Assembly files that must be added to your project before building.
The configuration of emRun is defined by the content of __libc_conf.h, which is included by all C and assembly language source files.