Embedded Systems Architecture - Second Edition

Book description

Design safe and reliable software for embedded systems and explore the internals of device drivers, RTOS, and TEE

Key Features

  • Identify and overcome challenges in embedded environments
  • Understand and implement the steps required to increase the security of IoT solutions
  • Build safety-critical and memory-safe parallel and distributed embedded systems

Book Description

Embedded Systems Architecture begins with a bird’s-eye view of embedded development and how it differs from the other systems that you may be familiar with. This book will help you get the hang of the internal working of various components in real-world systems.

You’ll start by setting up a development environment and then move on to the core system architectural concepts, exploring system designs, boot-up mechanisms, and memory management. As you progress through the topics, you’ll explore the programming interface and device drivers to establish communication via TCP/IP and take measures to increase the security of IoT solutions. Finally, you’ll be introduced to multithreaded operating systems through the development of a scheduler and the use of hardware-assisted trusted execution mechanisms.

With the help of this book, you will gain the confidence to work with embedded systems at an architectural level and become familiar with various aspects of embedded software development on microcontrollers—such as memory management, multithreading, and RTOS—an approach oriented to memory isolation.

What you will learn

  • Participate in the design and definition phase of an embedded product
  • Get to grips with writing code for ARM Cortex-M microcontrollers
  • Build an embedded development lab and optimize the workflow
  • Secure embedded systems with TLS
  • Demystify the architecture behind the communication interfaces
  • Understand the design and development patterns for connected and distributed devices in the IoT
  • Master multitasking parallel execution patterns and real-time operating systems
  • Become familiar with Trusted Execution Environment (TEE)

Who this book is for

If you're a software developer or designer looking to learn about embedded programming, this is the book for you. You’ll also find this book useful if you’re a beginner or a less experienced embedded programmer on a quest to expand your knowledge on embedded systems.

