Introduction to
Embedded Systems
Tien Pham Van, Dr. rer. nat.
Hanoi University of Science and Technology
Compiled with reference to other presentations
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Outlines
• Concepts
• Applications
• Physical components
• System software
• Design/implementation
flow
• Software development
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Concept
• Embedded System is a special-
purpose computer system designed
to perform one or a few dedicated
functions - Wikipedia
• Embedded System market is super
competitive
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Embedded in the era of IoT
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Remarkable features
• Part of larger system
– not a “computer with keyboard, display, etc.”
• HW & SW application-specific – not G.P.
– application is known a-priori
– definition and development concurrent
• Interact (sense, manipulate, communicate)
with the external world
• Never terminate (ideally)
• Operation is time constrained: latency,
throughput
• Other constraints: power, size, weight, heat,
reliability
• Increasingly high-performance (DSP) &
networked
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Why are they thriving?
• Market demand: at home, at work, on road, shopping,
entertainment, etc
• Hardware maturity: high computing power, mass
production, fast-moving VLSI, [future] quantum computers
• Prevailing interconnected world – IoT
• Advances in related industries: robotics, digital
transformation, sensing, automotive, biomedical
engineering, etc
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Requirements
• Even though embedded systems cover a wide
range of special-purpose systems, there are
common characteristics
– Low cost
• Should be cheap to be competitive
– Memory is typically very small compared to a
general purpose computer system
– Lightweight processors are used in embedded
systems
– Low power
• Should consume low power especially in
case of portable devices
• Low-power processors are used in
embedded systems
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Requirements
– High performance
• Should meet the computing requirements
of applications
– Users want to watch video on portable
devices
» Audio should be in sync with video
– Gaming gadgets like playstation should
provide high performance
– Real-time property
• Job should be done within a time limit
– Aerospace applications, Car control
systems, Medical gadgets are critical in
terms of time constraint – Otherwise, it
could lead to catastrophe such as loss of life
• Will talk more about this
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
It’s hard…
• It is challenging to satisfy the
characteristics
– You may not be able to
achieve high performance
while utilizing cheap
components and maintaining
low power consumption
– So, you got to do your best in a
given circumstance to be
competitive in the market
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
HW/SW Stack of Embedded Systems
• Identical to the general computer systems
Application Software
OS / Device Drivers
Hardware
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Components of Embedded Systems
• Hardware
– It is mainly composed of processor (1 or more), memory,
I/O devices including network devices, timers, sensors etc.
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Hardware: system view
Embedded system is a special-purpose computing device designed to perform dedicated function
EMBEDDED
INPUT OUTPUT
SYSTEM
- Keyboard Button - LCD Display
- Steering wheel position - Servo Engine
SOFTWARE
- Microphone APPLICATION SOFTWARE
- EEG signals
SYSTEM SOFTWARE
MIDDLEWARE
DEVICE DRIVERS
Analog Environment
Digital Environment HARDWARE
EMBEDDED BOARD
OUTPUT DEVICES
MCU
INPUT DEVICES
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Typical layout
DEBUG
SUPPORT
USER
BUTTONS
USER LEDS
MP/MC
GLOBAL
PURPOSE IO
PINS
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Open courseware clip
• 2. Introduction to Embedded Systems -
Embedded System Development
Components | Coursera
https://www.coursera.org/lecture/introduction-
embedded-systems/2-introduction-to-embedded-
systems-5z2IZ
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Software
• Software - System software
– Operating systems
• Many times, a multitasking (multithreaded) OS is required, as
embedded applications become complicated
– Networking, GUI, Audio, Video
– CPU is context-switched to process multiple jobs
• Operating system footprint should be small enough to fit into
memory of an embedded system
– In the past and even now, real-time operating systems (RTOS) such as
VxWorks and uC/OS-II have been used because they are light-weighted in
terms of memory requirement
– Nowadays, heavy-weighted OSs such as iOS, Android, Windows Mobile,
and embedded Linux (uClinux) are used, as embedded processors
support computing power and advanced capabilities such as MMU
(Memory Management Unit)
– Device drivers for I/O devices
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Software
• Software (cont.) - Application software
– Run on top of operating system
– Execute tasks that users wish to perform
• Web surfing, Social Network Service, Audio, Video
playback
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Embedded System Design Flow
ASIC/FPGA/SoC design
Planning & Architect ASIC/SoC chip
(modeling & Hardware Design
simulation) with CAD tools
System prototype Hardware debugging &
board Software development Final product
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Embedded System Design Flow
Environ Modeling
-ment the system, and algorithms involved;
Refining (or “partitioning”)
the function into smaller, interacting pieces
Test Bench Design
Abstractions from the Design, Communication, Storage, and
Computation resources
HW-SW partitioning: Allocation
(1) HW
(2) SW
Determine power and performance bounds
Scheduling
When are functions executed
Resource Arbitration
Mapping (Implementing)
(1) software, (2) Hardware,
(3) Coherence/Communication
Testing/Validation
Insitu with Design
DSP
Code
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Still interesting ?
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Many Implementation Choices
• Microprocessors
• Domain-specific processors Speed Power Cost
– DSP
– Network processors
– Microcontrollers
• ASIPs (application-specific instruction set processors)
• Reconfigurable SoC
• FPGA
• ASIC
• Full-Custom (COTS)
High Low
Volume
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
ASIC Issues
• Good:
– High performance custom peripherals
– Multiple heterogenous Cores
– Integrated A/D, D/A, timers …
– Low Cost, High performance on-chip communication
– Low Part Cost in Volume
• Bad:
– Very expensive ($5-$75M/design)
– Very High Risk (Several total failure points)
– Potentially impossible to Program even if working!
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Hardware vs. Software Modules
• Hardware = functionality implemented in custom
architecture
• Software = functionality implemented stored program
• Key differences:
– Configurability, Adaptability
– Process Time Multiplexing
• software modules time multiplexed on a processor
• hardware modules often mapped to dedicated hardware
– Concurrency
• processors have serial “thread of control”
• dedicated hardware has concurrent activity
• Lecture 1.2: More on Embedded Systems - Embedded Systems | Coursera
https://www.coursera.org/lecture/iot/lecture-1-2-more-on-embedded-systems-RnvF2
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Hardware-Software Architecture
• A significant part of the system design problem
is deciding which parts are software, and
which are hardware
• Issues:
– Cost of development
– System performance
– Upgrade potential
– Sales/Implementation Volume
– Availability of IP
– Development Time-Line
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Map Behavior to Architecture
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
A more specific image
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Typical design flow
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Industrial process
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Software Development
Software Project Development Process Flow SOFTWARE
CREATE PROJECT APPLICATION SOFTWARE
Project working directory on host side is set SYSTEM SOFTWARE
SETUP PROJECT MIDDLEWARE
Project hardware platform, optimization levels, file
DEVICE DRIVERS
types … are set
CREATE STARTUP FILE
Assembly startup file is ready
EDIT/CREATE
SOURCE/ASSEMBLER FILES
Assembly and source files are ready
COMPILE AND LINK
Target Image file is ready
NO
BUILD SUCCESS?
YES
DOWNLOAD IMAGE TO
FLASH MEMORY
START DEBUGGING
PROGRAM WORKS NO
AS EXPECTED
YES
SOFTWARE IS DONE
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Software Development
„main“ source code development for our project example
Develop Software model Map model to the code
INIT HARDWARE • INIT HARDWARE - hardware initialization (clocks and peripherals
initialization)
READ BUTTON STATUS • READ BUTTON STATUS - read pin status from GPIOC_IDR register
NO and return correspondingresult
BUTTON PRESSED?
YES
CHANGE DIODE STATUS • CHANGE DIODE STATUS - toggle pin value in
GPIOA_ODR
i n t main(void)
{
Write code on host side
ButtonStatus ButtonStatus = typedef enum{
RELEASED; PRESSED,
InitHardware(); RELEASED
while ( 1 ) }ButtonStatus;
{ ButtonStatus ReadButtonStatus(){
ButtonStatus = if(HAL_GPIO_ReadPin(GPIOC,GPIO_PIN_13) == 0) return
ReadButtonStatus(); PRESSED;
if(ButtonStatus == PRESSED){ return RELEASED;
ChangeDiodeStatus(); }
} void ChangeDiodeStatus(){
} HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5);
} }
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Software Development
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Software Development
Build process
From user code (assembly and C code) create executable code
which will SOFTWARE
APPLICATION SOFTWARE
be loaded to the target memory SYSTEM SOFTWARE
Compiler MIDDLEWARE
DEVICE DRIVERS
• Translate programs written in some human-readable language
into the
equivalent set of opcodes for particular processor
• Cross-compiler
Code is written on a different platform and than compiled
for embedded platform
• Compilation result is object file which corresponds to the
dedicated
source file
Assembler
• “Compiler for assembly language files”
Linker
• Combine object files and locate them in memory
Result
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email:
[email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Typical Dev Environment
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Enterprise products
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Programming point of view
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Eclipse example
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Grandview classification
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Classification
• ES-Unit1-L4-classifications of embedded
systems – YouTube
https://www.youtube.com/watch?v=dd7uxDgF
-k0
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Real-time embedded system
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Hard- vs. Soft
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Static vs. Dynamic
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596
Real-time notion
• https://youtu.be/BxYwjdrdnQg?t=225
Embedded Networking Research Group School of Elec. and Telecom - Hanoi University of Science and Technology
Email: [email protected] C9-411, Dai Co Viet str. 1, HBT, Hanoi Tel: +84-243-8693596