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
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:
- 8, 16, 32 & 64 bit CRC, checksums & hash functions
- Software Timers
- Finite State Machines and State Charts
- Observer Pattern templated class & Message Bus
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.
- Introducing The Embedded Template Library
- Embedded Template Library Website
- ETL on GitHub
- Aster Consulting Ltd
- Fixed links for ETL modules