- ホーム
- > 洋書
- > 英文書
- > Computer / General
Full Description
Go beyond ad-hoc Makefiles and vendor IDE workflows by moving to a reproducible CMake-based firmware build system with automated testing and reliable outputs, from the author of bestselling C++ in Embedded Systems
Free with your book: DRM-free PDF version + access to Packt's next-gen Reader*
Key Features
Pin toolchains and external dependencies for reproducible firmware builds across machines and CI
Automate complex firmware workflows including code generation and multi-target builds
Add unit and integration testing to your firmware build workflow
Book DescriptionModern firmware builds rarely stop at "compile and flash." You are juggling multiple boards, cross toolchains, code generation, third-party libraries, and tests, often held together with ad-hoc scripts and vendor IDE projects. In Building Firmware with CMake, you will learn how to make your firmware builds repeatable, ensuring the same inputs produce the same binaries on different machines.
This book takes a practical, firmware-first approach. You will set up pinned toolchains, lock external dependencies, and structure projects for multi-target builds. You will automate the steps that make embedded projects complex, including code generation and configuration variants. You will also add unit tests on the host and integration tests using simulators, so regressions are caught early and build results are trustworthy.
Written by an embedded C++ engineer and author who builds and ships firmware for real products, this book focuses on patterns you can apply immediately to your own MCU projects. By the end, you will be able to build and test firmware in a consistent, maintainable way across targets and environments.
*Email sign-up and proof of purchase requiredWhat you will learn
Set up a reproducible firmware build environment
Write and understand core CMake build logic
Cross-compile bare-metal firmware for STM32
Run firmware in Renode simulator
Package reusable components and manage dependencies
Integrate code generation into the build
Build an automated test workflow with CTest
Scale the project across multiple MCU targets
Who this book is forThis book is for embedded firmware engineers building C/C++ on microcontrollers who want to replace ad-hoc Makefiles and vendor IDE projects with modern, reproducible CMake workflows. If you juggle cross-compiling, multiple boards/targets, third-party dependencies, and tests, you'll learn how to structure and automate builds that are portable across machines and CI. Recommended: hands-on MCU firmware experience and comfort with the command line and toolchains.
Contents
Table of Contents
A First Build with CMake in Docker
Build and run Hello World on STM32 target in Renode simulator
Your first CMake library
Working with third-party CMake enabled projects (nanopb)
Host-to-Firmware Data Contract with Protocol Buffers
Running End-to-End Firmware Tests in Renode with CppUTest and CTest
CMake Presets for Host and Target Builds
Pinned Toolchains and Reproducible Builds
Building Firmware for Multiple MCUs
Wrap-up: Project Structure and Workflows