Table of contents

  1. Embedded Systems Architecture
  2. Contributors
  3. About the author
  4. About the reviewer
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
    4. Download the example code files
    5. Download the color images
    6. Conventions used
    7. Get in touch
    8. Share your thoughts
    9. Download a free PDF copy of this book
  6. Part 1 – Introduction to Embedded Systems Development
  7. Chapter 1: Embedded Systems – A Pragmatic Approach
    1. Domain definition
      1. Embedded Linux systems
      2. Low-end 8-bit microcontrollers
      3. Hardware architecture
      4. Understanding the challenges
      5. Multithreading
    2. RAM
    3. Flash memory
    4. General-purpose input/output (GPIO)
      1. ADC and DAC
      2. Timers and PWM
    5. Interfaces and peripherals
      1. Asynchronous UART-based serial communication
      2. SPI
      3. I2C
      4. USB
    6. Connected systems
      1. Challenges of distributed systems
    7. Introduction to isolation mechanisms
    8. The reference platform
      1. ARM reference design
      2. The Cortex-M microprocessor
    9. Summary
  8. Chapter 2: Work Environment and Workflow Optimization
    1. Workflow overview
      1. The C compiler
      2. Linker
      3. Make: a build automation tool
      4. Debugger
      5. Embedded workflow
    2. Text editors versus integrated environments
    3. The GCC toolchain
      1. The cross compiler
      2. Compiling the compiler
      3. Linking the executable
      4. Binary format conversion
    4. Interacting with the target
      1. The GDB session
    5. Validation
      1. Functional tests
      2. Hardware tools
      3. Testing off-target
      4. Emulators
    6. Summary
  9. Part 2 – Core System Architecture
  10. Chapter 3: Architectural Patterns
    1. Configuration management
      1. Revision control
      2. Tracking activities
      3. Code reviews
      4. Continuous integration
    2. Source code organization
      1. Hardware abstraction
      2. Middleware
      3. Application code
    3. Security considerations
      1. Vulnerability management
      2. Software cryptography
      3. Hardware cryptography
      4. Running untrusted code
    4. The life cycle of an embedded project
      1. Defining project steps
      2. Prototyping
      3. Refactoring
      4. API and documentation
    5. Summary
  11. Chapter 4: The Boot-Up Procedure
    1. Technical requirements
    2. The interrupt vector table
      1. Startup code
      2. Reset handler
      3. Allocating the stack
      4. Fault handlers
    3. Memory layout
    4. Building and running the boot code
      1. The makefile
      2. Running the application
    5. Multiple boot stages
      1. Bootloader
      2. Building the image
      3. Debugging a multi-stage system
      4. Shared libraries
      5. Remote firmware updates
      6. Secure boot
    6. Summary
  12. Chapter 5: Memory Management
    1. Technical requirements
    2. Memory mapping
      1. Memory model and address space
      2. The code region
      3. The RAM regions
      4. Peripheral-access regions
      5. The system region
      6. Order of memory transactions
    3. The execution stack
      1. Stack placement
      2. Stack overflows
      3. Stack painting
    4. Heap management
      1. Custom implementation
      2. Using newlib
      3. Limiting the heap
      4. Multiple memory pools
      5. Common heap usage errors
    5. The memory protection unit
      1. MPU configuration registers
      2. Programming the MPU
    6. Summary
  13. Part 3 – Device Drivers and Communication Interfaces
  14. Chapter 6: General-Purpose Peripherals
    1. Technical requirements
      1. Bitwise operations
    2. The interrupt controller
      1. Peripherals’ interrupt configuration
    3. System time
      1. Adjusting the flash wait states
      2. Clock configuration
      3. Clock distribution
      4. Enabling the SysTick
    4. Generic timers
    5. GPIO
      1. Pin configuration
      2. Digital output
      3. PWM
      4. Digital input
      5. Interrupt-based input
      6. Analog input
    6. The watchdog
    7. Summary
  15. Chapter 7: Local Bus Interfaces
    1. Technical requirements
    2. Introducing serial communication
      1. Clock and symbol synchronization
      2. Bus wiring
      3. Programming the peripherals
    3. UART-based asynchronous serial bus
      1. Protocol description
      2. Programming the controller
      3. Hello world!
      4. newlib printf
      5. Receiving data
      6. Interrupt-based input/output
    4. SPI bus
      1. Protocol description
      2. Programming the transceiver
      3. SPI transactions
      4. Interrupt-based SPI transfers
    5. I2C bus
      1. Protocol description
      2. Clock stretching
      3. Multiple masters
      4. Programming the controller
      5. Interrupt handling
    6. Summary
  16. Chapter 8: Power Management and Energy Saving
    1. Technical requirements
    2. System configuration
      1. Hardware design
      2. Clock management
      3. Voltage control
    3. Low-power operating modes
      1. Deep-sleep configuration
      2. Stop mode
      3. Standby mode
      4. Wake-up intervals
    4. Measuring power
      1. Development boards
    5. Designing low-power embedded applications
      1. Replacing busy loops with sleep mode
      2. Deep sleep during longer inactivity periods
      3. Choosing the clock speed
      4. Power state transitions
    6. Summary
  17. Chapter 9: Distributed Systems and IoT Architecture
    1. Technical requirements
    2. Network interfaces
      1. MAC
      2. Selecting the appropriate network interfaces
    3. The Internet protocols
      1. Standard protocols, custom implementations
      2. The TCP/IP stack
      3. Network device drivers
      4. Running the TCP/IP stack
      5. Socket communication
      6. Connectionless protocols
      7. Mesh networks and dynamic routing
    4. TLS
      1. Securing socket communication
    5. Application protocols
      1. Message protocols
      2. The REST architectural pattern
      3. Distributed systems – single points of failure
    6. Summary
  18. Part 4 – Multithreading
  19. Chapter 10: Parallel Tasks and Scheduling
    1. Technical requirements
    2. Task management
      1. The task block
      2. Context switch
      3. Creating tasks
    3. Scheduler implementation
      1. Supervisor calls
      2. Cooperative scheduler
      3. Concurrency and timeslices
      4. Blocking tasks
      5. Waiting for resources
      6. Real-time scheduling
    4. Synchronization
      1. Semaphores
      2. Mutexes
      3. Priority inversion
    5. System resource separation
      1. Privilege levels
      2. Memory segmentation
      3. System calls
    6. Embedded operating systems
      1. OS selection
      2. FreeRTOS
      3. RIOT OS
    7. Summary
  20. Chapter 11: Trusted Execution Environment
    1. Technical requirements
    2. Sandboxing
    3. TrustZone-M
      1. Reference platform
      2. Secure and non-secure execution domains
    4. System resources separation
      1. Security attributes and memory regions
      2. Flash memory and secure watermarks
      3. GTZC configuration and block-based SRAM protection
      4. Configuring secure access to peripherals
    5. Building and running the example
      1. Enabling TrustZone-M
      2. Secure application entry point
      3. Compiling and linking secure-world applications
      4. Compiling and linking non-secure applications
      5. Inter-domain transitions
    6. Summary
  21. Index
    1. Why subscribe?
  22. Other Books You May Enjoy
    1. Packt is searching for authors like you
    2. Share your thoughts
    3. Download a free PDF copy of this book

Product information

  • Title: Embedded Systems Architecture - Second Edition
  • Author(s): Daniele Lacamera
  • Release date: January 2023
  • Publisher(s): Packt Publishing
  • ISBN: 9781803239545