Build safety-critical and memory-safe stand-alone and networked embedded systemsKey Features Know how C++ works and compares to other languages used for embedded development Create advanced GUIs for embedded devices to design an attractive and functional UI Integrate proven strategies into your desi
Hands-On Embedded Programming with C++17: Create versatile and robust embedded solutions for MCUs and RTOSes with modern C++
β Scribed by Maya Posch
- Publisher
- Packt Publishing
- Year
- 2019
- Tongue
- English
- Leaves
- 442
- Edition
- 1
- Category
- Library
No coin nor oath required. For personal study only.
β¦ Synopsis
Build safety-critical and memory-safe stand-alone and networked embedded systems
Key Features
- Know how C++ works and compares to other languages used for embedded development
- Create advanced GUIs for embedded devices to design an attractive and functional UI
- Integrate proven strategies into your design for optimum hardware performance
Book Description
C++ is a great choice for embedded development, most notably, because it does not add any bloat, extends maintainability, and offers many advantages over different programming languages. Hands-On Embedded Programming with C++17 will show you how C++ can be used to build robust and concurrent systems that leverage the available hardware resources.
Starting with a primer on embedded programming and the latest features of C++17, the book takes you through various facets of good programming. You'll learn how to use the concurrency, memory management, and functional programming features of C++ to build embedded systems. You will understand how to integrate your systems with external peripherals and efficient ways of working with drivers. This book will also guide you in testing and optimizing code for better performance and implementing useful design patterns. As an additional benefit, you will see how to work with Qt, the popular GUI library used for building embedded systems.
By the end of the book, you will have gained the confidence to use C++ for embedded programming.
What you will learn
- Choose the correct type of embedded platform to use for a project
- Develop drivers for OS-based embedded systems
- Use concurrency and memory management with various microcontroller units (MCUs)
- Debug and test cross-platform code with Linux
- Implement an infotainment system using a Linux-based single board computer
- Extend an existing embedded system with a Qt-based GUI
- Communicate with the FPGA side of a hybrid FPGA/SoC system
Who this book is for
If you want to start developing effective embedded programs in C++, then this book is for you. Good knowledge of C++ language constructs is required to understand the topics covered in the book. No knowledge of embedded systems is assumed.
Table of Contents
- What are embedded systems?
- C++ as an embedded language
- Developing for embedded Linux and similar systems
- Resource-restricted embedded systems
- Example: Soil humidity monitor with WiFi
- Testing OS-based Applications
- Testing Resource-restricted Platforms
- Example: Linux-based infotainment system
- Example: Building monitoring and control
- Developing Embedded Systems with Qt
- Developing for Hybrid SoC/FPGA Systems
- Best Practices
β¦ Table of Contents
Cover
Title Page
Copyright and Credits
About Packt
Contributors
Table of Contents
Preface
Section 1: The Fundamentals - Embedded programming and the role of C++
Chapter 1: What Are Embedded Systems?
The many faces of embedded systems
Microcontrollers
TMS 1000
Intel MCS-48
Intel MCS-51
PIC
AVR
M68k and Z80-based
ARM Cortex-M
H8 (SuperH)
ESP8266/ESP32
Others
Challenges
System-on-Chip/Single Board Computer
Challenges
Summary
Chapter 2: C++ as an Embedded Language
C++ relative to C
C++ as an embedded language
C++ language features
Namespaces
Strongly typed
Type conversions
Classes
Inheritance
Virtual base classes
Function inlining
Runtime type information
Exception handling
Templates
The standard template library
Maintainability
Summary
Chapter 3: Developing for Embedded Linux and Similar Systems
Embedded operating systems
Real-time OSes
Custom peripherals and drivers
Adding an RTC
Custom drivers
Resource limitations
Example β club room monitoring
Hardware
Relays
Debounce
Debounce HAT
Power
Implementation
Listener
Club
HTTP request handler
Status handler
Data handler
Service configuration
Permissions
Final results
Example β basic media player
Summary
Chapter 4: Resource-Restricted Embedded Systems
The big picture for small systems
Example β Machine controller for a laser cutter
Functional specification
The design requirements
Implementation-related choices
Embedded IDEs and frameworks
Programming MCUs
Memory programming and device debugging
Boot loader
Memory management
Stack and heap
Interrupts, ESP8266 IRAM_ATTR
Concurrency
AVR development with Nodate
Enter Nodate
ExampleΒ β CMOS IC Tester
Usage
ESP8266 development with Sming
ARM MCU development
RTOS usage
Summary
Chapter 5: Example - Soil Humidity Monitor with Wi-Fi
Keeping plants happy
Our solution
The hardware
The firmware
Setting up Sming
Plant module code
Makefile-user.mk
Main
OtaCore
BaseModule
PlantModule
Index.html
Compiling and flashing
First-time configuration
Using the system
Taking it further
Complications
Summary
Section 2: Testing, Monitoring
Chapter 6: Testing OS-Based Applications
Avoiding real hardware
Cross-compiling for SBCs
Integration test for club status service
Mock versus hardware
Testing with Valgrind
Multi-target build system
Remote testing on real hardware
Summary
Chapter 7: Testing Resource-Restricted Platforms
Reducing wear
Planning out a design
Platform-independent build systems
Using cross-compilers
Local and on-chip debugging
ExampleΒ β ESP8266 integration test
The server
Makefile
The node
Makefile
Building the project
Summary
Chapter 8: Example - Linux-Based Infotainment System
One box that does everything
Hardware needed
Software requirements
Bluetooth audio sources and sinks
Online streaming
Voice-driven user interface
Usage scenarios
Source code
Building the project
Extending the system
Summary
Chapter 9: Example - Building Monitoring and Control
Plants, rooms, and beyond
Developmental history
Functional modules
Firmware source
Core
Modules
CO2 module
Jura
JuraTerm
Motion
PWM
I/O
Switch
Command and control server
Administration tool
Air-conditioning service
InfluxDB for recording sensor readings
Security aspects
Future developments
Summary
Section 3: Integration with other tools and frameworks
Chapter 10: Developing Embedded Systems with Qt
The power of the right framework
Qt for command-line use
GUI-based Qt applications
Embedded Qt
Custom GUIs with stylesheets
QML
3D designer
An example of adding a GUI to the infotainment system
Main
QmlInterface
QML
Summary
Chapter 11: Developing for Hybrid SoC/FPGA Systems
Going extremely parallel
Hardware description languages
FPGA architecture
Hybrid FPGA/SoC chips
ExampleΒ β basic oscilloscope
The hardware
The VHDL code
The C++ code
Building the project
Summary
Appendix: Best Practices
All the best-laid plans
Working with the hardware
The confusing world of peripherals
Knowing your tools
Choosing asynchronous methods
Reading the datasheet
Keeping interrupt handlers short
8-bit means 8 bits
Don't reinvent the wheel
Think before you optimize
Requirements are not optional
Documentation saves lives
Testing code means trying to destroy it
Summary
Other Books You May Enjoy
Index
β¦ Subjects
Embedded Programming; C++; C++17; MCU; RTO;
π SIMILAR VOLUMES
Code <p><b>Build safety-critical and memory-safe stand-alone and networked embedded systems</b></p> <h4>Key Features</h4> <ul><li>Know how C++ works and compares to other languages used for embedded development </li> <li>Create advanced GUIs for embedded devices to design an attractive and function
<p><b>A comprehensive guide that will get you up and running with embedded software development using Qt5</b></p> <h4>Key Features</h4> <ul><li>Learn to create fluid, cross-platform applications for embedded devices </li> <li>Achieve optimum performance in your applications with QT Lite project </li
Mastering Embedded Linux Programming takes you through the product cycle and gives you an in-depth description of the components and options that are available at each stage. You will begin by learning about toolchains, bootloaders, the Linux kernel, and how to configure a root filesystem to create
<p><b>Explore various constraints and challenges that embedded developers encounter in their daily tasks and learn how to build effective programs using the latest standards of C++ </b></p> <h4>Key Features</h4> <ul><li>Get hands-on experience in developing a sample application for an embedded Linux
Code. <p><b>Explore various constraints and challenges that embedded developers encounter in their daily tasks and learn how to build effective programs using the latest standards of C++ </b></p> <h4>Key Features</h4> <ul><li>Get hands-on experience in developing a sample application for an embedded