Go beyond C by applying modern C++ in embedded systems to enhance code readability, maintainability, and scalability
Key FeaturesBridge the gap between C and modern C++ for embedded systems through practical examplesLearn how to save memory and cut down on runtime computing using compile-time computation techniquesImprove your software design skills by applying patterns to solve common problems in embedded systems using C++Purchase of the print or Kindle book includes a free PDF eBookBook Description
Transitioning from C can be daunting, with concerns about performance overhead, added complexity, and unfamiliar tooling. Addressing these challenges, Amar Mahmutbegovic, an advocate for modern C++ in embedded development, shows you how to harness zero-cost abstractions, compile-time checks, and powerful modern C++ capabilities to preserve performance while achieving safer, cleaner code. This book bridges the gap between traditional C and advanced C++, helping you retain the efficiency C developers demand while unlocking the safety and expressiveness of modern C++. Starting with a modern development environment setup, including a Docker container for seamless example replication, you’ll overcome the hurdles of using the C++ standard library in memory-constrained settings and get acquainted with the Embedded Template Library (ETL) as an alternative. The book walks you through essential C++ concepts before exploring advanced topics such as templates, strong typing, error handling, compile-time computation, and RAII. Through practical examples, you’ll implement a sequencer, write a type-safe HAL, and apply patterns like Command, State, and Observer to solve common embedded development problems. By the end of this book, you’ll have learned how to apply modern C++ to develop robust, modular firmware with performance matching or exceeding hand-coded C solutions.
What you will learnDebunk myths and misconceptions about using C++ in embedded systemsSet up build automation tailored for C++ in constrained environmentsLeverage strong typing to improve type safetyApply modern C++ techniques, such as Resource Acquisition Is Initialization (RAII)Use Domain Specific Language (DSL) with a practical example using Boost SMLImplement software development best practices, including the SOLID principle, in embedded developmentWho this book is for
This book is for embedded developers who primarily use C and want to adopt a modern C++ approach. It introduces fundamental C++ concepts, making it suitable for beginners, while also assuming basic familiarity to fully leverage advanced features like compile-time computation. Even those with prior C++ experience will discover new ways to apply modern best practices to write more efficient and maintainable embedded applications.
Table of ContentsDebunking Common Myths about C++Challenges in Embedded Systems with Limited ResourcesEmbedded C++ EcosystemSetting Up the Development Environment for a C++ Embedded ProjectClasses – Building Blocks of C++ Applications Beyond Classes – Fundamental C++ ConceptsStrengthening Firmware – Practical C++ Error Handling Methods Building Generic and Reusable Code with Templates Improving Type-Safety with Strong Types Writing Expressive Code with LambdasCompile-Time Computation Writing C++ HALWorking with C LibrariesEnhancing Super-Loop with Sequencer Practical Patterns – Building a Temperature PublisherDesigning Scalable Finite State Machines Libraries and FrameworksCross-Platform Development
From the Publisher
Highlights of the book
Debunk Common Myths about C++
Many people still think it’s just “C with classes,” but that’s not the case – learn why. By adopting Modern C++, you gain powerful tools to write expressive and robust code.
Set up the development environment for the C++ Embedded Projects
Learn about the tools that make a C++ development environment. Go through the CMake script, compiler flags, and startup script. Then, build a project for an STM32 target and run it in the Renode simulator.
C++ basics
Refresh your C++ fundamentals, covering classes, namespaces, function overloading, and references, or learn them from scratch. Learn how name mangling works and explore interoperability with C.
Write expressive code with lambdas
Learn how to use lambdas to write concise and more readable code. Use lambdas in a Command pattern to defer the execution of defined behavior.
Generate lookup tables at compile-time
Use constexpr to execute functions at compile-time. Create a powerful signal generator, allowing you to generate complex signals at compile-time using expressive syntax.
Write flexible state machines
Learn how to apply State design pattern to write flexible state machines.
ASIN : B0F2MS788M
Publisher : Packt Publishing
Accessibility : Learn more
Publication date : July 2, 2025
Edition : 1st
Language : English
File size : 9.9 MB
Screen Reader : Supported
Enhanced typesetting : Enabled
X-Ray : Not Enabled
Word Wise : Not Enabled
Print length : 404 pages
ISBN-13 : 978-1835881156
Page Flip : Enabled
Best Sellers Rank: #244,318 in Kindle Store (See Top 100 in Kindle Store) #3 in Computer Hardware Design & Architecture #4 in Computer Hardware Embedded Systems #5 in C++ Programming Language
Customer Reviews: 4.7 4.7 out of 5 stars 30 ratings var dpAcrHasRegisteredArcLinkClickAction; P.when(‘A’, ‘ready’).execute(function(A) { if (dpAcrHasRegisteredArcLinkClickAction !== true) { dpAcrHasRegisteredArcLinkClickAction = true; A.declarative( ‘acrLink-click-metrics’, ‘click’, { “allowLinkDefault”: true }, function (event) { if (window.ue) { ue.count(“acrLinkClickCount”, (ue.count(“acrLinkClickCount”) || 0) + 1); } } ); } }); P.when(‘A’, ‘cf’).execute(function(A) { A.declarative(‘acrStarsLink-click-metrics’, ‘click’, { “allowLinkDefault” : true }, function(event){ if(window.ue) { ue.count(“acrStarsLinkWithPopoverClickCount”, (ue.count(“acrStarsLinkWithPopoverClickCount”) || 0) + 1); } }); });

