emRun++ is a complete C++ standard library for use with any toolchain. It is specifically tweaked for embedded systems and applications. As a modern programming language, C++ is becoming increasingly important in the embedded sector offering developers more and more options. With this in mind, emRun++ is constantly being enhanced to meet the most modern C++ standards.

emRun++ is also part of SEGGER’s Embedded Studio IDE. Included in the ready-to-use toolchain and C runtime library of Embedded Studio, it is available out of the box and has all the features that make object-oriented programming (OOP) fast and easy.

Key features

  • Comprehensive C++ standard library
  • Compatibility with common C++ standards, C++17
  • Complete integration with emRun
  • Dynamic memory management, optimized for embedded systems
  • Exception handling, including target unwinding on all supported targets

Modern C++ features

emRun++ implements classes and functions according to C++ standards. It also supplements the language features and incorporates the complete feature set of the C++17 standard defined by the International Organization for Standardization (ISO).

emRun++ provides all standard C++ header files together with wrappers for the C runtime library headers. The implementation includes mangled names of standard C functions, such as cos(float) and cos(double) to its C equivalents cosf() and cos().

Dynamic memory allocation

Modern C++ applications rely on dynamic memory allocation. Objects are present in memory only while they are being used. Long-lived objects are usually created with “new” and destroyed with “delete”. While C++ takes care of calling objects’ constructors and destructors respectively, the regular C runtime library basically does the memory management.

emRun++ implements “new” and “delete” to use the alloc and free routines of the C runtime library emRun, which provides efficient use of heap memory, requiring the least overhead.

Exception handling

C++ defines the use of exceptions, in contrast to C where it is the user’s responsibility to manually recover from an error and pass errors up to all callers or to run into a fault. Exception handling offers a systematic and robust approach to cope with errors that cannot be recovered from locally. Exceptions can be thrown in case of an error and are passed up the call stack up to a point where they are caught and handled.

When an exception is thrown in a try block, all objects constructed within the block need to be destroyed, and the stack is unwound. To provide exception support, emRun++ implements the target architecture-dependent stack unwinding for all supported architectures.

Low-level support

C++ compilers define an application binary interface (ABI) which, for example, defines how objects are arranged, how name mangling works, or how virtual functions are implemented.

emRun++ implements the low-level functions of the C++ ABI to which the compiler implicitly adds calls in code generation. This enables the C++ library to be used out-of-the-box with any toolchain.

Memory footprint

Arm (32-bit)

ROM Usage [Bytes]
Test ProjectemRun++ [2]libstdc++ [3]

RISC-V (32-bit)

ROM Usage [Bytes]
Test ProjectemRun++ [4]libstdc++ [5]

RISC-V (64-bit)

ROM Usage [Bytes]
Test ProjectemRun++ [6]libstdc++ [7]

[2] SEGGER Embedded Studio for ARM version 6.32b, emRun++, GNU Toolchain, ARMv7M

[3] GNU Arm Embedded Toolchain version 10.3-2021.10, libstdc++, ARMv7M

[4] SEGGER Embedded Studio for RISC-V version 6.32b, emRun++, GNU Toolchain, RV32IMAC

[5] SiFive GNU Embedded Toolchain for RISC-V version 2020.12.8, libstdc++, RV32IMAC

[6] SEGGER Embedded Studio for RISC-V version 6.40, emRun++, GNU Toolchain, RV64IMAC

[7] SiFive GNU Embedded Toolchain for RISC-V version 2020.12.8, libstdc++, RV64IMAC