Embedded Template Library

We’ve been hard at work on our C++ embedded systems framework. A critical design requirement is that the framework core components do not utilize dynamic memory allocation. Unfortunately, this excludes most of the STL containers, as they get storage from the heap by default. Rather than reinventing the wheel, we spent some time searching for existing solutions to this problem. We were quite lucky to discover the Embedded Template Library, an open-source project created by John Wellbelove at Aster Consulting Ltd.

The Embedded Template Library (ETL) is complementary to the Standard Template Library (STL). The ETL provides fixed-size alternatives to STL container type. The ETL containers specify a maximum capacity at compile-time and make no calls to malloc/free/new/delete. As an added bonus, the containers are all cache friendly: storage for all container types is allocated in contiguous blocks.

Most of the ETL containers mimic, as best as possible, the existing STL containers. Additional container types are also provided, such as for memory pools.

We have been heavily using the following ETL modules while developing our framework:

The ETL goes further than just providing fixed-size STL container alternatives. The entire library does not use dynamic memory allocation. All storage is allocated either at compile time or on the stack. The library also uses no run-time type information (RTTI). The library provides configurable error handling by allowing the user to choose exceptions, assertions, error logging, or to completely disable error checking.

The library also provides a variety of additional algorithms, utilities, and other features that are useful to embedded systems developers, including:

The ETL is designed to work with C++03, since many projects and chipsets cannot support the newer standards. The ETL is an excellent way to gain access to some modern C++ features on C++03 projects.

The project is well-documented, with reference information available on the ETL Website. John also provides free email support for the ETL.

The ETL is released under the MIT License.

Further Reading

4 Replies to “Embedded Template Library”

  1. Thanks for the write-up.
    Now that many embedded compilers are starting to support at least C++11, I have started to add C++11 features to the library (i.e. true variadic ’emplace’ functions, support for rvalue references, constexpr etc) whilst still retaining C++03 compatibilty for those that need it.

Share Your Thoughts

This site uses Akismet to reduce spam. Learn how your comment data is processed.