0%

Book Description

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.

Downloading the example code for this book You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Table of Contents

  1. Title Page
  2. Copyright and Credits
    1. Hands-On Embedded Programming with C++17
  3. About Packt
    1. Why subscribe?
    2. Packt.com
  4. Contributors
    1. About the author
    2. About the reviewers
    3. Packt is searching for authors like you
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Conventions used
    4. Get in touch
      1. Reviews
  6. Section 1: The Fundamentals - Embedded programming and the role of C++
  7. What Are Embedded Systems?
    1. The many faces of embedded systems
    2. Microcontrollers
      1. TMS 1000
      2. Intel MCS-48
      3. Intel MCS-51
      4. PIC
      5. AVR
      6. M68k and Z80-based
      7. ARM Cortex-M
      8. H8 (SuperH)
      9. ESP8266/ESP32
      10. Others
      11. Challenges
    3. System-on-Chip/Single Board Computer
      1. Challenges
    4. Summary
  8. C++ as an Embedded Language
    1. C++ relative to C
    2. C++ as an embedded language
    3. C++ language features
      1. Namespaces
      2. Strongly typed
      3. Type conversions
      4. Classes
      5. Inheritance
      6. Virtual base classes
      7. Function inlining
      8. Runtime type information
      9. Exception handling
      10. Templates
    4. The standard template library
    5. Maintainability
    6. Summary
  9. Developing for Embedded Linux and Similar Systems
    1. Embedded operating systems
    2. Real-time OSes
    3. Custom peripherals and drivers
      1. Adding an RTC
      2. Custom drivers
    4. Resource limitations
    5. Example – club room monitoring
      1. Hardware
        1. Relays
        2. Debounce
        3. Debounce HAT
        4. Power
      2. Implementation
        1. Listener
        2. Club
        3. HTTP request handler
        4. Status handler
        5. Data handler
      3. Service configuration
      4. Permissions
      5. Final results
    6. Example – basic media player
    7. Summary
  10. Resource-Restricted Embedded Systems
    1. The big picture for small systems
      1. Example – Machine controller for a laser cutter
      2. Functional specification
      3. The design requirements
      4. Implementation-related choices
    2. Embedded IDEs and frameworks
    3. Programming MCUs
      1. Memory programming and device debugging
      2. Boot loader
    4. Memory management
      1. Stack and heap
      2. Interrupts, ESP8266 IRAM_ATTR
    5. Concurrency
    6. AVR development with Nodate
      1. Enter Nodate
      2. Example – CMOS IC Tester
      3. Usage
    7. ESP8266 development with Sming
    8. ARM MCU development
    9. RTOS usage
    10. Summary
  11. Example - Soil Humidity Monitor with Wi-Fi
    1. Keeping plants happy
    2. Our solution
    3. The hardware
    4. The firmware
      1. Setting up Sming
      2. Plant module code
        1. Makefile-user.mk
        2. Main
        3. OtaCore
        4. BaseModule
        5. PlantModule
        6. Index.html
      3. Compiling and flashing
      4. First-time configuration
      5. Using the system
    5. Taking it further
    6. Complications
    7. Summary
  12. Section 2: Testing, Monitoring
  13. Testing OS-Based Applications
    1. Avoiding real hardware
    2. Cross-compiling for SBCs
    3. Integration test for club status service
      1. Mock versus hardware
    4. Testing with Valgrind
    5. Multi-target build system
    6. Remote testing on real hardware
    7. Summary
  14. Testing Resource-Restricted Platforms
    1. Reducing wear
    2. Planning out a design
    3. Platform-independent build systems
    4. Using cross-compilers
    5. Local and on-chip debugging
    6. Example – ESP8266 integration test
      1. The server
        1. Makefile
      2. The node
        1. Makefile
      3. Building the project
    7. Summary
  15. Example - Linux-Based Infotainment System
    1. One box that does everything
    2. Hardware needed
    3. Software requirements
    4. Bluetooth audio sources and sinks
    5. Online streaming
    6. Voice-driven user interface
    7. Usage scenarios
    8. Source code
    9. Building the project
    10. Extending the system
    11. Summary
  16. Example - Building Monitoring and Control
    1. Plants, rooms, and beyond
    2. Developmental history
    3. Functional modules
    4. Firmware source
      1. Core
      2. Modules
        1. CO2 module
        2. Jura
        3. JuraTerm
        4. Motion
        5. PWM
        6. I/O
        7. Switch
    5. Command and control server
    6. Administration tool
    7. Air-conditioning service
    8. InfluxDB for recording sensor readings
    9. Security aspects
    10. Future developments
    11. Summary
  17. Section 3: Integration with other tools and frameworks
  18. Developing Embedded Systems with Qt
    1. The power of the right framework
    2. Qt for command-line use
    3. GUI-based Qt applications
    4. Embedded Qt
    5. Custom GUIs with stylesheets
    6. QML
    7. 3D designer
    8. An example of adding a GUI to the infotainment system
      1. Main
      2. QmlInterface
      3. QML
    9. Summary
  19. Developing for Hybrid SoC/FPGA Systems
    1. Going extremely parallel
    2. Hardware description languages
    3. FPGA architecture
    4. Hybrid FPGA/SoC chips
    5. Example – basic oscilloscope
      1. The hardware
      2. The VHDL code
      3. The C++ code
    6. Building the project
    7. Summary
  20. Best Practices
    1. All the best-laid plans
    2. Working with the hardware
    3. The confusing world of peripherals
    4. Knowing your tools
    5. Choosing asynchronous methods
    6. Reading the datasheet
    7. Keeping interrupt handlers short
    8. 8-bit means 8 bits
    9. Don't reinvent the wheel
    10. Think before you optimize
    11. Requirements are not optional
    12. Documentation saves lives
    13. Testing code means trying to destroy it
    14. Summary
  21. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think
3.145.191.22