Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying C++ in Embedded Systems
  • Table Of Contents Toc
  • Feedback & Rating feedback
C++ in Embedded Systems

C++ in Embedded Systems

By : Amar Mahmutbegović
5 (4)
close
close
C++ in Embedded Systems

C++ in Embedded Systems

5 (4)
By: Amar Mahmutbegović

Overview of this book

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.
Table of Contents (25 chapters)
close
close
Preface
Lock Free Chapter
1
Part I: Introduction to C++ in Embedded Development
6
Part II: C++ Fundamentals
10
Part III: C++ Advanced Concepts
15
Part IV: Applying C++ to Solving Embedded Domain Problems
23
Other Books You May Enjoy
24
Index

Containerized development environment and Visual Studio Code

To start, install Visual Studio Code (https://code.visualstudio.com/). Once you’ve done this, go to Extensions and search for and install the following extensions:

  • C/C++
  • Cortex-Debug
  • CS 128 Clang-Tidy
  • Dev Containers

Once you’ve done this, open View| Command Palette (Ctrl + Shift + P), find Dev Containers: Attach to Running Container, and select dev_env. This should open a new Visual Studio Code window where the container’s name is in the bottom left bar:

Figure 4.4 – Visual Studio Code attached to a running container

Figure 4.4 – Visual Studio Code attached to a running container

Figure 4.4 shows that Visual Studio Code was successfully attached to the running container. Now, let’s open the project folder at /workspace/Cpp-in-Embedded-Systems/Chapter04/bare. Open main.cpp in the EXPLORER view and set a breakpoint on line 23, as shown in the following screenshot:

Figure 4.5 – Setting a breakpoint in Visual Studio Code

Figure 4.5 – Setting...

Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
C++ in Embedded Systems
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon