This video features an interview with Amar Mahmutbegović, the author of the new book "C++ in Embedded Systems: A practical transition from C to modern C++". The discussion centers on the book's goal of helping C developers adopt modern C++ for embedded projects, addressing common concerns about complexity and performance.
The author explains the book's practical approach, which includes a Docker-based development environment and the Renode simulator, allowing readers to run code for the STM32F7 target without needing physical hardware. Key topics covered include the challenges of using the C++ standard library in constrained environments, with the author advocating for the Embedded Template Library (ETL) as a safer, non-allocating alternative. Mahmutbegović shares a surprising discovery he made while writing: the significant memory cost of exceptions in the specific nano-STL implementation used. The conversation also touches on the growing relevance of Rust in the embedded space and the practicalities of mixing it with C++.
Key Insights from the Interview on 'C++ in Embedded Systems'
0:42 Practical, Hardware-Free Setup: The book's code targets the STM32F7, but a physical development board is not required. A provided Docker container and Renode simulator allow readers to compile and run all examples.
2:03 Modern C++ Focus: The book covers modern C++ features up to the C++23 standard, aiming to bridge the gap for developers accustomed to C or older C++ versions.
3:23 Alternative to the Standard Library: The author highlights the challenges of using standard library containers in memory-constrained systems and introduces the Embedded Template Library (ETL) as a robust, non-allocating alternative.
5:48 Ensuring No Dynamic Allocation: To guarantee that no memory is allocated at runtime (e.g., when storing lambdas), the author suggests either overriding the new and delete operators for monitoring or, more practically, using libraries like ETL that are designed to avoid it.
8:09 The High Cost of Exceptions: A key takeaway from the author's writing process was discovering how memory-intensive exceptions were in the nano-standard library implementation he used, reinforcing why they are often avoided in embedded systems.
11:08 Multi-threading in Embedded: The author confirms that multi-threading is a common and important practice in complex embedded systems, often implemented using real-time operating systems (RTOS) like FreeRTOS.
12:25 The Growing Role of Rust: The author acknowledges the increasing adoption of Rust in the embedded world, particularly for safety-critical systems, due to its compile-time safety guarantees.
13:55 Interoperability with Rust: When asked about mixing Rust and C++, the author endorses a pragmatic "right tool for the right job" approach, seeing no issue with integrating modules from both languages if it solves a problem effectively.
16:18 A Biased but Strong Recommendation: The author concludes by stating his (admittedly biased) passion for C++ and his firm belief that it is an excellent and powerful tool for modern embedded systems development.