9/7/22
Introduction to
Embedded Systems
Syllabus
This module will cover the following aspects
• An overview of embedded systems
• Examples of embedded systems
• Features of embedded systems
• Software for embedded systems
• Embedded systems programming and debugging
2 © 2020 Arm Limited
1
9/7/22
Embedded systems
Internet of Things (IoT)
• Application-specific computer system Environment
• Built into a larger system
• Often with real-time computing constraints
Embedded system
Adding embedded systems to larger systems
Software
• Better performance
• More functions and features Input Hardware Output
• Lower cost, for e.g., through automation
• More dependability
Examples: smartphones, smart watches, User interface Other systems
printers, gaming consoles, wireless routers
3 © 2020 Arm Limited
CPUs → MCUs → Embedded Systems
Microprocessor or Central Processing unit (CPU)
Memory interface
Defined typically as a single processor
To memory
Instruction fetcher core that supports at least instruction
blocks
fetching, decoding, and executing
Instruction decoder
Register banks Used for general purpose computing,
but needs to be supported with memory
and Input/Output (I/O) interfaces
ALU
Microprocessor
4 © 2020 Arm Limited
2
9/7/22
CPUs → MCUs → Embedded Systems
Microcontroller Unit (MCU)
Microprocessor Program memory Data memory
System Bus
Digital I/O Analog I/O Timers Other peripherals
MCU
Typically has a single processor core
Has memory blocks, digital I/Os, analog I/Os, and other basic peripherals
Used for basic control purposes, such as embedded applications
5 © 2020 Arm Limited
CPUs → MCUs → Embedded Systems
Embedded system
Typically implemented using MCUs
Often integrated into a larger mechanical or electrical system
Usually has real-time constraints
Embedded
system
6 © 2020 Arm Limited
3
9/7/22
Embedded system example: Bike computer
Inputs:
Wheel rotation
• Functions Mode key
• Speed, cadence, distance, heart rate (HR) measurements
• Constraints
• Size, weight, and cost; power and energy
• Inputs
• Wheel rotation sensor and mode key
• Output
• Liquid crystal display (LCD), BLE interface to smartphone
• Uses low performance microcontroller Outputs:
Display/transmit
speed, HR, etc.
7 © 2020 Arm Limited
Embedded system example: Gasoline engine control unit
• Functions • Many inputs and outputs
• Fuel injection • Discrete sensors and actuators
• Air intake setting • Network interface to rest of the car
• Spark timing
• Exhaust gas circulation • Uses high performance microcontroller
• Electronic throttle control • E.g., 32-bit, 3MB flash memory, 150–300MHz
• Knock control
• Constraints
• Reliability in a harsh environment
• Cost
• Weight
8 © 2020 Arm Limited
4
9/7/22
Options for building embedded systems
Implementation Design Unit Upgrades Size Weight Power System
Cost Cost & Bug Speed
Fixes
Discrete Logic low medium difficult large high ? very fast
ASIC high very low difficult very small very low low extremely fast
Dedicated
Hardware
($500K/
mask set)
Programmable logic: low to medium easy small low medium to very fast
FPGA, PLD medium high
Software Running on
Microprocessor + low to medium easy small to low to medium moderate
Generic Hardware
memory + peripherals medium medium medium
MCU (int. memory & low low to easy small low medium slow to
peripherals) medium moderate
Embedded PC low high easy medium medium to medium to fast
high high
9 © 2020 Arm Limited
Benefits of embedded systems
Greater performance Lower cost More features Better
and efficiency dependability
More sophisticated Cheaper components Many not possible or Adaptive systems that can
control through software Reduced manufacturing costs impractical using other compensate for failures
Reduced operating and approaches Better diagnostics to
maintenance costs improve repair time
10 © 2020 Arm Limited
10
5
9/7/22
Functions of embedded systems
Closed-loop control system
Monitor a process, adjust an output to maintain the desired set point of operation
(temperature, speed, direction, etc.)
Sequencing
Step through different stages based on environment and system conditions
Signal processing
Remove noise, select desired signal features
Communications and networking
Exchange information reliably and quickly
11 © 2020 Arm Limited
11
Attributes of embedded systems
Interfacing with larger systems/ Concurrent, reactive behaviors
environment
• Analog signals for reading sensors • Must respond to sequences and combinations of
• Use voltage to represent a physical value events
• Power electronics for driving motors and • Real-time systems have deadlines on responses
solenoids • Typically must perform multiple separate
• Digital interfaces for communicating with other activities concurrently
digital devices
• Simple: switches
• Complex: displays
12 © 2020 Arm Limited
12
6
9/7/22
Attributes of embedded systems
Fault handling Diagnostics
• Many systems must operate independently for
long periods of time that requires them to • Help systems developer and service personnel
handle likely faults without crashing determine problems quickly
• Often, the fault-handling code is larger and
more complex than the normal-case code
13 © 2020 Arm Limited
13
Constraints specific to embedded devices
Cost Size and weight Power and energy Environment
limits limits
Competitive markets penalize Mobile (aviation, Temperatures may range
products that do not deliver automotive) and portable Battery capacity, from -40 degrees C to 125
adequate value for money (e.g., handheld, wearable) cooling limits degrees C, or even more.
systems
14 © 2020 Arm Limited
14
7
9/7/22
The impact of constraints
MCUs used (rather than Programming language Operating system (OS)
microprocessors)
• Include peripherals to • Programmed in C rather than • Typically no OS, but instead
interface with other devices in Java that results in smaller simple scheduler, or even just
and respond efficiently and faster code, so less interrupts + main code
• On-chip RAM and ROM expensive MCU (foreground/background
reduce circuit board • Some performance-critical system)
complexity and cost code may be in Assembly • If OS used, likely to be a lean
(a lower-level language) real-time one (RTOS).
15 © 2020 Arm Limited
15
Embedded software
Software incorporated into/aiming to control machines or devices
• Usually specialized for a specific hardware platform
• Simple, limited memory requirements
• Often does not require OS support → firmware
• Subject to timing constraints
• Many control functions not tied to human interaction
16 © 2020 Arm Limited
16
8
9/7/22
Embedded software constraints
Lack of abstraction Responsiveness Concurrency
developer directly system needs to multiple physical
exposed to react to external events happening at
underlying triggers in a timely the same time must
hardware manner be handled
Efficiency Reliability
given energy & timing code errors can have
budgets, optimization catastrophic events
is required in practice
17 © 2020 Arm Limited
17
Embedded systems programming and debugging
Different option to upload/debug code on a microcontroller
• A range of interfaces are used to program embedded systems,
including Joint Test Action Group (JTAG), Serial Wire Debug
(SWD), Single Wire Interface Module (SWIM), etc.
• Programming consists of writing program code to non-volatile
memory (e.g., Electrically Erasable Programmable Read-Only
Memory (EEPROM)) and configuring the system via fuses.
• Configuration bits (fuses) control key behavior of embedded
hardware, e.g., clock rate, power-up timer, etc.
18 © 2020 Arm Limited
18
9
9/7/22
Embedded software debugging
Much more complicated than debugging regular software and involves some hardware interface
Challenging to debug code involving interactions with peripherals
Debug pins could be made available for programming and testing during manufacturing
Sometime convenient to implement a command-line interface (CLI) that can enable real-time
inspection of registers and memory contents
Integrated Development Environments (IDEs) frequently used to simplify debugging
19 © 2020 Arm Limited
19
Over-the-air programming
Sometimes possible for embedded devices equipped with a wireless interface
• Over-the-air (OTA) programming is particularly useful for
firmware updating after product release.
• A risk of rendering the device unusable exists, if programming is
interrupted or inappropriate software is uploaded → some
recovery mechanism should be implemented if OTA is desired.
• Ideally, a separate chip would handle OTA programming, but this
increases the footprint and cost of the device.
• More often, memory is reserved for a bootloader that handles
the OTA programming and, in case of update failure, this can
revert the application to the previous version.
20 © 2020 Arm Limited
20
10
9/7/22
Coming next
Module Contents
Hardware Platforms for IoT • What is a hardware platform
• Types of memory
• Power saving techniques
• Types of sensors
The Arm Cortex-M4 • Processors vs. architectures
Processor Architecture • Cortex-M4 features
• Cortex-M4 registers
Interrupts and Low Power • What are interrupts
Features • Exception handlers
• Timing analysis
• Program design with interrupts
21 © 2020 Arm Limited
21
11