e McGraw Hill Companies
“Embedded
Systems
Architecture, Programming and Design
Second Edition
Raj KamalIN
|
Tata McGraw-Hill
Pubtished by the Tata McGraw-Hill Publishing Company Limited,
7 West Patel Nagar, New Delhi 110008,
Copyright © 2008 by Tata McGraw-Hill Publishing Company Limited.
First reprint 2008
RQOXLCRYXRBXBQ
No part of this publication may be reproduced or distributed in any form ot by any means, electronic, mechanical,
photocopying. recording, or otherwise or stored in a database or retrieval system without the prior written permission of
the publishers. The program listing (if any) may be entered, stored and executed in a computer system, but they may not
be reproduced for publication.
This edition can be exported from India only by the publishers,
Tua McGraw-Hill Publishing Company Limited.
ISBN 13: 978-0-07-066764-8
ISBN 10; 0-07-066764-0
Managing Director: Ajay Shukla
General Manager: Publishing—SEM & Tech Ed: Vibha Mahajan
Sponsoring Editor: Shalini sha
Jr: Sponsoring Editor: Nilanjan Chakravarty
Executive—Editorial Services: Sohini Mukherjee
Production Executive: Sunecta $ Bohra
General Manager: Marketing—Higher Education & School: Michael J Cruz
Product Manager: SEM & Tech Ed: Biju Ganesan
Controtler—Production: Rajender P Ghansela
Asst. General Manager—Production: B L Dogra
Information contained in this work has been obtained by Tata McGraw-Hill, from sources believed to be reliable.
However, neither Tata McGraw-Hill nor its authors guarantee the accuracy or completeness of any information
published herein, and neither Tata McGraw-Hill nor its authors shall be responsible for any errors, omissions, or
damages arising out of use of this information. This work is published with the understanding that Tata McGraw-Hill
and its authors are supplying information but are not attempting to render engineering or other professional services.
If such services are requited, the assistance of an appropriate professional should be sought,
Published by the Tata McGraw-Hill Publishing Company Limited, 7 West Patel Nagar, New Delhi 110 008, typeset at
Bukprint India, B-180A, Guru Nanak Pura, Laxmi Nagar-110 092 and printed at SDR Printers, A-28, West Jyoti Nagar,
Loni Road, Shahdara, Delhi 110.094
Cover: SDR Printers
MeGrow HillContents
Preface to the Second Edition vil
Preface to the First Edition ix
1. Introduction to Embedded Systems 1
LI Embedded Systems 3
12 Processor Embedded into a System _5
13, Embedded Hardware Units and Devices in a System _/0
1.4 Embedded Software in a System 19
15 Examples of Embedded Systems 27
1.6 Embedded System-on-chip (Soc) and Use of VLSI Circuit Design Technology 29
1.7 Complex Systems Design and Processors 32
18 Design Process in Embedded System 37
19 Formalization of System Design _42
1.10 Design Process and Design Examples 43
LI Classification of Embedded Systems _52
1.12. Skills Required for an Embedded System Designer 53
2. 8051 and Advanced Processor Architectures, Memory Organization and
Real-world Interfacing a
2.2 Real World Interfacing 72
24 Processor and Memory Organization _ 96
2.7 Memory Types, Memory-Maps and Addresses 106
2.9 Memory Selection 1/8
it © Talia Beem xiBaliinst "
3.110 Types and Examples 130
32 Sa ire
3.3_ Parallel Device Ports _/43.
3.4 Sophisticated Interfacing Features in Device Pons _/50
3.5_Wireless Devices 151
3.6 ‘Timer and Counting Devices _/52
3.7 Watchdog Timer 157
3.8 Real Time Clock 158
3.9 Networked Embedded Systems 159
‘Network Using ISA, PCI, PCI-X and Advanced Buses 166
3.12 Internet Enabled Systems Network Protocols 170
3.13 Wireless and Mobile System Protocols 175
4. Device Drivers and Interrupts Service Mechanism 187
4 ymed-VO Busy-wait Aj without Interrupt Service Mechanism _/894.2. ISR Concept _192
4.3 Interrupt Sources 200
4.4 Interrupt Servicing (Handling) Mechanism _203
4.5 Multiple Interrupts _209
4.6 Context and the Periods for Context Switching, Interrupt Latency and Deadline 2/1
4.7 Classification of Processors Interrupt Service Mechanism from
‘Context-Saving Angle 2/7
48 Direct Memory Access 278
4.9 Device Driver Programming 220
5, Programming Concepts and Embedded Programming in C, C++ and Java 234
5.1 Software Programming in Assembh (ALP) and in High-Level
Language ‘C"_235,
5.2_C Program Elements: Header and Source Files and sessor Directives 237
5.3, Program Elements: Macros and Functions 239 :
5.4 Program Elements: Data Types, Data Structures, Modifiers, Statements,
‘Loops and Pointers 241
5.5 Object-Oriented Programming 262
5.6 Embedded Programming in C++ 263
5.7 Embedded Programming in Java 264
6. Program Modeling Concepts 213
6.1 Program Models _ 274
6.2_DFG Models 277
6.3 State Machine Programming Models for Event-controlled Program Flow _282
6.4 Modeling of Multiprocessor Systems _ 288
6.5 UML Modelling 295
1._Interprocess Communication and Synchronization of Processes, Threads and Tasks 303
7.1 Multiple Processes in an Application _305
7.2 Multiple Threads in an Application 306
TS Tasks 108
14 Task States 208
15 Task and Data 3/0
7.6 Clear-cut Distinction between Functions, ISRS and Tasks by their Characteristics 31]
7.7 Concept of Semaphores 3/4
18 Shared Data 226
7.9 Interprocess Communication _330
710” Signal Function 332
7.11 Semaphore Functions 334
7.12_Message Queue Functions 335
113 Mailbox Functions 337
14 Pipe Functions 339
7.15 Socket Functions 34]
L16_RPC Functions 245
8._Real-Time Operating Systems 350
B.L_OS Services 351
8.2 Process Management 355
83 Timer Eunctions 156
8.4 Event Functions 358
8.5 Memory Management 359Contents
8.6 Device, File and 10 Subsystems Management _36/
8.7 Interrupt Routines in RTOS Environment and Handling of Interrupt Source Calls _ 365
8.8 Real-time Operating Systems 370
8.9. Basic Design Using an RTOS 372
8.10 Rios Task Scheduling Models, Interupt Latency and Response of the Tasks as
Performance Metrics 285
8.11_OS Security Issues _40/
9. Real-time Operating System Programming-I: Microc/OS-II and VxWorks
(=)
9.1 Basic Functions and Types of RTOSES 408
9.2 RTOS mCOS-IT 4/0
9.3 RTOS VxWorks 453
10. Real-time Operating System Programming-ii: Windows CE, OSEK and Real-time
Linux Functions
10.1 Windows CE 478
10.2 OSEK 494
10.3_Linux 2.6.x and RTLimix 496
11. Design Examples and Case Studies of Program Modeling and Programming
with RTOS.1
11.1 Case Study of Embedded System Design and Coding for an Automatic 512
‘Chocolate Vending Machine (ACVM) Using Mucos RTOS
11.2 Case Study of Digital Camera Hardware and Sofware Architecture _53/
11.3 Case Study of Coding for Sending Application Layer Byte Streams on a
TTCPAP Network Using RTOS Vxworks 537
12. Design Examples and Case Studies of Program Modeling and Programming with
RTOS-2
12.1 Case Study of Communication Between Orchestra Robots _567
12.2 Embedded Systems in Automobile _574
12.3 Case Study of an Embedded System for an Adaptive Cruise Control (ACC)
System ina Car _577
12.4. Case Study of an Embedded System for a Smart Card 593
12.5 Case Study of a Mobile Phone Software for Key Inputs 604
13._Embedded Software Development Process and Tools
sit
618,
13.1 Introduction to Embedded Software Development Process and Tools 620
13.2 Host and Target Machines 623
13.3 Linking and Locating Software 626
13.4. Getting Embedded Software into the Target System 630
13.5_Issues in Hardware—Software Design and Co-design 634
14. Testing, Simulation and Debugging Techniques and Toots
14.1 Testing on Host Machine 649
142 Simulators _650
143 Laboratory Tools 653
Appendix 1: Roadmap for Various Course Studies
Appendix 2: Select Bibliography
Index
BlasIntroduction to Embedded Systems (3 |
“a EMBEDDED SYSTEMS
1.1.1 System
A system is a way of working, organizing or doing one or many tasks according to a fixed plan, program, or
set of rules. A system is also an arrangement in which all its units assemble and work together according to the
plan or program.
Consider a watch. It is a time-display system. Its parts are its hardware, needles and battery with the
beautiful dial, chassis and strap. These parts organize to show the real time every second and continuously
update the time every second. The system-program updates the display using three needles after each second.
Itfollows a set of rules. Some of these rules are as follows: (i) All needles move only clockwise. (ii) A thin and
long needle rotates every second such that it returns to same position after a minute. (iii) A long needle rotates
every minute such that it returns to same position after an hour. (iv) A short needle rotates every hour such that
it returns to same position after twelve hours. (v) All three needles return to the same inclination after twelve
hours each day.
Consider a washing machine. It is an automatic clothes-washing system. The important hardware parts
include its status display panel, the switches and dials for user-defined programming, a motor to rotate or
spin, its power supply and control unit, an inner water-level sensor, a solenoid valve for letting water in and
another valve for letting water drain out. These parts organize to wash clothes automatically according to a
program preset by a user. The system-program is activated to wash the dirty clothes placed in a tank, which
rotates or spins in preprogrammed steps and stages. It jollows a set of rules. Some of these rules are as
follows: (i) Follow the steps strictly in the following sequence. Step I: Wash by spinning the motor according.
to a programmed period. Step II: Rinse in fresh water after draining out the dirty water, and rinse a second
time if the system is not programmed in water-saving mode. Step III: After draining out the water completely,
spin the motor fast for a programmed period for drying by centrifuging out water from the clothes. Step IV:
Show the wash-over status by a blinking display. Sound the alarm for a minute to signal that the wash cycle is
complete. (ii) At each step, display the process stage of the system. (iii) In case of an interruption, execute
only the remaining part of the program, starting from the position when the process was interrupted. There
can be no repetition from Step I unless the user resets the system by inserting another set of clothes and resets
the program,
1.1.2 Embedded System
Definition One of the definitions of embedded system is as follows:
“An embedded system is a system that has embedded sofiware and computer-hardware, which makes it
«a system dedicated for an application(s) or specific part of an application or product or a pant of a larger
system.”
Embedded systems have been defined in books published recently in several ways. Given below is a series
of definitions from others in the field:
Wayne Wolf author of Computers as Components — Principles of Embedded Computing System Design:
“What is an embedded computing system’ Loosely defined, it is any device that includes a programmable
computer but is not itself intended to be a general-purpose computer” and “a fax machine or a clock built from
a microprocessor is an embedded computing system”.Embedded Systems
Todd D. Morton author of Embedded Microcontrollers: “Embedded Systems are electronic systems that
contain a microprocessor or microcontroller, but we do not think of them as computers—the computer is
hidden or embedded in the system.”
David E. Simon author of An Embedded Software Primer: “People use the term embedded system to mean
any computer system hidden in any of these products.”
Tim Wilmshurst author of An Introduction to the Design of Small Scale Embedded Systems with examples
from PIC, 80C51 and 68HC05/08 microcontrollers: (1) “An embedded system is a system whose principal
function is not computational, but which is controlled by a computer embedded within it. The computer is
likely to be a microprocessor or microcontroller. The word embedded implies that it lies inside the overall
system, hidden from view, forming an integral part of {the} greater whole”, (2) “An embedded system is a
microcontoller-based, software-driven, reliable, real time control system, autonomous, or human- or network-
interactive, operating on diverse physical variables and in diverse environments, and sold into a competitive
and cost-conscious market”.
A computer is a system that has the following or more components.
1. A microprocessor
2. A large memory of the following two kinds:
(a) Primary memory (semiconductor memories: Random Access Memory (RAM), Read Only Memory
(ROM) and fast accessible caches)
(b) Secondary memory [(magnetic memory located in hard disks, diskettes and cartridge tapes, optical
memory in CD-ROMs or memory sticks (in mobile computers)] using which different user
programs can be loaded into the primary memory and run
3. V/O units such as touch screen, modem, fax cum modem, etc.
4. Input units such as keyboard, mice, digitizer, scanner, ete.
5. Output units such as an LCD screen, video monitor, printer, etc.
6. Networking units such as an Ethernet card, front-end processor-based server, bus drivers, etc.
7. An operating system (OS) that has general purpose user and application software in the secondary
memory
An embedded system is a system that has three main components embedded into it:
1. Ttembeds hardware similar to a computer. Figure 1.1 shows the units in the hardware of an embedded
system. As its software usually embeds in the ROM or flash memory, it usually do not need a secondary
hard disk and CD memory as in a computer
It embeds main application software. The application software may concurrently perform a series of
tasks or processes or threads
3. It embeds a real-time operating system (RTOS) that supervises the application software running on
hardware and organizes access to a resource according to the priorities of tasks in the system. It
provides a mechanism to let the processor run a process as scheduled and context-switch between the
various processes. (The concept of process, thread and task explained later in Sections 7.1 to 7.3.) It
sets the rules during the execution of the application software. (A small-scale embedded system may
not embed the RTOS.)
»
Characteristics An embedded system is characterized by the following: (1) Real-time and multirate
operations define the ways in which the system works, reacts to events, interrupts and schedules the system’s
functioning in real time. It does so by following a plan to control latencies and to meet deadlines. (Latency
refers to the waiting period between running the codes of a task or interrupt service routine and the instance
at which the need for the task or interrupt from an event arises). The different operations may take place atIntroduction to Embedded Systems (5 ]
Input Devices
Interfacing!
Driver Circuits
a :
§ Program 4
5 Processor ee §
Z Memory 2
3 Seria i
5 Tmess Soreank §
3 Ports, 8
: :
2 Interrupt Paralel
& Controller Ports &§
&
a
i ‘Outputs Interfacing/
Driver Circuits
Fig. 1.1 The components of embedded system hardware
distinct rates. For example, audio, video, data, network stream and events have different rates and time
constraints. (2) Complex algorithms. (3) Complex graphic user interfaces (GUIs) and other user interfaces.
(4) Dedicated functions.
Constraints An embedded system is designed keeping in view three constraints: (1) available systeri-
‘memory, (2) available processor speed, (3) the need to limit power dissipation when running the system
continuously in cycles of ‘wait for events’, ‘run’, ‘stop’, ‘wake-up’ and ‘sleep’.
The system design or an embedded system has constraints with regard to performance, power, size and
design and manufacturing costs.
“\4.2.” PROCESSOR EMBEDDED INTO A SYSTEM
A processor is an important unit in the embedded system hardware. It is the heart of the embedded system.
Knowledge of basic concept of microprocessors and microcontrollers is must for an embedded system designer.
A reader may refer to a standard text or the texts listed in the ‘References’ at the end of this book for an in-
depth understanding of microprocessors, microcontrollers and DSPs that are incorporated in embedded system.
design. Chapter 2 will explain 8051 and a few processors.
1.2.1 Embedded Processors in a System
A processor has two essential units: Program Flow Control Unit (CU) and Execution Unit (EU). The CU
includes a fetch unit for fetching instructions from the memory. The EU has circuits that implement the
instructions pertaining to data transfer operations and data conversion from one form to another. The EU
includes the Arithmetic and Logical Unit (ALU) and also the circuits that execute instructions for a program:6) Embedded Systems
LU)
control task, say, halt, interrupt, or jump to another set of instructions. It can also execute instructions for a call
or branch to another program and for a call to a function.
A processor runs the cycles of feich-and-execute. The instructions, defined in the processor instruction
set, are executed in the sequence that they are fetched from the memory. A processor is in the form of an
IC chip; alternatively, it could be in core form in an Application Specific Integrated Circuit (ASIC) or
System on Chip (SoC). Core means a part of the functional circuit on the Very Large Scale Integrated (VLSI)
chip.
‘An embedded system processor chip or core can be one of the following.
1, General Purpose Processor (GPP): A GPP is a general-purpose processor with instruction set designed
not specific to the applications.
(a) Microprocessor. [Section 1.2.2]
(b) Embedded Processor (Section 1.7.7]
2. Application Specific Instruction-Set Processor (ASIP). An ASIP is a processor with an instruction set
designed for specific applications on a VLSI chip.
(a) Microcontroller [Section 1.2.3]
(b) Embedded microcontroller {Section 1.7.7]
(©) Digital Signal Processor (DSP) and media processor (Section 1.7.3]
(d) Network processor, IO processor or domain-specific programmable processor
3. Single Purpose Processors as additional processors: Single purpose processor examples are as follows:
(1) Coprocessor (e-g.,.as used for graphic processing, floating point processing, encrypting, deciphering,
discrete cosine transformation and inverse transformation or TCP/IP protocol stacking and network
connecting functions). (2) Accelerator (e.g., Java codes accelerator). (3) Controllers (¢g., for peripherals,
direct memory accesses and buses). [Section 1.7.7]
4. GPP or ASIP cores integrated into cither an ASIC or a VLSI circuit or a Ficld Programmable Gate Array
(FPGA) core integrated with processor units in a VLSI (ASIC) chip. [Sections 1.6 and 1.7]
5. Application Specific System Processor (ASSP). [Section 1.7.9]
6. Multicore processors or multiprocessor [Section 1.7]
For a system designer, the following are important considerations when selecting a processor:
1. Instruction set
2. Maximum bits in an operand (8 or 16 or 32) in a single arithmetic or logical operation
3. Clock frequency in MHz and processing speed in Million Instructions Per Second (MIPS) or in an
alternate metric Dhrystone for measuring processing performance (Section 2.6]
4. Processor ability to solve complex algorithms while meeting deadlines for their processing
A microprocessor or GPP is used because: (i) processing based on the instructions available in a
predefined general purpose instruction set results in quick system development. (ii) Once the board and VO
interfaces are designed for a GPP, these can be used for a new system by just changing the embedded software
in the ROM. (iii) Ready availability of a compiler facilitates embedded software development in high-level
languages. (iv) Ready availability of well-tested and debugged processor-specific APIs (Application
Program Interfaces) and codes previously designed for other applications results in new systems developed
quickly.
1.2.2 Microprocessor
‘The CPU is a unit that centrally fetches and processes a set of general-purpose instructions. The CPU instruction
set includes instructions for data transfer operations, ALU operations, stack operations, IO operations andIntroduction to Embedded Systems: T
program control, sequencing and supervising operations. The general-purpose instruction setis always specific
toa specific CPU. Any CPU must possess the following basic functional units:
1. A control unit that fetches and controls the sequential processing of a given command or instruction
and communicates with the rest of the system.
2. An ALU that undertakes arithmetic and logical operations on bytes or words. It may be capable of
processing 8, 16, 32 or 64-bit words at an instant.
A microprocessor is a single VLSI chip that has a CPU and may also have some other units (e.g., caches,
floating point processing arithmetic unit, pipelining and superscaling units) that are additionally present and
that result in faster processing of instructions.
The earlier generation microprocessor’s fetch-and-execute cycle was guided by a clock frequency of the
order of ~4 MHz, Processors now operate at a clock frequency of 4 GHz and even have multiple cores. In
early 2002, it became possible to design Gbps (Giga bit per second) transceiver and encryption engines in a
few highly sophisticated embedded systems using processors that operate on GHz frequencies. A transceiver
is a wansmitting cum receiving circuit that has appropriate processing and controls units, for example, for
controlling bus-collisions. An encryption engine is a system that encrypts the data to be transmitted on the
network.
Intel 80x86 (also referred as x86) processors are the 32-bit successors of 8086. [The x here refers to an
£8086 extended for32 bits.] Examples of 32-bit processors in 80x86 series are Intel 80386, 80486 and Pentiums
(anew generation of 32- and 64-bit microprocessors is the classic Pentium series). IBM PCs use 80x86 series.
and the embedded systems incorporated inside the PC for specific tasks (like graphic accelerator, disk
controllers, network interface card) use these microprocessors.
High performance processors have pipeline and superscalar architecture, fast ALUs and Floating Point
Processing Units (FLPUs). [A pipeline architecture means that the instructions have between 3 and 9 stages.
Different instructions are at different stages of the pipeline at any given instance. A superscalar architecture
refers to two or more sets of instructions executing in parallel pipelines.]
The important microprocessors used in the embedded systems are ARM, 68HCxxx, 80x86 and SPARC
family of microprocessors.
Section 1.7 will describe the embedding of a microprocessor GPP in complex systems.
A microprocessor is used as general-purpose processor wien large embedded software has to be located
in the external memory chips.
1.2.3 Microcontroller
A microcontroller is an integrated chip that has processor, memory and several other hardware units in it;
these form the microcomputer part of the embedded system. Figure 1.2 shows the functional circuits present
(insolid boundary boxes) in a microcontroller. It also shows the application-specific units (in dashed boundary
boxes) in a specific version of a given microcontroller family.
Just as a microprocessor is the most essential part of a computing system, a microcontroller is the most
essential component of a control or communication circuit. A microcontroller is a single-chip VLSI unit (also
called ‘microcomputer’), which, though having limited computational capabilities, possesses enhanced input—
output capabilities and a number of on-chip functional units. [Refer to Section 1.3 for various functional
hardware units.] Microcontrollers are particularly suited for use in embedded systems for real-time control
applications with on-chip program memory and devices.8 | Embedded Systems
Functional Circutsin a Chip oF Core of Merocontoi (Merocomputer) |
seah ee |
Processor | Internal | Control and :
FlastvROM | Interfaces/ | |
Drivers
iiternsi Extemal Memories | 7
— Communication |
Pot |
[Timers and | 4
| Watchdog Timer =
| Seiat
|» | Synchronous
| (fort | Communicetion
| Contralier | | Port |
Application Specie Greuls in Speaific Versions |
oa 7 pint) | ouem! | OTM
Controller | Converter | | Creat i Creu
ee for ; aa
pa! |
| Network | | CAN | | Printer |
Driver | Controller
Stack | i Scecctee! Senator
‘and
Intertacos |
chip or
Fig. 1.2. Various functional circuits (solid boundary boxes) in a microcontrollet
ic units
core in an embedded system. Also shown are the application-speci
(dashed boundary boxes) in a specific version of a microcontroller
A few of the latest microcontrollers also have dual core and high computational and superscalar processing
capabilities. Important microcontroller chips for embedded systems are 8051, 8051MX, 68HCI 1xx, HC12xx,
HClé6xx, PIC 16F84 or 16C76, 16F876 and PIC18, microcontroller enhancements of ARM9/ARM7 from
ARM, Intel, Philips, Samsung and ST microelectronics.
Figure 1.3 shows commonly used microcontrollers in small-, medium- and large-scale embedded systems.
Choosing a microcontroller as a processing unit depends upon the application-specific features in it.
A microcontroller is used when a small or part of the embedded software has to be located in the internal
memory and when on-chip functional units such as the interrupt-handler, port, timer, ADC, PWM and
CAN controller are required.
1.2.4 Single Purpose Processors
Single purpose processors used in embedded systems include:
1. Coprocessor (for example, for floating point processing).Introduction to Embedded Systems
‘Small Scale Embedded System 8/16-bit Microcontroller
es ee ee ee
8051 family Plcterex [_ Miachie | eatictin |
Medium Scale Embedded System 16-bit Microcontroler |
cy annie ieenannnng gail
eosimx | | Pic tere76,Picie | | Hitachi besF2ezaFa | | G8HCt2x,68HCI6m |
Large Scale Embedced System 32-bit Microcontroller |
‘ARM family Cortex-M3, Atmel AT91 series, Hitachi SH7045F
C16x/ST10 series, Philips LPC 2000 series, ————
‘Texas Instrument, TI TMS470R1B1M, SamsungS3C44B0X
ye
10.
1.3 Commonly used microcontrollers in small-, medium- and large-scale embedded
systems
Graphics processor: An image consists of anumber of pixels. For example, Quarter common intermediate
format—Quarter-CIF images have 144 x 176 (horizontal x-axis x vertical y-axis) pixels. Video frames
have 525 x 625 pixels. The video graphic adapter (VGA) format of e-mailing and web pages has
640 x 480 = 307,200 pixels. A separate graphics processor is required for functions such as, for example,
‘gaming, display from graphics memory buffersand to move (translate on screen) and rotatean image orits
segments.
. Pixel coprocessor: High-resolution pictures have formats: 2592 x 1944 pixels = 5,038,848 pixels;
2592 x 1728 = 3.2 M; 2048 x 1536 = 3 M and 1280 x 960 = 1 M. A pixel coprocessor is required in
digital cameras for displaying images directly or after operations such as rotate right, rotate-left, rotate-
up, rotate-down, shift to next, shift to previous.
Encryption engine: A suitable algorithm runs in this processor to encrypt data for secure transmission.
Decryption engine: A suitable algorithm runs in this processorto decrypt the encrypted data atreceiver’s
end.
A discrete cosine transformation (DCT) and inverse transformation (DCIT) processor is required in
speech and video processing.
Protocol stack processor: A protocol stack, which has a number of header words, is prepared before an
application data is sent to a network. At the receiver’s end, the protocol stack is received and application
data is accepted accordingly. A TCPAP protocol stack processor processes TCP/IP network data.
Network processor: A network processor's functions are to establish a connection, finish, send and
receive acknowledgements, send and receive retransmission requests and check and correct received
data frame errors. The network processor's functions include all protocol stack-processing functions.
Accelerator (for example, Java codes accelerator). The accelerator is a coprocessor that accelerates
computations by taking advance actions that are just-in-time compilations of the next object in Java
programs.
CODEC (Coder and Decoder): A CODEC is a processor circuit that encodes input and decodes the
encoded information or bits or signals into a complete set of bits or original signal. Voice, speech,| 10 | Embedded Systems
image, video signals and bits are encoded for storing or transmission and decoded from the stored or
received bits or signal for display or playing. The CODEC functions as a compression and
decompression unit for voice, speech, image or video signals.
11, JPEG CODEC: This is a processor for jpg compression and decompression. The Joint Photographic
Experts Group (JPEG) is an International Telecommunication Union for Telecom (ITU-T) and
International Standards Organisation (ISO) committee.
12, MPEG CODEC: The Motion Pictures Experts Group (MPEG) recommends CODEC standards for
video. MPEG3 CODEC is a processor for mp3 compression and decompression. MPEG 2 or 3 or 4
compression of audio/video data streams is done before storing or transmitting, and decompression is
done before retrieving or playing files. For MPEG compression and decompression algorithms, if
GPP-embedded software is run, then separate DSPs are required to achieve real-time processing.
13. Controller (e.g., for peripheral, direct memory access or bus).
Single purpose processors are used for specific applications or computations or as controllers for peripherals,
direct memory accesses and buses.
a EMBEDDED HARDWARE UNITS AND DEVICES IN A SYSTEM
1.3.1 Power Source
Most systems have a power supply of their own. The Network Interface Card (NIC) and Graphic Accelerator are
‘examples of embedded systems that do not have their own power supply and connect to PC power-
supply lines. The supply has a specific operation range or a range of voltages. Various units in an
embedded system operate in one of the following four power ranges: 5.0 V + 0.25 V, 3.3 V +03 V,20V+0.2V
and 1.5 V +0.2V. There is generally an inverse relationship between propagation delay in the gates and operational
voltage. Therefore, the 5 V system processor and units are used in most high performance systems.
Certain systems do not have a power source of their own: they connect to external power supply or are
powered by the use of charge pumps (made up of a circuit of diode and capacitor that accumulate charge from
the bus signals through which they connect or network to the host or from wireless radiation). ”
Low voltage operations
1. In portable or hand-held devices such as a cellular phone [when compared to 5 V, a CMOS 2 V circuit
power dissipation reduces by one-sixth, ~ (2 V/5 V)2. This also increases the time intervals needed for
recharging a battery by a factor of six.].
2. Ina system with smaller overall geometry, low voltage system processors and 10 circuits generate
lesser heat and thus can be packed into a smaller space.
A power supply source or a charge pump is essential in every system.
1.3.2 Clock Oscillator Circuit and Clocking Units
The clock controls the time for executing an instruction. After the power supply, the clock is the basic unit of
asystem. A processor needs a clock oscillator circuit. The clock controls the various clocking requirements ofIntroduction to Embedded Systems ("|
the CPU, of the system timers and the CPU machine cycles. The machine cycles are for fetching codes and
data from memory and then decoding and executing them at the processor and for transferring the results to
memory.
For processing units, a highly stable oscillator is required and the processor clock-out signal provides the
clock for synchronizing all system units with the processor,
1.3.3 System Timers and Real-time Clocks
A timer circuit is suitably configured as the system-clock, which ticks and generates system interrupts
periodically; for example, 60 times in 1s, The interrupt service routines then perform the required
operation
A timer circuit is suitably configured as the real-time clock (RTC) that generates system interrupts periodically
for the schedulers, real-time programs and for periodic saving of time and date in the system.
The RTC or system timer is also used to obtain software-controlled delays and time-outs. An RTC functions:
as driver for software timers (SWTS). [Sections 3.6 and 3.8]
Microcontrollers also provide intemal timer circuits for counting and timing devices.
To schedule the various tasks and for real-time programming, an RTC or system clock is needed. The
clock also drives the timers for various timing and counting needs in a system.
1,3.4 Reset Circuit, Power-up Reset and Watchdog-Timer Reset
The program counter (PC) holds the address from where the instruction is to be fetched for execution. In
80x86 processors, the instruction pointer (IP) holds that address. A code segment register (CS) holds the base
address of the code memory segment. The CS address equals the code starting address when the IP= Oat the
start of a code segment. The IP increments when the program executes the codes.
Reset means that the processor begins the processing of instructions from a starting address. That address
is one that is set by default in the processor PC (or IP and CS in x86 processors) on a power-up. From that
address in memory, program-instructions are fetched following the reset of the processor. A program that is
reset and runs on a power-up can be one of the following: (i) A system program that executes from the
beginning. (ii) A system boot-up program. (iii) A system initialization program.
In certain processors, for example, 68HC11 and HC12, there are two start-up addresses. One is based on
the power-up reset vector and the other on the reset vector after the reset instruction or after a time-out (for
example, from a watchdog timer). The processor fetches the bytes for the PC from the first power-up reset
‘vector on power-up. The processor feiches the bytes for the PC from the second reset vector on the watchdog
timer timing out or on executing the reset instruction.
The reset circuit activates for a fixed period (a few clock cycles) and then deactivates. The processor
circuit keeps the reset pin active and then deactivates to let the program proceed from a default beginning
address. The reset pin or the internal reset signal, if connected to the other units (for example, the IO interface
or the serial interface) in the system, is activated again by the processor; it becomes sn outgoing pin to enforce
reset state in other sister units of the system. On deactivation of the reset that succeeds the processor activation,
a program executes from a start-up address.
Reset can be activated by an external reset circuit that activates on power-up, on switching-on reset
of the system or on detection of a low voltage (e.g. <4.5 V when what is required is 5 V on the system[2] Embedded Systems
supply rails). This circuit output connects to a pin called the reset pin of the processor. This circuit may be a
simple RC circuit, an external IC circuit or a custom-built IC. Examples of ICs are MAX 6314 and Motorola
MC 34064.
Alternatively, it can also be activated by any one of the following: (i) software instruction; (ii) time-out by
‘a programmed timer known as a watchdog timer (or on an internal signal called COP in 68HC11 and 68HC12
families); (iii) a clock monitor detecting a slowdown below certain frequencies.
‘The watchdog timer is a timing device that resets the system after a predefined timeout. It is activated
within the first few clock cycles after power-up. It has a number of applications. In many embedded systems
reset by a watchdog timer is very essential because it helps in rescuing the system if a fault develops and the
program gets stuck. On restart, the system can function normally. Most microcontrollers have on-chip watchdog.
timers. The watchdog timer device is described in detail in Section 3.7.
Consider a system controlling temperature. Assume that when the program starts executing, the sensor
inputs work all right. However, before the desired temperature is achieved, the sensor circuit develops some
fault. The controller will continue delivering the current nonstop if the system is not reset. Consider another
example of a system for controlling a robot. Assume that the interfacing motor control circuit in the robot arm
develops a fault during the run. In such cases, the robot arm may continue to move unless there is a watchdog
timer control. Otherwise, the robot will break its own arm!
When a program executes the program counter increments or changes, An important circuit that associates
a system is its reset circuit that can change the program counter to a power-up default yalue. A program
that is reset and runs on.a power-up can be one of the following: (i) A system program that executes from
the beginning. (ii) A system boot-up program. (iii) A system initialization program.
The watchdog timer reset is a required feature in control applications.
1.3.5 Memory
Ina system, there are various types of memory. Figure 1.4 shows a chart for various forms of memory that are
present in systems, These are as follows:
1, Internal RAM of 256 or 512 bytes in a microcontroller for registers, temporary data and stack.
2. Internal ROM/PROM/ E?PROM for about 4 kB to 64 kB of program (in the case of microcontrollers).
3. External RAM for the temporary data and stack (in most systems) or intemal caches (in the case of
certain microprocessors).
Various Forms of System Memory
I
intemal RAM at Internal Extomal Flash’ ROM! Memory
RAM at System- Caches RAN EEPROM PROM Addresses
oils ‘on- at Chips) at
troller Chip Microprocessor =a the System
or [Hold Copies. ae Ports:
External ‘of System
Rak enon. Internal
pages]
Fig. 1.4 The various forms of memories in the systemIntroduction to Embedded Systems [3]
4, Intemnal flash (in many systems the results of processing can be saved in nonvolatile memory: for example,
system status periodically and images, songs, or speeches after suitable format compression).
5. Memory stick (or card): video, images, songs, or speecties and large storage in digital camera and
mobile systems. Sony memory stick Micro (M2) is of size 15%12.5%1.2 mm and has a flash memory
of 2 GB. It has a data transfer rate of 160 Mbps (mega bit per second) and PRO-HG 480 Mbps and
120 Mbps write {since Dec. 2006.]
6. Extemal ROM or PROM for embedding software (in almost all systems other than microcontroller-
based systems).
7. RAM memory butfers at ports
8. Caches (in pipelined and superscalar microprocessors).
Table 1.1 details the functions assigned in embedded systems to the memories. ROM or PROM or EPROM
‘embeds the software specific to the system
Table 1.1 Functions assigned to the memories in a system
RAM (internal and external)
and RAM for buffer
Memory stick
EEPROM or Flash
Cache
‘Memory Needed Functions
ROM or EPROM ‘Storing application programs from where the processor fetches the instruction codes.
or flash Storing codes for system booting, initializing, initial input data and strings. Codes for
RTOS. Pointers (addresses) of various interrupt service routines (ISRs).
Storing the variables during program run and storing the stack. Storing input or output
buffers, for example, for speech or image.
‘A flash memory stick is inserted in mobile computing system or digital-camera. It
stores high definition video, images, songs, or speeches after a suitable format
compression and stores large persistent data.
Storing nonvolatile results of processing.
Storing copies of instructions and data in advance from external primary memory and
storing the results temporarily during processing.
A system embeds (locates) the following either in the internal flash or ROM, PROM or in an extemal flash
or ROM or PROM of the microcontroller: boot-up program, initialization data, strings or pictogram for
screen-display or initial state of the system, programs for various tasks, ISRs and operating system kernel.
‘The system has RAMs for saving temporary data, stack and buffers that are needed during a program run.
The system uses flash for storing nonvolatile results.
1.3.6 Input, Output and IO Ports, 10 Buses and IO Interfaces
‘The system gets inputs from physical devices through the input ports. Examples are as follows:
1. A system gets inputs from the touch screen, keys in a keypad or keyboard, sensors and transducer
circuits.
2. A controller circuit in a system gets inputs from the sensor and transducer circuits.
3. A receiver of signals ora network card gets the input froma communication system. [A communication
system could be a fax or modem, or a broadcasting service.]
4. Ports receives inputs from a network or peripheral.ext Soe
Consider the system in an Automatic Chocolate Vending Machine. It gets inputs from a port that collects
the coins that a child inserts.
Consider the system in a mobile phone. A user inputs the mobile number through the buttons, directly or
indirectly (through recall of the number from its memory). Keypad keys connect to the system through an
input port.
A processor identifies each input port by its memory buffer addresses, called port addresses. Just as a
memory location holding a byte or word is identified by an address, each input port is also identified by the
address. The system gets the inputs by the read operations at the port addresses.
The system has output ports through which itsends output bytes to the real world, Examples are as follows:
1. Output may be sent to an light emitting diode (LED), liquid crystal display (LCD) or touch screen
display panel. For example, a calculator or mobile phone system sends the output-numbers or an SMS
message to the LCD display.
A system may send the output to a printer.
Output may be sent fo a communication system or network,
A control system sends the outputs to alarms, actuators, furnaces or boilers.
A robot is sent output for its various motors.
Each output port is identified by its memory-buffer addresses (called port addresses). The system sends the
output by a write operation to the port address.
‘There are also general-purpose ports for both the input and output (IO) operations. For example, a mobile
phone system sends output as well as gets input through a wireless communication channel. A mobile computing
system touch screen system sends output as well as gets input when a user touches the menu displayed or key
on the screen.
Each 10 port is also identified by an address to which the read and write operations both take place.
Ports can have serial or parallel communication with the system address and data buses. In serial communication
a one-bit data line is used and bits are sent serially in successive time slots. Universal Asynchronous Receiver
and Transmitter (UART) is a popular communication protocol for serial communication. In parallel
communication, several data lines are used and bits are sent in parallel.
A system port may have to send output to multiple channels. A demultiplexer or multiplexer circuit is then
used.
A demultiplexer is a digital circuit that sends digital outputs at any instance to one of the provided channels.
‘The channel to which the output is sent is the one that is addressed by the channel address bits at the
demultiplexer input. A demultiplexer takes the input and transfers it to a select channel output among the
multiple output channels.
A multiplexer is a digital circuit that receives digital inputs at any instance from multiple channels, and
sends data output only from a specific channel at an instance, The channel address bits are at multiplexer
input. A multiplexer takes the input from one among the multiple input channels and transfers a selected
channel input to the output.
A system unit (for example, memory unit or IO port or device) may have to be selected from among the
‘multiple units in the system and activated. A decoder circuit when used as an address decoder decodes the input
addresses and activates the selected output channel from among the many outputs. For example, there are 8 units
of which one has to be selected. An address-select input of 3 bits is input to the decoder. Based on the input
address, the output select line among the 8 activates, If the input address bit is 000, then the 0" output is active
and the O* unit activates. If the input address bit is 111, then the 7 output is active and the 7" unit activates,
vaeN
Bus A system might have to be connected to a number of other devices and systems. A bus consists of a
common set of lines to connect multiple devices, hardware units and systems for communication between anyIntroduction to Embedded Systems
two of these at any given instance. A bus communication protocol specifies how signals communicate on the
bus. A bus may be a serial or parallel bus that transfers one or multiple data bits at an instance, respectively.
The protocol also specifies the following: (i) ways of arbitration when several devices need to communicate
through the bus; (ii) ways of polling bus requirement from each device at an instance; (iii) ways of daisy
chaining the devices so that bus is granted to a device according to the device-priority in the chain.
For networking the distributed units or systems, there are different types of serial and parallel bus protocols:
PC, CAN, USB, ISA, EISA and PCI. For wireless networking of systems there are 802.11, IDA, Bluetooth
and ZigBee protocols.
Chapter 3 will describe the ports, devices, buses and protocols in detail.
A system connects to external physical devices and systems through parallel or serial I/O ports.
Demultiplexers and multiplexers facilitate communication of signals from multiple channels through a
common path, A system often networks to the other devices and systems through an /O bus: for example,
PC, CAN, USB, ISA, EISA and PCI bus.
1.3.7 DAC Using a PWM and an ADC
DAC is a circuit that converts digital 8 or 10 or 12 bits to the analog output. The analog output is with respect
to the reference voltage. When all input bits are equal to 1, then the analog output is the difference between
the positive and negative reference pin voltages; when all input bits equal 0, then the analog output equals,
~ve reference pin voltage (usually 0 V).
‘Suppose a system needs to give the analog output of a control circuit for automation. The analog output
may be toa power system for d.c. motor or furnace.
A pulse width modulator (PWM) with an integrator circuit is used for the DAC. A PWM unit in the
microcontroller operates as follows: Pulse width is made proportional to the analog-output needed. PWM
inputs are from 00000000 to 11111111 for an 8-bit DAC operation. The PWM unit outputs to an external
integrator, which provides the desired analog output. From this information, the formula to obtain the analog
output from the bits in a given PWM register with bits ranging from 00000000 to 11111111 is as follows:
Analog output V = K-pw, where K is constant and pw is the pulse width
‘Suppose a circuit (external to the microcontroller) gives an output of 1.024 V when the pulse width is 50%
of the total pulse time period, and 2.047 V when the width is 100%. When the width is made 25%, by
reducing by half the value in the PWM output control-register, the integrator output will become 0.512 V. The
constant K depends on integrator amplifier gain.
Assume that the integrator operates with a dual (plus-minus) supply. The PWM unit in the microcontroller
operates by another method, which is as follows. Assume that when an integrator circuit gives an output of
1.023 V, the pulse width is 100% of the total pulse time period and of -1.024 V when the width is 0%. When
the width is made 25% by reducing by half the value in an output control register, the integrator output will be
0.512 V; at 50% the output will be 0.0 V. From this information, the formula to obtain the analog output from
the bits ina given PWM register ranging from 00000000 to 11111111 in both situations is as follows: Analog
output V = 0.01. K’. (pw — 50), where K’ is constant and pw is pulse width time in percentage with respect to
pulse time period, K’ depends on integrator amplifier gain.
Analog to Digital Converter ADC is a circuit that converts the analog input to digital 4, 8, 10 or 12
bits. The analog input is applied between the positive and negative pins and is converted with respect to the
reference voltage. When input is equal to difference of reference positive and negative voltages, then all
output bits equal I; when equals negative reference voltage (usually 0 V), then all output bits equal 0.Embedded Systers
‘The ADC in the system microcontroller can be used in many applications such as data acquisition systems
(DAS), digital cameras, analog control systems and voice digitizing systems. Suppose a system gets the
analog inputs from sensors of temperature, pressure, hear'-beats and other sources in a DAS. Suppose a
system gets the analog inputs from a digital camera. It has CCD (Charge Couple Device) which has tiny pixels
that charge up on exposure to light. The charging of each pixel depends upon the light intensity at that point
in the image. The analog inputs to the system generate from each pixel. Each pixel’s analog input has to be
converted into bits to enable processing in the next stage.
Suppose a system needs to read an analog input from a sensor or transducer circuit. If converted to bits by
the ADC unit in the system, then these bits, after processing, can also give an output. This provides a control
for automation by a combined use of ADC and DAC features.
The converted bits can be given to the port meant for digital display. The bits may be transferred to a
memory address, a serial port or a parallel port.
A processor may process the converted bits and generate a Pulse Code Modulated (PCM) output, PCM
signals are used to digitize voice into a digital format.
Important points about the ADC are as follows.
1. Bithera single or dual analog reference voltage-source is required in the ADC. It sets either the analog
input’s upper limit or the lower and upper limits both. For a single reference source, the lower limit is
setto 0 V (ground potential). When the analog input equals the lower limit, the ADC generates all bits
as 0s, and when it equals the upper limit it generates all bits as 1s. [As an example, suppose in an ADC
the upper limit or reference voltage is set to 2.255 V. Let the lower limit reference voltage be 0.255 V.
The difference in the limits is 2 V. Therefore, the resolution will be 2/256 V. If the 8-bit ADC analog-
input is 0.255 V, the converted 8 bits will be 00000000. When the input is 0.255 V + 1.000 V = 1.255 V,
the bits will be 10000000. When the analog input is 0.255 V + 0.50 V, the converted bits will be
01000000. [From this information, finding a formula to obtain converted bits for a given analog
input = v volt is as follows: Binary number n bits after conversion in an n-bit ADC corresponds to
decimal number N. Then N =v. (Vyoc,~ V ret-/2". Here, Vyeg is the reference voltage that gives all the
bits that are equal to 1 and Vier is the reference voltage that gives all the bits that are equal to 0.]
An ADC may be of 8, 10, 12, or 16 bits depending upon the resolution needed for conversion.
‘The start of the conversion (STC) signal or input initiates the conversion to 8 bits. In a system, an
instruction or a timer signals the STC.
4. There is an end of conversion (EOC) signal. A flag in a register is set to indicate the end of conversion
and the ADC generates an interrupt; the ISR reads the ADC bits and saves them in the memory buffer.
5. There is a conversion time limit in which the conversion is definite.
6. A Sample and Hold (S/H) unit is used to sample the input for a fixed time and hold till conversion is
over.
‘An ADC unit can be repeatedly used after the intervals equal to the conversion time. Therefore, one can
digitizes the DAS sensor signals, CCD signals, voice, music or video signals, or heart beat sensor signals in
different systems. An ADC unit in an embedded system microcontroller may have multichannels. It can then
take the inputs in succession from the various pins interconnected to different analog sources.
yr
For automatic control and signal processing applications, a system provides necessary interfacing circuit
and software for the Digital to Analog Conversion (DAC) unit and Analog to Digital Conversion (ADC)
unit. A DAC operation is done with the help of a combination of a PWM unit in the microcontroller and an
extemal integrator chip. ADC operations are required for data acquisition, image processing, voice
processing, video processing, instrumentation and automatic control systems.Introduction to Embedded Systems: 7
1.3.8 LCD, LED and Touchscreen Displays
A system requires an interfacing circuit and software to display the status or message for a line, for multiline
displays, or for flashing displays. An LCD screen may show up a multiline display of characters or also show
a small graph or icon (called a pictogram). A recent innovation in the mobile phone system turns the screen
blue to indicate an incoming call. Third generation system phones have both image and graphic displays. An
LCD needs little power. A supply or battery (a solar panel in the calculator) powers it. The LCDis a diode that
absorbs or emits light and 3 to 4 V and 50 or 60 Hz voltage-pulses with currents less than ~50 1A are required.
‘The pulses are applied with the same polarity on the crystal front and back plane for no light, and with
opposite polarity for light. Here, polarity means logic ‘I’ or ‘0’. A display-controller is often used in case of
matrix displays.
To indicate the ON status of the system, there may be an LED that glows. A flashing LED may indicate that
a specific task is under completion or is running or in wait status. The LED is a diode that emits yellow, green,
red or infrared light in a remote controller on application of a forward voltage of between 1.6-2 V. It needs
current up to 12 mA above 5 mA (less in flashing display mode). It is much brighter than the LCD, making it
suitable for flashing displays and for displays limited to a few digits.
‘A touchscreen is an input as well as an output device, which can be used to enter acommand, a chosen menu
or to give a reply. The information is input by physically touching at a screen position using a finger or a stylus.
A stylus is thin pencil-shaped object. It is held between the fingers and used just as a pen. The screen displays the
choices or commands, menus, dialog boxes and icons. The display-screen display is similar to a computer video
display unit screen. Newer touch screen senses the fingers even from proximity, for example, in Apple iPhone.
Sections 3.3.4 and 3.3.5 describe the LCD and touchscreen devices and their connections to the system.
The system may need the necessary interfacing circuit and software for the output to the LCD display
controller and the LED interfacing ports or for the I/Os with the touchscreen.
1.3.9 Keypad/Keyboard
The keypad or keyboard is an important device for getting user inputs. The system provides the necessary
interfacing and key-debouncing circuit as well as the software for the system to receive input from a set of
keys, from a keyboard, keypad or virtual keypad. A touchscreen provides for a virtual keypad in a mobile
computing system, A virtual keypad is a keypad displayed on the touch screen where the user can enter the
keys using a stylus or finger.
‘A keypad has upto a maximum of 32 keys. A keyboard may have 104 keys or more. The keypad or
keyboard may interface serially or parallelly to the processor directly through ports or through a controller.
Mobile phones may have a T9 keypad. A T9 keypad has 16 keys and four up-down right-left menu keys.
Using 0 to 9 keys text messages, such as SMS messages, are generated.
For inputs, a keypad or board may interface to a system. The system provides necessary interfacing circuit
and software to receive inputs directly from the keys or through a controller.
1.3.10 Pulse Dialer, Modem and Transceiver
For user connectivity through the telephone line, wireless or a network, a system provides the necessary
interfacing and circuits. It also provides the software for pulse dialing through the telephone line, for modem{ 18 | Embedded Systems
interconnection for fax, for Internet packets routing and for transmitting and connecting toa wireless cellular
system or personal area wireless network. A transceiver is a circuit that can transmit as well as receive
byte streams.
In communication system, a pulse dialer, modem or transceiver is used. A system provides the necessary
interfacing circuit and software for dialing and for the modem and transceiver, directly or through a
controller.
1.3.11 Interrupt Handler
A timing device sends a time-out interrupt when a preset time elapses or sends a compare interrupt when the
present-time equals the preset time, Assume that data have to be transferred from a keyboard to a printer. A
port peripheral generates an interrupt on receiving the input data or when the transmitting buffer becomes
empty. Each action generates.an interrupt, A system may possess a number of devices and the system processor
has to control and handle the requirements of each device by running an appropriate ISR (interrupt service
routine) for each. An interrupts-handling mechanism must exist in each system to handle interrupts from
various processes and for handling multiple interrupts simultaneously pending for service. Chapter 4 describes
in detail the interrupts, ISRs, and their handling mechanisms in a system. Important points regarding the
interrupts and their handling by the program are as follows.
1. There can be a number of interrupt sources and groups of interrupt sources in a processor.
{Section 4.3] An interrupt may be a hardware signal that indicates the occurrence of an event.
[For example, a real-time clock continuously updates a value at a specified memory address; the
transition of that value is an event that causes an interrupt.) An interrupt may also occur
through timers, through an interrupting instruction of the processor program or through an error
during processing. The error may arise due to an illegal op-code fetch, a division by zero result or an
overflow or underflow during an ALU operation, An interrupt can also arise through a software timer,
A sofiware interrupt may arise in an exceptional condition that may have developed while running a
program.
‘The system may prioritize sources and service them accordingly. [Section 4.5,]
Certain sources are not maskable and cannot be disabled. Some are assigned the highest priority
during processing.
4, The processor’s current program has to divert to aservice routine to complete that task on the occurrence
of the interrupt. For example. if key is pressed, then an ISR reads the key and stores the key value in
the processor memory address. If a sequence of keys is pressed, for instance in a mobile phone, then
an ISR reads the keys and also calls a task to dial the mobile number.
5, There is a programmable unit on-chip for the interrupt handling mechanism in a microcontroller.
6. The operating system is expected to control the handling of interrupts and running of routines for the
interrupts in a particular application. The system always gives priority to the ISRs over the tasks of an
application,
pp
A system provides an interrupt handling mechanism for executing the ISRs in case of the interrupts from
physical devices, systems, software instructions and software exceptions.Introduction to Embedded Systems
“4.4 “EMBEDDED SOFTWARE IN A SYSTEM
‘The software is like the brain of the embedded system.
1.4.1 Final Machine Implementable Software for a System
An embedded system processor executes software that is specific to a given application of that system. The
instruction codes and data in the final phase are placed in the ROM or flash memory for all the tasks that are
‘executed when the system runs. The software is also called ROM image. Why? Just as an image is a unique
sequence and arrangement of pixels, embedded software is also a unique placement and arrangement of bytes
for instructions and data
Each code or datum is available only in the bits and bytes format. The system requires bytes at each
ROM address, according to the tasks being executed. A machine implementable software file is therefore
like a table having in each rows the address and bytes. The byies are saved at each address of the system
memory. The table has to be readied as a ROM image for the targeted hardware. Figure 1.5 shows the ROM
image in a system memory. The image consists of the boot up program, stacks address pointers, program
counter address pointers, application programs, ISRs, RTOS, input data and vector address
— 2 Bytes for
‘Address from
2 Byles for Where System
‘Address of See
Sick | ~"\.SP-ADDR {Execution on
_——— Power Up
Reset (Not Needed in
ADDR 80x86,8051,80186,
)
Intemupt Service| ADDR2 0s for
Rautne Vector Dee
‘Addresses of Inputs for each
2 Byles each Interrupt
Bootup Service Routine
Program + ~
Codes
Mactine Specific
Codes for
each
Program, ISR
and Task
Machine Codes)
for Real Time
‘Operating :
System (RTOS),
ADDR-10
System ROM
Memory
Fig. 1.5 System ROM memory embedding the software, RTOS, data and vector addressesEmbedded Systems
Final stage software is also called the ROM image. The final machine implementable software for a
product embeds in the once programmable flash or ROM (or PROM) as an image in a frame. Bytes at each
address must be defined to create the ROM image. By changing this image, the same hardware platform
will work differently and can be used for entirely different applications or for new upgrades of the same
system,
1.4.2 Coding of Software in Machine Codes
During coding in this format, the programmer defines the addresses and the corresponding bytes or bits at
each address. In configuring some specific physical device or subsystem, machine code-based coding is used.
For example, in a transceiver, placing certain machine code and bits can configure it to transmit at specific
megabytes per second or gigabytes per second, using specific bus and networking protocols. Another example
is using certain codes for configuring a control register with the processor. During a specific code-section
processing, the register can be configured to enable or disable use of its internal cache. However, coding in
machine implementable codes is done only in specific situations because it is time consuming and the
programmer must first have to understand the processor instructions set and then memorize the instructions
and their machine codes.
1.4.3. Software in Processor Specific Assembly Language
A program or a small specific part can be coded in assembly language using an assembler after understanding,
the processor and its instruction set. Assembler is software used for developing codes in assembly.
‘Assembly language coding is extremely useful for configuring physical devices like ports, a line-display
interface, ADC and DAC and reading into or transmitting from a buffer. These codes are also called low-level
codes for the device driver functions. [Sections 1.4.7 and 4.2.4.] They are useful to run the processor or
device-specific features and provide an optimal coding solution.
Lack of knowledge of writing device driver codes or codes that utilize the processor-specific features
invoking codes in an embedded system design team can cost a lot. A vendor may charge for the APIs and also
charge intellectual property fees for each system shipped out of the company.
To make all the codes in assembly language may, however, be very time consuming. Full coding in assembly
may be done only for a few simple, small-scale systems, such as toys, automatic chocolate vending machines,
robots or data acquisition systems.
Figure 1.6 shows the process of converting an assembly language program into machine implementable
software file and then finally obtaining a ROM image file.
1. Anassembler wanslates the assembly software into the machine codes using a step called assembling.
2. In the next step, called linking, a linker links these codes with the other codes required. Linking is
necessary because of the number of codes to be linked for the final binary file. For example, there are
the standard codes to program a delay task for which there is a reference in the assembly language
program. The codes for the delay must link with the assembled codes. The delay code is sequential
from a certain beginning address. The assembly software code is also sequential from a certain beginning
address. Both the codes have to be linked at the distinct addresses as well as at the available addresses,
in the system. The linked file in binary for run on a computer is commonly known asan executable file
or simply an ‘.exe’ file. After linking, there has to be reallocation of the sequences of placing the codes
before actually placing the codes in memory.Introduction to Embedded Systems (21]
| Machine Machine
‘Machine Codes Codes
Speciic | Assembler, porte i ready for
Assembly rograms | |} Locating
er de | a |
| acreses Essense
U 8 \\s Us
é |
From |
Wray | Uke Byes for Davee
needed , tin
mechine |g) Programs | Leader |Pregranmor
codes |
l
Data Bytes
Embedded System
ROM Memory
Fig. 1.6 The process of converting an assembly language program into the machine codes
and finally obtaining the ROM image
3. In the next step, the loader program performs the task of reallocating the codes after finding the
physical memory addresses available at a given instant. The loader is a part of the operating system
and places codes into the memory after reading the ‘.exe’ file. This step is necessary because the
available memory addresses may not start from 0x0000, and binary codes have to be loaded at different
addresses during the run. The loader finds the appropriate start address. Ina computer, after the loader
Joads into a section of RAM, the program is ready to run.
4. The final step of the system design process is locating these codes as a ROM image. The codes are
permanently placed at the addresses actually available in the ROM. In embedded systems, there is no
separate program to keep track of the available addresses at different times during the run, as in a computer.
In embedded systems, therefore, the next step instead of loader after linking is the use of a locator,
which locates the 1O tasks and hardware device driver codes at fixed addresses. Port and device addresses.
are fixed for a given system as per the interfacing circuit between the system buses and ports or devices.
‘The locator program reallocates the linked file and creates a file for a permanent location of the codes in
standard format. The file format may be in the Intel Hex file format or Motorola S-record format. The
designer has to define the available addresses to locate and create files to permanently locate the codes,
5. Lastly, either (i) a laboratory system, called device programmer, takes as input the ROM image file
and finally burns the image into the PROM or flash or (ii) at a foundry, a mask is created for the ROM
of the embedded system from the ROM image file. [The process of placing the codes in PROM or
flash is also called burning.] The mask created from the image gives the ROM in IC chip form.
To configure some specific physical device or subsystem such as the transceiver, machine codes can be
used straightaway. For physical device driver codes or codes that utilize processor-specific features-invoking
codes, ‘processor-specific’ assembly language is used. A file isthen created in three steps using an Assembler,
Linker and Locator. The file has the ROM image in a standard format. A device programmer finally buns
the image in the PROM or EPROM. A mask created from the image gives the ROM in IC chip form.(22] Embedded Systems
1.4.4 Software in High Level Language
Since the coding in assembly language is very time consuming in most cases, software is developed in a high-
level language, *C’ or ‘C+¥" or visual C++ or ‘Java’ in mostcases. ‘C’ is usually the preferred language. The
programmer needs to understand only the hardware organization when coding in high level language. As an
example, consider the following problem.
Example 1.1
Add 127, 29 and 40 and print the square root.
An exemplary C language program for all the processors is as follows. (i) # include
(i) # include (iii) void main (void) { (iv) int il, i2, 13, a; float result; (v) il = 127;
i2 = 29; (3 =40; a = il + i2 + 13; result = sqrt (a); (vi) printf (result);}
The coding for square root will need many lines of
code and can be done only by an expert assembly |
language programmer. To write the program in a high |
|
Preprocessor Commands
’ mah Main Function
level language is very simple compared to writing it in
assembly language. *C’ programs have a feature that
adds the assembly instructions when using certain
Interrupt Service Routines
Tasks 1...N
processor-specific features and coding for a specific
section, for example, a port device driver. Figure 1.7 erred diet Siena
shows the different programming layers in a typical Standard Library
embedded °C" software. These layers are as follows. Functions eluding
(i) Processor Commands. (ii) Main Function. Tuntions tor
(iii) Interrupt Service Routine. (iv) Multiple tasks, say, Sending Stack and
1 to N. (v) Kemel and Scheduler. (vi) Standard library Recewving Stack
functions, protocol handling and stack functions,
Figure 1.8 shows the process of converting a
CC program into the ROM image file. A compiler
generates the object codes. It assembles the codes
according to the processor instruction set and other specifications. The C compiler for embedded
systems must, as a final step of compilation, use a code-optimizer that optimizes the codes before
linking. After compilation, the linker links the object codes with other needed codes. For example, the
linker includes the codes for the functions prinif and sqrt codes. Codes for device and driver (device
control codes) management also link at this stage: for example, printer device management and driver
codes. After linking, the other steps for creating a file for ROM image are the same as shown earliei
Figure 1.6.
Fig. 1.7. The different program layers in the
embedded software in C
C, C+, Java, Visual C++ are the languages used for sofiware development. A C program has various
layers: processor commands, main function, task and library functions, interrupt service routines and kernel
(scheduler). The compiler generates an object file. Using a linker and locator, the file for the ROM image
is created for the targeted hardIntroduction to Embedded Systems
[ee 1 Machine | 9
Progam [>| _Codes in .
| Functions -|“Compier |_ObjectFile_| | 2
\| 2
From | ————,. |
ley |_2 ayer |__|] &
Needed [>| Linked =
Machine | Linker Programs
aaa Steps 3 and 4 shown in
+ Figue 1.8
Fig. 1.8 The process of converting a C program into the file for ROM image
1.4.5 Program Models for Software Designing
The program design task is simplified if a program is modeled.
‘The different models that are employed during the design processes of the embedded software are as follows:
1. Sequential Program Model
2. Object Oriented Program Model
3. Controland Data flow graph or Synchronous Data Flow (SDF) Graph or Multi Thread Graph (MTG) Model
4. Finite State Machine for data path
5. Multithreaded Model for concurrent processing of processes or threads or tasks
UML (Universal Modeling language) is a modeling language for object oriented programming.
‘These models are explained Chapter 6.
1.4.6 Software for Concurrent Processing and Scheduling of Multiple
Tasks and ISRs Using an RTOS
An embedded system program is most often designed using multiple processes or multitasks or a
multithreads. [Refer to Sections 7.1 to 7.3 for definitions and understanding of the processes, threads and tasks.]
‘The multiple tasks are processed most often by the OS not sequentially but concurrently. Concurrent processing
tasks can be interrupted for running the ISRs, and a higher priority task preempts the running of lower priority
tasks.
‘An OS provides for process, memory, devices, IOs and file system management. A file system specifies
the ways in which a file is created, called, named, used, copied, saved or deleted, opened and-closed. File
system is the software for using the files on a disk, flash memory, memory card or memory stick.
OS software have scheduling functions for all the processes (tasks, ISRs and device drivers) in the
system. Since the running of the tasks and ISRs may have real time constraints and deadlines for finishing the
tasks, an RTOS is required in an embedded system. The RTOS provides the OS functions for coding the
system, provides interprocess communication functions and controls the passing of messages and signals to
a task.
RTOS functions are highly complex. There are a number of popular and readily available RTOSs.
Chapters 8 to 12 describes the RTOS functions and examples of applications in the embedded systems.24 | Embedded Systems
RTOS is used in most embedded systems and the system does concurrent processing of multiple tasks
when the tasks have real time constraints and deadlines.
1.4.7 Software for Device Drivers and Device Management in an
Operating System
‘An embedded system is designed to perform multiple functions and has to control multiple physical and
virtual devices. In an embedded system, there may be number of physical devices. Exemplary physical devices
are timers, keyboards, display, flash memory, parallel ports and network cards.
A program is also be developed using the concept of virtual devices. Examples of virtual devices are as
follows.
1. A file (of records opened, read, written and closed, and saved as a stream of bytes or words)
2. A pipe (for sending and receiving a stream of bytes from a source to destination)
3. A socket (for sending and receiving a stream of bytes between the client and server software and
between source and destination computing systems)
4. ARAM disk (for using the RAM in a way similar to files on the disk)
A file is a data structure (or virtual device) which sends the records (characters or words) to a data sink (for
example, a program function) and which stores the data from the data source (for example, a program function).
A file in a computer may also be stored in the hard disk and in flash memory in embedded system.
The term virtual device follows from the analogy that just as a keyboard gives an input to the processor for
a read, a file also gives an input to the processor. The processor gives an output to a printer for a write.
Similarly, the processor writes an output to the file.
‘A device for the purpose of control, handling, reading and writing actions can be taken as consisting of
three components. (i) A control register or word that stores the bits that, on setting or resetting by a device
driver, control device actions. (ii) A status register or word that provides the flags (bits) to show the device
status to the device driver. (ili) A device mechanism that controls the device actions. There may be input and
output data buffers in a device, which may be written or read by a device driver. Device driver actions are to
get input into or send output from the control registers, input data buffers, output data buffers and status
registers of the device.
‘A device driver is software for opening, connecting or binding, reading, writing and closing or controlling
actions of the device. It is software writen in a high level language. It controls functions for device open
(configure), connect, bind, listen, read or write or close. The device driver executes after the programming of
the control register (or word) of a peripheral or virtual device. The programming is called device initialisation
or registration or attachment. The driver reads the status register, gets the inputs and writes the outputs. It
executes on an interrupt to or from the device.
A driver controls three functions. (i) Initializing, which is activated by placing appropriate bits at the
control register or word. (ii) Calling an ISR on interrupt or on setting a status flag in the status register and
running (driving) the ISR (Interrupt Handler Routine). (iii) Resetting the status flag after an interrupt service.
A driver may be designed for asynchronous operations (multiple use by tasks one after another) or synchronous
‘operations (concurrent use by the tasks).
Using the functions of the OS, a device driver coding can be made such that the underlying hardware is
hidden as much as possible. An API then defines the hardware separately. This makes the driver usable when.
the device hardware changes in a system.Introduction to Embedded Systems 25
A device driver accesses a parallel or serial port, keyboard, mice, disk, network, display, file, pipe and
socket at specific addresses. An OS also provides device driver codes for system-port addresses and for
hardware access mechanisms.
A device manager software provide codes for detecting the presence of devices, for initializing these and
for testing the devices that are present. The manager includes software for allocating and registering port (in
fact, it may bea register or memory) addresses for the various devices at distinctly different addresses, including
codes for detecting any collision between these, if any. It ensures that any device accesses to one task only at
any given instant. It takes into account that virtual devices may also have addresses that are allocated by the
manager.
‘An OS also provides and executes modules for managing devices that associate with an embedded system
‘The underlying principle is that at an instant, only one physical or virtual device should get access to or from
one task only.
Sections 4.2.4 and 8.6.1 will describe device drivers and device management in detail. The OS also
provides and manages virtual devices such as pipes and sockets. Sections 7.14 and 7.15 describe these in
detail
For designing embedded-software, two types of devices are considered: physical and virtual. Physical
devices include keypad, printer or display unit. A virtual device could be a file or pipe or socket or RAM
disk. Device drivers and device manager software are needed in the system. The RTOS includes device-
drivers and a device manager to control and facilitates the use of the number of physical and virtual
devices in the system.
1.4.8 Software Tools for Designing an Embedded System
Table 1.2 lists the applications of software tools for assembly language programming, high level language
programming, RTOS, debugging and system integration.
Table 1.2 Software modules and tools for designing of an embedded system
Software Tools ‘Application
Editor For writing C codes or assembly mnemonics using the keyboard of the PC for entering the
program. Allows the entry, addition, deletion, insert, appending previously written lines or
files, merging record and files at the specific positions. Creates a source file that stotes the
edited fle. I also has an appropriate name [provided by the programmer],
Interpreter For expression-by-expression (line-by-line) translation to machine-executable codes.
Compiler Uses the complete set of codes. It may also include codes, functions and expressions from
the library routines. It creates a file called object file.
Assembler For translating assembly mnemonics into binary opcodes (instructions), that is, into
an executable file called binary file and for making a list file that can be printed. The list
file has address, source code (assembly language mnemonics) and hexadecimal object,
codes. The file has addresses that reallocate during the actual run of the assembly
language program.
(Contd)Embedded Systems
Software Tools Application
Cross assembler For converting object cades of executable codes for a processor to other codes for another
prodessor and vice versa. The cross-assembler assembles the assembly codes of the target
processor as the assembly codes of the processor of the PC used in system development.
Later, it provides the object codes for the target processor. These codes will be the ones
actually needed in the final developed system,
Simulator To simulate all functions of an embedded system circuit including that or additional memory
and peripherals. is independent of a particular target system, It also simulates the processes
that will execute when the codes of a particular processor execute.
Source-code For soutve code comprehension, navigation and browsing, editing, debugging, configuring
engineering software (disabling and enabling the C++ features) and compiling
RTOS Refer Chapters 8 t0 10,
Stethoscope For dynamically racking the changes in any program variable or parameter. Itdemonstrates
the pequence of multiple processes (tasks, threads, service routines) that execute and also
records the entire time history.
‘Trace scope To belp in tracing the changes in modules and tasks with time on the X-axis. A list of
actions also produces the desired time scales and the time expected to be taken for different
tasks,
Integrated development ‘This is a development software and hardware environment that consists of simulators with
environment editors, compilers, assemblers, RTOS, debuggers, stethoscope, tracer, emulators, logie
analyzers, and application code burners in PROM or flash.
Prototyper: This simulates and does source code engineering including compiling, debugging and,
browsing and summarizing the complete status of the final target system during the
development phase.
Locator* This uses a cross-assembler output and a memory allocation map and provides the locator
program output as a hex-file. It is the final step of the software design process or an
embedded system.
* The locator program ouiput isin the Intel hex fle or Motorola S-resord fort.
Software tools are used to software for designing an embedded system. Debugging tools, such as a
stethoscope, trace scope, And sophisticated tools such as an integrated development environment
and prototype development tools, are needed for the integrated development of system software and hardware.
1.4.9 Software Tools Required in Exemplary Cases
Table 1.3 gives the various tools needed to design exemplary systems.
RTOS is essential in most embedded systems to process multiple tasks and ISRs. Embedded systems for
medium scale and sophisticated applications need anumber of sophisticated software and debugging tools.Introduction to Embedded Systems
Table 1.3 Software tools required in exemplary systems.
Software ‘Automatic Data Robot Mobile ‘Adaptive Voice
Tools Chocolate Acquisition ‘Phone Cruise Control Processor
Vending System System with
Machine String Stability!
Eaitor Yes Yes Yes Yes Yes NR
Interpreter Yes NR Yes NR NR NR
Compiler Yes Yes Yes Yes Yes Yes
Assembler Yes Yes Yes No No No
Cross Assembler NR Yes Yes No No No
Locator ‘Yes Yes Yes Yes Yes Yes
Simulator NR Yes ‘Yes Yes Yes ‘Yes
Source code engineering NR NR NR Yes Yes ‘Yes
software
RTOS ‘Yes MR Yes Yes Yes Yes
Stethoscope NR NR NR Yes ‘Yes Yes
Trace scope NR NR NR Yes ‘Yes Yes
Integrated development NR Yes Yes Yes Yes Yes
environment
Prototyper NR No No Yes ‘Yes Yes
‘Note: NR means not required. MR means may be required in a specific complex system but not compulsorily needed.
EXAMPLES OF EMBEDDED SYSTEMS
Embedded systems have very diversified applications. A few select application areas of embedded systems
are telecommunications, smart cards, missiles and satellites, computer networking, digital consumer electronics,
and automotives. Figure 1.9 shows the applications of embedded systems in these areas.
A few examples of small scale embedded system applications are as follows:
1, Point of sales terminals: automatic chocolate vending machine
2. Stepper motor controllers for a robotics system
3. Washing or cooking systems
4. Multitasking toys
5. Microcontroller-based single or multidisplay digital panel meter for voltage, current, resistance and
frequency
6. Keyboard controller
7. SD, MMI and network access cards
&. CD drive or hard disk drive controllerTENNER
%
10.
Me
ee
13.
14.
15.
16.
17.
18.
19.
The peripheral controllers of a computer, for example, a CRT display controller, a keyboard controller,
aDRAM controller, aDMA controller, a printer controller, a laser printer controller, a LAN controller,
a disk drive controller
Fax or photocopy or printer or scanner machine
Remote (controller) of TV
Telephone with memory, display and other sophisticated features
Telecom ‘Smart Missiles and
Cards Satellites
fs]
es)
= Mobile Computing = Defence
- Mobile Accoss ; Aerospace
= Communication
la) (oe
‘Computer Networking ‘Automotive
Syeteon und Porphela
—_—
~ Motor Control System
= Networking Systems, -DVDs :
“Image pressing =Settop sores ~ EngmerBody Saety
ren “High defnition TVs. Rees
= Networks Cards Digital cameras ioe
= Monitors nd Displays = Car Muttineda,
@ @ 0
Fig. 1.9 Applications of the embedded systems in various areas
‘Motor controls systems—for example, an accurate control of speed and position of the d.c. motor,
robot and CNC machine; automotive applications such as closed loop engine control, dynamic ride
control, and an antilock braking system monitor
Electronic data acquisition and supervisory control system
Electronic instruments, such as an industrial process controller
Electronic smart weight display system and an industrial moisture recorder cum controller
Digital storage system for a signal wave form or for electric or water meter reading system
Spectrum analyzer
Biomedical systems such as an ECG LCD display cum recorder, a blood-cell recorder cum analyzer,
and a patient monitor system
Some examples of mediwn scale embedded systems are as follows:Introduction to Embedded Systems 29
20. Computer networking systems, for example, a router, a front-end processor in a server, a switch, a
bridge, a hub and a gateway
21. For Internet appliances, there are numerous application systems (i) An intelligent operation,
administration and maintenance router (1OAMR) in a distributed network and (ii) Mail client card to
store e-mail and personal addresses and to smartly connect to a modem or server
22. Entertainment systems such as a video game and a music system
23. Banking systems, for example, bank ATM and credit card transactions
24, Signal tracking systems, for example, an automatic signal tracker and a target tracker
25. Communication systems such as amobile communication SIM card, a numeric pager, acellular phone,
a cable TV terminal and a FAX transceiver with or without a graphic accelerator
26. Image filtering, image processing, pattern recognizer, speech processing and video processing
27. Video games
28. A system that connects a pocket PC to the automobile driver mobile phone and a wireless receiver.
‘The system then connects to a remote server for Internet or e-mail or to a remote computer at an ASP
(application service provider)
29. A personal information manager using frame buffers in handheld devices
30. Thin client [A thin client provides disk-less nodes with remote boot capability]. Application of thin-
client accesses to a data centre from a number of nodes; in an Internet laboratory accesses to the
Internet leased line through a remote server.
31, Embedded firewall / router using ARM7/ multiprocessor with two Ethemet interfaces and interfaces
support to PPP, TCP/IP and UDP protocols.
Examples of sophisticated embedded systems are as follows:
32. Mobile smart phones and computing systems
33. Mobile computer
34, Embedded systems for wireless LAN and for convergent technology devices
35. Embedded systems for video, interactive video, broadband IPV6 (Internet Protocol version 6) Internet
and other products, real time video and speech or multimedia processing systems
36. Embedded interface and networking systems using high speed (400 MHz plus), ultra high speed
(10 Gbps) and a large bandwidth: Routers, LANs, switches and gateways, SANs (Storage Area
Networks), WANs (Wide Area Networks)
37. Security products and high-speed Network security. Gigabit rate encryption rate products
- rg
4.6. EMBEDDED SYSTEM-ON-CHIP (SoC) AND USE OF VLSI CIRCUIT
DESIGN TECHNOLOGY
Lately, embedded systems are being designed on a single silicon chip, called System on chip (SoC), a design
innovation. SoC is a system on a VLSI chip that has all the necessary analog as well as digital circuits,
processors and software.
‘A SoC may be embedded with the following components:
1. Embedded processor GPP or ASIP core,
2. Single purpose processing cores or multiple processors,
3. A network bus protocol core,
4. An encryption function unit,f Embedded Systems,
Discrete cosine transforms for signal processing applications,
Memories,
Multiple standard source solutions, called IP (Intellectual Property) cores,
Programmable logic device and FPGA (Field Programmable Gate Array) cores,
9. Other logic and analog units.
An exemplary application of such an embedded SoC is the mobile phone. Single purpose processors,
ASIPs and IPs on an SoC are configured to process encoding and deciphering, dialing, modulating,
demodulating, interfacing the key pad and multiple line LCD matrix displays or touch screen, storing data
input and recalling data from memory, Figure 1.10 shows an SoC that integrates internal ASICs, internal
processors (ASIPs), shared memories and peripheral interfaces on a common bus. Besides a processor,
memories and digital circuits with embedded software for specific applications, the SoC may possess analog
circuits as well.
ASYSTEMON CHIP
[SINGLE PURPOSE! BUSES
PR r
DIGITAL
CIRCUITS-
TIMER,
MUXs,....
DATA ADDRESS |
GENERATOR.
| PROGRAM
i PROGRAM,
ADDRESS | DATA
GENERATOR | ‘AND PORT : -
oo MEMORY | INTERRUPT
| CONTROLLER |
ANALOG
CIRCUITS,
{ GPP '
>
~ 15-20% ~ 60% ~20-25%
AREA AREA AREA
Fig. 1.10 ASoCembedded system and its common buswith internal ASIPs, internal processors,
IPs, shared memories and peripheral interfacesIntroduction to Embedded Systems ‘ . (31)
1.6.1 Application Specific IC (ASIC)
ASICS are designed using the VLSI design tools with the processor GPP or ASIP and analog circuits embedded
into the design. The designing is done using the Electronic Design Automation (EDA) tool. {For design of an
ASIC, a High-level Design Language (HDL) is used).
1.6.2 IP Core
On a VLSI chip, there may be integration of high-level components. These components possess
gate-level sophistication in circuits above that of the counter, register, multiplier, floating point operation unit
and ALU. A siandard source solution for synthesizing a higher-level component by configuring an FPGA
core or a core of VLSI circuit may be available as an Intellectual Property, called (IP). The designer or the
designing company holds the copyright for the synthesized design of a higher-level component for gate-level
implementation of an IP. One might have to pay royalty for every chip shipped. An embedded system may
incorporate several IPs.
+ An IP may provide hardwired implementable design of a transform, an encryption algorithm or a
deciphering algorithm.
+ An IP may provide a design for adaptive filtering of a signal.
+ An IP may provide a design for implementing Hyper Text Transfer Protocol (HTTP) or File Transfer
Protocol (FTP) or Bluetooth protocol to transmit a web page or a file on the Internet.
+ An IP may be designed for a USB or PCI bus controller. (Sections 3.10.3 and 3.12.2]
1.6.3 FPGA Core with Single or Multiple Processors
‘Suppose an embedded system is designed with a view to enhancing functionalities in future. An FPGA
core is then used in the circuits. It consists of a large number of programmable gates on a VLSI chip. There is
asset of gates in each FPGA cell, called macro cell. Each cell has several inputs and outpats. All cells interconnect
like an array (matrix). Each interconnection is programmable through the associated RAM in an FPGA
programming tool. An FPGA core can be used with a single or multiple processor.
Consider the algorithms for the following: Fourier transform (FT) and its inverse (IFT), DFT or Laplace
transform and its inverse, compression or decompression, encrypting or deciphering, specific pattem recognition
(for recognizing a signature or finger print or DNA sequence). We can configure an algorithm into the logic
gates of FPGA. It gives hardwired implementation for a processing unit. It is specific to the needs of the
‘embedded system. An algorithm of the embedded software can implement in one of the FPGA sections and
another algorithm in its other section
FPGA cores with a single or multiple processor units on chip are used. One example of such core is
Xilinx Virtex-Il Pro FPGA XC2VP125. XC2VP125 from Xilinx has 125136 logic cells in the FPGA core
with four IBM PowerPCs. It has been used as a data security solution with encryption engine and data rate
of 1.5 Gbps. Other examples of embedded systems integrated with logic FPGA arrays are DSP-enabled,
real-time video processing systems and line echo eliminators for the Public Switched Telecommunication
‘Networks (PSTN) and packet switched networks. [A packet is a unit of a message or a flowing data
such that it can follow a programmable route among the number of optional open routes available at an
instance,]“1.7. “COMPLEX SYSTEMS DESIGN AND PROCESSORS
1.7.1 Embedding a Microprocessor
A General Purpose Processor microprocessor can be embedded on a VSLI chip. Table 1.4 lists different
streams of microprocessors embedded in a complex system design.
Table 1.4 Important microprocessors used in embedded systems
Microprocessor: Family Source CISC or RISC or Both features
68HCxxx Motorola cise
Stream 2 80x86 Intel cisc
Stream 3 SPARC Sun RISC
Stream 4 ARM ARM RISC with CISC functionality
1.7.2 Embedding a Microcontroller
Microcontroller VLSI cores or chips for embedded systems are usually among the five streams of families
given in Table 1.5.
Table 1.5 Major microcontrollers® used in the embedded systems
‘Stream ‘Microcontrolier Family Source CISC or RISC or Both
Stream 1 68HCIIxx, HC12xx, HCL6xx Motorola cise
Stream 2 8051, 8051MX Intel, Philips cise
Stream 3 PIC 16F84 or 16C76, 16F876 and PICI8. Microchip cise
Steam 4’ Microcontroller Enhancements of CORTEX-M3_ ARM, Texas, Philips, RISC Core with.
ARM9/ARM7 from Philips, Samsung and ‘Samsung and ST CISC functionality
ST Microelectronics M
electronics ete
Other popular microcontrollers are as follows. (i) Hitachi H8x family and SuperH 7xxx. (ii) Mitsubishi 740, 7700, MI6C and
M32C families. (i) National Semiconductor COPS and CR16 /16C. (iv) Toshiba TLCS 900S (v) Texas Instruments MSP 430
for low voltage battery based system. (vi) Samsung SAMB. (vii) Ziglog 280 and eZ80
1.7.3 Embedding a DSP
A digital signal processor (DSP) is a processor core or chip for the applications that process digital signals.
[For example, filtering, noise cancellation, echo elimination, compression and encryption applications. } Just
as a microprocessor is the most essential unit of a computing system, a DSP is essential unit of an embeddedIntroduction to Embedded Systems. (33)
system in a large number of applications needing processing of signals. Exemplary applications are in image
processing, multimedia, audio, video, HDTV, DSP modem and telecommunication processing systems. DSPs
also find use in systems for recognizing image pattern or DNA sequence.
DSP as an ASIP is a single chip or core in a VLSI unit. It includes the computational capabilities of a
microprocessor and Multiply and Accumulate (MAC) units. A typical MAC has a 16 x 32 MAC unit
DSP executes discrete-time, signal-processing instructions. It has Very Large Instruction Word (VLIW)
processing capabilities; it processes Single Instruction Multiple Data (SIMD) instructions; it processes Discrete
Cosine Transformations (DCT) and inverse DCT (IDCT) functions. The latter are used in algorithms for
signal analyzing, coding, filtering, noise cancellation, echo elimination, compressing and decompressing, etc.
‘Major DSPs for embedded systems are from the three streams given in Table 1.6.
Table 1.6 Important digital signal processor® used in the embedded systems
DSP Famil
TMS320Cxx, OMAP!
Tiger SHARC Analog Device
Stream 3 Motorola
Stream 4 PNX 1300, 1500? Philips
"For example, TMS320C62XX a fixed point 200 MHz DSP (Section 2.3.5).
2Media processor, which besides multimedia DSP operations, also does network stream data packet processing,
1.7.4 Embedding an RISC
A RISC microprocessor provides the speedy processing of instructions, each in a single clock-cycle. This
facilitates pipelining and superscalar processing. Besides greatly enhanced capabilities mentioned above,
there is great enhancement of speed by which an instruction from a set is processed. Thumb® instruction set
is a new industry standard that also gives a reduced code density in ARM RISC processor. RISCs are used
when the system needs to perform intensive computation, for example, in a speech processing system.
1.7.5 Embedding an ASIP
ASIP is a processor with an instruction set designed for specific application areas on a VLSI chip or core.
ASIP examples are microcontroller, DSP, IO, media, network or other domain-specific processor.
Using VLST design tools, an ASIP with instructions sets required in the specific application areas can be
designed. The ASIP is programmed using the instructions of the following functions: DSP, control signals
processing, discrete cosine transformations, adaptive filtering and communication protocol-implementing functions.
1.7.6 Embedding a Multiprocessor or Dual Core Using GPPs
In an embedded system, several processors or dual core processors may be needed to execute an
algorithm fast within a strict deadline. For example, in real-time video processing, the number of MAC
operations needed per second may be more than is possible from one DSP unit. An embedded system
then incorporates two or more processors running in synchronization. An example of using multiple ASIPs
is high-definition television signals processing. [High definition means that the signals are processed
for a noise-free, echo-cancelled transmission, and for obtaining a flat high-resolution image (1920 x 1020
pixels) on the television screen. A cell phone or digital camera is another application with multiple ASIPs.Embedded Systems
In a cell phone, a number of tasks have to be performed: (a) Speech signal-compression and coding.
(b) Dialing (c) Modulating and Transmitting (d) Demodulating and Receiving (e) Signal decoding and
decompression (f) Keypad interface and display interface handling (g) Short Message Service (SMS) protocol-
based messaging (h) SMS message display. For all these tasks, a single processor does not suffice. Suitably
synchronized multiple processors are used.
Consider a video conferencing system. In this system, a quarter common intermediate format—Quarter-
CIF—is used. The number of image pixels is just 144 x 176 as against 525 x 625 pixels in a video picture on
TV. Even then, samples of the image have to be taken at a rate of 144 x 176 x 30 = 760320 pixels per second
and have to be processed by compression before transmission on a telecommunication or Virtual Private
Network (VPN). [Note: The number of frames are 25 or 30 per second (as per the standard adopted) for real-
time displays and in motion pictures.] A single DSP-based embedded system does not suffice to get real-time
images during video conferencing. Real-time video processing and multimedia applications most often need
a multiprocessor unit in the embedded system.
Multiple processors or dual core processors are used when a single microprocessor does not meet the
needs of the different tasks that execute concurrently. The operations of all the processors are synchronized
to obiain optimum performance.
1.7.7 Embedded Processor/Embedded Microcontroller
‘An embedded processor is a processor with special features that allow it to embed multiple processes into the
system.
Real time image processing and aerodynamics are two areas where fast, precise and intensive calculations
and fast context switching (from one program to another) are essential. Embedded processor is the
term sometimes used for processor that has been a specially designed such that it has the following
capabilities:
1, Fast context switching and thus lower latencies of the tasks in complex real time applications.
[Section 4.6] Fast context switching means that the calling program or interrupted service routine CPU
registers save and retrieve fast [Section 4.6].
2. 32-bit or 64-bit atomic addition and multiplication, and no shared data problem in the operations with
large operands with each operand placed in two or four registers. [Section 7.8.1]
3. 32-bit RISC core for fast, more precise and intensive calculations by the embedded software.
Embedded microcontroller is the term sometimes used for specially designed microcontrollers that have
the following capabilities:
1. When a microcontroller has internal RAM, large flash or ROM, timer, interrupt handler, devices and
peripherals and there is no external memory or device or peripheral required for the given application,
2. Fast context switching and thus lower latencies of the tasks in complex real time applications. For
example, ARM and 68HC1x microcontrollers save all CPU registers fast
An embedded processor is term used for processors with fast processing, fast context-switching and atomic
ALU operations. An embedded microcontroller is the term used for a microcontroller that has internal
RAM, large flash or ROM, timer, interrupt handler, internal devices and internal peripherals and there is no
external memory or device or peripheral required for the given application.Introduction to Embedded Systems
(=)
Complex System Embedded Processors Table 1.7 gives different processors that can embed in a
complex system.
Table 1.7 Processors in complex embedded systems
Processor ‘Application ‘Advantage
General Purpose ‘When intensive No engineering cost for Additional redundant
Microprocessor computations are designing the processor. execution units that are
required, caches are used not needed in the given
and pipeline and system design
superscalar operations
are needed and large
embedded software is to
be located in the external
‘memory cores or chips.
Microcontroller Used with internal No engineering cost for Additional
‘memory, devices and designing the processor manufacturing costs and.
peripherals and when with internal memory, redundant application
embedded software is to. devices and peripherals. units which are not
be located in the internal needed in the given
ROM or flzsh. system design.
DsP Used with signal No engineering cost ‘Manufacturing cost may
processing-related involved for designing be high.
instructions for filters, the signal processor.
image, audio, and video
and CODEC operations.
Single purpose Control 10 and bus ‘They support other In-house engineering
processors and operations and processing units in the cost of development,
application specific peripherals and devices. system and execute royalty payments for an
system processor specific hardware IP core of processor and
processes fast. time-to-market cost.
Dual core processor To significantly enhance ‘Reduced engineering Manufacturing cost, as
the perforniance of the cost. dual core processors are
system. costly.
‘Accelerator To accelerate the Increases performance by Engineering cost of
execution of codes. A co-processing with the development or royalty
floating point main processor. payments for IP core of
‘coprocessor accelerates processor and time-to-
‘mathematical operations market cost.
and Java accelerator
accelerates Java code
execution,Embedded Systems
A DSP for mobile phones, for example, OMAP of Texas Instruments, uses the effective power dissipation
methods of dynamic switching both for power supply voltage and operating frequency of the CPU core.
For a number of applications, the DSPs cores may not suffice. Domain specific ASIPs have specific
instruction sets. For IOs, network, media or security applications, smart card, video game, palm top computer,
cell phone, mobile-Internet, hand-held embedded systems, Gbps transceivers, Gbps LAN systems, satellite or
missile systems, we need special processing units ina VLSI circuit designed to function as a processor with
an instruction-set for programmability. These special units are called domain-specific ASIP.
1.7.8 Embedding ARM processor
Examples of Stream 4 GPPs in Table 14 are ARM 7 and ARM 9. The core of these processors can be
embedded onto a VLSI chip or an SoC. An ARM-processor VLSI-architecture is available either as a CPU
chip or for integrating it into VLSI or SoC. ARM, Intel and Texas Instruments and several other companies
have developed such processors. ARM provides CISC functionality with RISC architecture at the core. The
cores of ARM7, ARMQ and their DSP enhancements are available for embedding in systems, [Refer to http:/
‘wwwatiscom/sc/ docs/asic/modules/arm7.htm and arm9.htm).
ARM integrates with other features (for example DSP) in new GPPs, which are available from several
sources, for example, Intel and Texas Instruments. Exemplary ARM 9 applications are setup boxes, cable
modems, and wireless-devices such as mobile handsets.
ARM9 has a single cycle 16 x 32 multiple accumulate unit. It operates at 200 MHz. It uses 0.15 um GS30
CMOSs. It has a five-stage pipeline. It incorporates RISC core with CISC functions. It integrates with a DSP
when designed for an ASIC solution. An example is its integration with DSP is TMS320C55x from Texas
Instruments. [Refer to http:/www.ti.com/sc/docs/asic/modules/arm7 htm and arm9.htm]
A lower performance but very popular version of ARM9 is ARM7. It operates at 80 MHz. Ituses 0.18 um
based GS20 jm CMOSs. Using ARM7, ARM9 and CORTEX-M3, a large number of embedded systems
have recently become available.
Lately, a new class of embedded systems has emerged that additionally incorporates ASSP chips or cores
in its design.
1.7.9 Embedding ASSP
‘Assume that there is an embedded system for real-time video processing. Real-time processing arises for
digital television, high definition TV decoders, set-up boxes, DVD (Digital Video Disc) players, web phones,
video-conferencing and other systems. An ASSP that is dedicated to these specific tasks alone provides a
faster solution. The ASSP is configured and interfaced with the rest of the embedded system.
Assume that there is an embedded system that using a specific protocol interconnects, its units through
specific bus architecture to another system. Also, assume that suitable encryption and decryption is required.
[The output bit stream encryption protects messages or design from passing to an unknown external entity.)
For these tasks, besides embedding the software, it may also be necessary to embed some RTOS features
[Section 1.4.6}. If the software alone is used for the above tasks, it may take a longer time than a hardwired
solution for application-specific processing. An ASSP chip provides such a solution. For example, an ASSP
chip [from i2Chip (http://wwwi2Chip.com)] has a TCP, UDP, IP, ARP and Ethernet 10/100 MAC (Media Access
Control) hardwired logic included into it. The chip from i2Chip, W3100A, is a unique hardwired Internet
connectivity solution. Much needed TCP/IP stack processing software for networking tasks is thus available as
a hardwired solution. This gives output five times faster than a software solution using the system’s GPP. It is
also an RTOS-less solution. Using the same microcontroller in the embedded system to which this ASSP chipIntroduction to Embedded Systems 37
interfaces, Ethemet connectivity can be added. Another ASSP, which is now available, is the ‘Serial-to-Ethernet
Converter (1IM7100). It does real-time data processing by a hardware protocol stack. It needs no change in the
application software or firmware and provides the most economical and smallest RTOS-solution.
‘An ASSPis used as an additional processing unit for running application specific tasks in place of processing
using embedded software.
“1.8 ~ DESIGN PROCESS IN EMBEDDED SYSTEM
The concepts used during a design process are as follows.
8.
Abstraction: Each problem component is first abstracted. For example, in the design of a robotic
system, the problem of abstraction can be in terms of control of arms and motors.
Hardware and Software architecture: Architectures should be well understood before a design.
Extra functional Properties: Extra functionalities required in the system being developed should
be well understood from the design.
System Related Family of designs: Families of related systems developed earlier should be
taken into consideration during designing.
Modular Design: Modular design concepts should be used. System designing is fast by
decomposition of software into modules that are to be implemented. Modules should be such that they
can be composed (coupled or integrated) later. Effective modular design should ensure effective (i)
function independence, (ii) cohesion and (iii) coupling.
(@) Modules should be clearly understood and should maintain continuity.
(b) Also, appropriate protection strategies are necessary for each module. A module is not permitted
to change or modify another module functionality. For example, protection from a device driver
modifying the configuration of another device.
Mapping: Mapping into various representations is done from software requirements. For example,
data flow inthe same path during the program flow can be mapped together as a single entity. Transform
and transaction mapping design processes are used in designing. For example, an image is input data
to a system; it can have a different number of pixels and colours. The system does not process each
pixel and colour individually. Transform mapping of image is done by appropriate compression and
storage algorithms. Transaction mapping is done to define the sequence of images.
User Interface Design: Userinterface designis an important part of design. User interfaces are designed
as per user requirements, analysis of the environment and system functions. For example, in an automatic
chocolate vending machine (ACVM) system, the user interface is an LCD multiline graphics display. It
can display a welcome message as well as specify the coins needed to be inserted into the machine for
cach type of chocolate. The same ACVM may be designed with touchscreen User Interface (GUD), or it
may be designed with Voice User Interfaces (VUIs). Any of these interface designs has to be validated by
the customer. For example, the ACVM customer who installs the machine must validate message language
and messages to be displayed before an interface design can proceed to the implementation stage.
Refinements: Each component and module design needs to be refined iteratively till it becomes the
‘most appropriate for implementation by the software team.
‘The software design process may require use of Architecture Description Language (ADL). It is used for
representing the following: (i) Control Hierarchy (ii) Structural Partitioning (iii) Data Structure and Hierarchy
(iv) Software Procedures.Figure 1.11 shows the activities for software-design cycle during an embedded ‘software-development
process and the cycle may be repeated till tests show the verification of specifications.
Development
Process:
Model /Analyse 1
Requirements of
System
} |
| Design
I Data Structure, Software 2
‘Architecture, Interfaces
‘and Algorithms Linear
Life = ‘Sequence
oye J {
Implementation
‘of Design 3
z
| Intemal logic and
Extemal functions 4
Fig. 1.11 Activities for software design during an embedded software-development process
1.8.1 Design Metrics
A design process takes into account design metrics. There aré several design metrics for an embedded system,
and these are listed in Table 1.8,
1.8.2 Abstraction of Steps in the Design Process
A design process is called bottom-to-top design if it builds by starting from the components. A design process
is called top-to-down design if it first starts with abstraction of the process and then after abstraction the
details are created. Top-to-down design approach is the most favoured approach. The following lists the five
levels of abstraction from top to bottom in the design process:Introduction to Embedded Systems
(1) Requirements: Defi
n and analysis of system requirement. It is only by a complete clarity of
therequired purpose, inputs, outputs, functioning, design metrics (Table 1.8) and validation requirements
for finally developed systems specifications that a well designed system can be crested. There has to
be consistency in the requirements.
Table 1.8 Design metrics used in the embedded systems
Design Metrics
Power Dissipation
Performance
Process deadlines
User interfaces
Size
Engineering cost
Manufacturing cost
Fran
Description
For many sysicms, particularly battery operated sysiems, such as mobile phone or digital
camera the power consumed by the system is an important feature. The battery needs to be
recharged less frequently if power dissipation is small.
Instructions execution time in the system measures the performance. Smaller execution
time means higher performance. For example, a mobile phone, voice signals processed
between antenna and speaker in 0.18 shows phone performance. Consider another. For
example, a digital camera, shooting a 4M pixel still image in 0.5s shows the camera
performance.
‘There are number of processes in the system, for example, keypad input processing, graphic
display refresh, aucio signals processing and video signals processing, These have deadlines
within which each of them may be required to finish computations and give results.
‘These include keypad GUIs and VUIs.
‘Size of the system is measured in terms of (i) physical space required, (ii) RAM in kB and
internal flash memory requirements in MB or GB for running the software and for data
storage and (ii) number of million logic gates in the hardware.
Initial cost of developing, debugging and testing the hardware and software is called
engineering cost and is a one-time non-recurring cost.
Cost of manufacturing each unit,
Flexibility in design enables, without any significant engineering cost, development of
different versions of a product and advanced versions later on. For example, software
enhancement by adding extra functions necessitated by changing environment and software
‘Time taken in days or months after prototype development to put a product for users and
consumers.
System safety in terms of accidental fall from hand or table, theft (¢.g.. a phone locking
ability and tracing ability) and in terms of user safety when using a product (for example,
automobile brake or engine).
Maintenance means changeability and additions to the system; for example, adding orupdating
software, data and hardware. Example of software maintenance is additional service or
functionality software, Example of data maintenance is additional ring-tones, wallpapers,
vvideo-clips in mobile phone or extending card expiry date in case of smart card. Example of
hardware maintenance is additional memory or changing the memory stick in mobile computerenn Se
(2) Specifications: Clear specifications of the required system are must. Specifications need to be
precise. Specifications guide customer expectations from the product. They also guide system
architecture. The designer needs specifications for (i) hardware, for example, peripherals, devices
processor and memory specifications, (ji) data types and processing specifications, (iii) expected system
behaviour specifications, (iv) constraints of design, and (v) expected life cycle specifications. Process
specifications are analysed by making lists of inputs on events, outputs on events and how the processes
activate on each event (interrupt).
(3) Architecture: Data modeling designs of attributes of data structure, data flow graphs (Section 6.2),
program models (Section 6.1), software architecture layers and hardware architecture are defined.
Software architectural layers are as follows:
1. The first layer is an architectural design. Here, a design for system architecture is developed. The
question arises as to how the different elements—data structures, databases, algorithms, control
functions, state transition functions, process, data and program flow—are to be organised.
2. The second layer consists of data-design. Questions at this stage are as follows. What design of
data structures and databases would be most appropriate for the given problem? Whether data
organised as a tree- like structure will be appropriate? What will be the design of the components
in the data? [For example, video information will have two components, image and sound.]
3. The third layer consists of interface design. Important questions at this stage are as follows. What
shall be the interfaces to integrate the components? What is the design for system integration?
‘What shalll be design of interfaces used for taking inputs from the data objects, structures and
databases and for delivering outputs? What will be the port structure for receiving inputs and
transmitting ourpuis?
(4) Components: The fourth layer is a component level design. The question at this stage is as follows.
‘What shall be the design of each component? There is an additional requirementin the design of embedded
systems, that each component should be optimised for memory usage and power dissipation. Components
of hardware, processes, interfaces and algorithms. The following lists the common hardware components:
1. Processor, ASIP and single purpose processors in the system
2. Memory RAM, ROM or internal and external flash or secondary memory in the system
3. Peripherals and devices internal and extemal to the system
4. Ports and buses in the system
5. Power source or battery in the system
During software development process we can model the components as object-oriented. Table 1.9 lists the
stages as components-based object-oriented software development process.
(5) System Integration: Built components are integrated in the system. Components may work fine
independently, but when integrated may not fullfil the design metrics. The system is made to function
and validated. Appropriate tests are chosen. Debugging tools are used to correct erroneous functioning.
Each component and its interface system is integrated after the design stage. Program implementation is in
a language and may use an integrated development environment (IDE), and source code engineering tools,
which should follow the model, software architecture and design specifications. Program simplicity should
be maintained during the implementation process.
The design stages range from abstraction to detailed designing to verification activities. Continuous
refinement in design can be made by effective communication between designers andimplementers. Software
design can be assumed to consist of four layers: architecture design, data design, interfaces design and
component level design.Introduction to Embedded Systems
Table 1.9 Components-based object-oriented software development process
Effort Activities Model Deficiency
Stage | Components that could be used in software development identified
Suge 2 Selection of available classes (single logically bonded groups) from & jee for robust interfaces
sofiware components resource library and slow development in
Stage 3 Sort components, which are available and reusable by re-engineering and case the reusable
Which are unavailable components are not
Stage 4 Re-engineer components and create unavailable components available in required
numbers
Stage 5 Construct software from the components and test them
Stage 6 __eratively construct till final validation of software
Actions at each step Research by software engineering experts have shown that on an average, a
designer needs to spend about 50% of the time for planning, analysis and design, 40% for testing, validation
and debugging and 10-15% on coding. Action required to be taken at each step in the design process is listed
in Table 1.10.
Table 1.10 Action to be taken at each step of design process
Design Metrics Description
Analysis Design is analyzed
Steps for improvement ‘The result of analysis is used to improve design to meet specifications and metrics
|
| Vercaion ‘System design must be verified to ensure that it meets the design metrics given in Table 1.8
1.8.3 Challenges in Embedded System Design: Optimizing Design Metrics
Following are the challenges that arise during the design process.
‘Amount and type of hardware needed: Optimizing the requirement of microprocessors, ASIPs and
single purpose processors in the system on the basis of performance, power dissipation, cost and other design
metrics are the challenges in a system design. A designer also chooses the appropriate hardware (memory
RAM, ROM orinternal and external flash or secondary memory, peripherals and devices internal and external
ports and buses and power source or battery) taking into account the design metrics given in Table 1.8; for
example, power dissipation, physical size, number of gates and the engineering, prototype development and
‘manufacturing costs.
Optimizing Power Dissipation and Consumption: Power, consumption during the operational and idle
state of system should be optimal. The following methods are used to meet the design challenges.
Clock Rate Reduction Power dissipation typically reduces 2.5 ,1W per 100 kHz of reduced clock rate.
So reduction from 8000 KHz to 100 kHz reduces power dissipation by about 200 wW, which is nearly similar
to when the clock is nonfunctional. [Remember, total power dissipated (energy required) may not reduce.
This is because on reducing the clock rate, the computations will take a longer time and total energy required
equals the power dissipation per second multiplied by computation time].Embedded Systems
‘The power 25 \W is typically the residual dissipation needed to operate the timers and few other units. By
‘operating the clock at a lower frequency or during the power-down mode of the processor, the advantages are
4s follows: (i) Power loss due to heat generation reduces. (ii) Radio frequency interference also reduces due
to the reduced power dissipation within the gates. [Radiated RF (Radio Frequency) power depends on the RF
current inside a gate, which reduces due to increase in ‘ON’ state resistance between drain and channel of
each MOSFET transistor and that reduces heat generation.
Voltage Reduction _Inportable or hand-held devices suchas a cellular phone, compared to 5 V operation,
CMOS circuit power dissipation reduces by one sixth, ~(2V/SV)?, in 2.0 V operation. Thus the time intervals
needed for recharging the battery increase by a factor of six.
Walt, Stop and Cache Disable instructions An embedded system may need to be run continuously,
without being switched off; the system design, therefore, is constrained by the need to limit power dissipation
while it is ON but is in idle state. Total power consumption by the system while in running, waiting and idle
states should be limited. A microcontroller must provide for executing Wait and Stop instructions for the
power-down mode. One way to reduce power dissipation is to cleverly incorporate into software the Wait and
Stop instructions. Another is to operate the system at the lowest voltage levels in the idle state and selecting
power-down mode in that state. Yet another methodis to disable use of certain structural units of the processor—
for example, caches—when not necessary and to keep in disconnected state those structure units that are not
needed during a particular software execution, for example timers or [0 units.
Operations can be performed at low voltage or reduced clock rate in order to control power dissipation, For
embedded system software, performance analysis during its design phase must also include the analysis of
power dissipation during program execution and during standby. An embedded system has to perform
tasks continuously from power-up to power-off and may even be kept ‘ON’ continuously. Clever real-time
programming by using ‘Wait’ and ‘Stop’ instructions and disabling certain units when not needed is one
method of saving power during program execu
Process Deadlines Meeting the deadline of all processes in the system while keeping the memory,
power dissipation, processor clock rate and cost at minimum is a challenge.
Flexibility and Upgrade ability Flexibility and upgrade ability in design while keeping the cost
minimum and without any significant engineering cost is a challenge. Flexibility and upgrade ability allow
different and advanced versions of a product to be introduced in the market later on.
Reliability . Designing a reliable product by appropriate design, testing and thorough verification, is a
challenge. The goal of testing is to find errors and to validate that the implemented software is as per the
specifications and requirements. Verification refers to an activity to ensure that specific functions are correctly
implemented. Validation refers to an activity to ensure that the system that has been created is as per the
requirements agreed upon at the analysis phase, and to ensure its quality.
{a9 FORMALIZATION OF SYSTEM DESIGN
Formalization of system design is done using a top-down approach by abstraction (Section 1.8.2) and by
© Detailing requirements and specifications of hardware and softwareIntroduction to Embedded Systems
Since a diagrammatic model clears the des
Defining architectures of hardware and software
Coding and implementation as per architecture
Testing, validation and verification of system
:n concepts better than abstraction, a modeling language, for
formalization can be used. The Universal Modeling Language (UML) is used. In UML, a designer describes
the following:
1
noyaen
“User Diagram’, “Object Diagram’, ‘Sequence Diagram’, ‘State Diagram’, ‘Class Diagram’ and
‘Activity Diagram’
Classes and Objects, which describe identity, attributes, components and behaviour
Inheritances of the classes and objects
Interfaces of the objects and their implementation at the objects
Structural description of the design components
Behavioral description in terms of states, state machine and signals (Section 6.3)
1. Events description
Section 6.5 will describe UML in detail. Chapters 11 and 12 will describe the model design examples in detail.
“40 DESIGN PROCESS AND DESIGN EXAMPLES
1.10.1 System Design Process Examples
Chapters 11 and 12 will describe design examples in detail.
1.10.2 Automatic Chocolate Vending Machine (ACVM)
Let us consider an automatic chocolate vending machine. This interesting example given here helps a reader
to understand several concepts of programming an embedded system as a multitasking system.
Figure 1.12 shows the diagrammatic representation of ACVM. Assume that ACVM has following
comp
1
2,
p
onents:
Ithas keypad on the top of the machine. That enables a child to interact with it when buying a chocolate.
‘The owner can also command and interact with the machine.
Ithas an LCD display unit on the top of the machine. It displays menus, text entered into the ACVM
and pictograms, welcome, thank you and other messages. It enables the child as well as the ACVM
owner to graphically interact with the machine. It also displays time and date. (For GUIs, the keypad
and LCD display units or touch screen are basic units.)
Ithas a coin insertion slot and a mechanical coin sorter so that child can insert coins to buy a chocolate.
It has a delivery slot so that child can collect the chocolate and coins, if refunded.
It has an Internet connection port using a USB based wireless modem so that owner can know status
of the ACVM sales from a remote location.
ACVM Functions Assume that ACVM functions are as follows:
‘The ACVM displays the GUIS and if the child wishes to enter contact information, birthday information
or get answer to FAQs, it displays the appropriate menu.
2. It displays a welcome message when in idle state. It also continuously displays time and date at the
right bottom corner of display screen. It can also intermittently display news, weather data or
advertisements or important information of interest during idle state.44 Embedded Systems
3. When first coin is inserted, a timer also starts. The child is expected to insert all required coins in
2 minutes.
4, After 2 minutes the ACVM will display a query to the child if the child does not insert sufficient coins,
Ii the query is not answered the coins are refunded.
5. Within 2 minutes if sufficient coins are collected, it displays the message, “Thanks, wait for few
moments please!”, delivers the chocolate through the delivery slot and displays message, ‘Collect the
chocolate and visit sgain, please!”
Hardware units —ACVM embeds the following hardware units.
1. Microcontroller or ASIP (Application Specific Instruction Set Processor)
RAM for storing temporary variables and stack
ROM for application codes and RTOS codes for scheduling the tasks
Flash memory for storing user preferences, contact data, user address, user date of birth, user
identification code, answers of FAQs
‘Timer and interrupt controller
A TCPIIP port (Internet broadband connection) to the ACVM for remote control and for the owner to
get ACVM status reports
7. ACVM specific hardware to sort coins of different denominations. Each denomination coin generates
asct of status and input bits and port-interrupts. Using an ISR for that port, the ACVM processor reads
the port status and input bits. The bits give the information about which coin has been inserted. After
each read operation, the status bits are reset by the routine
8. Power supply
| ee ieee LCD Display or Touch Screen for user
ieee] | Microcontroller based hardware
Coin Sorter eae sa ae ae GE | USB_Wireless_ |
RTOS Embedded Software Modern |
Fig. 1.12 Diagrammatic representation of the ACVM
Software components ACVM embeds the following software components:
Keypad input read task
Display task
Read coins task for finding coins sorted
Deliver chocolate task
TCPIIP stack processing task
TCPIIP stack communication task
aveepe
1.10.3 Smart Card
‘Smart card is one of the most used embedded system today. It is used for credit-debit bankcard, ATM card,
e-purse or e-Wallet card, identification card, medical card (for history and diagnosis details) and card for aIntroduction to Embedded Systems
number of new innovative applications. [Reader may refer to a frequently updated website, http://
[email protected] for the answers of frequently asked questions about cards.] The security aspect is of
Paramount importance for smart card use, when used for financial and banking-related transactions. (Reader
may refer to http:/www.home-hkstar.com/~alanchan/papers/smartCardSecurity/ and http://www-research.
ibm.com/secure_systems/scard.htm for details of the card-security requirements. ]
The smart card is a plastic card ISO standard dimensions, 85.60 x 53.98 x 0.80 mm. It is an embedded
system on a card: SoC (System-On-Chip). ISO recommended standards are ISO7816 (1 to 4) forhost-machine
contact-based cards and 18014443 (Part A or B) for the contactless cards. The silicon chip is just a few
multimeters in size and is concealed in-between the layers. Its very small size protects the card from bending.
Figure 1.13 shows embedded-system hardware components for a contactless smart card.
‘An Embedded System
Contactless Smart Card Components
[Rom EEPROM
(Application (ppication
and RTOS) Variables)
Lae
Data, Address, Contol Internal Buses
Identification
Account Number, Expiry Date, Card Number - agreed
Processor
Interfacing
] vO"
| Timer and 16 MHz Charge |'———|_Cireuit
Interrupt Controller Amplitude Pump
emp Co Shifted Circuit
Key Modulator |!
rcuit | t —a.—
——Z \
System Power Suppy _—_‘Transce'ver Antenna
‘oncard
Fig. 1.13 Embedded hardware components in a contact less smart card
Embedded Hardware The embedded hardware components are as follows:
» Microcontroller or ASIP
» RAM for temporary variables and stack
One time programmable ROM for application codes and RTOS codes for scheduling the tasks
Flash for storing user data, user address, user identification codes, card number and expiry date
‘Timer and interrupt controller
A carrier frequency ~16 MHz generating circuit and Amplitude Shifted Key (ASK) modulator
Interfacing circuit for the IOs
«Charge pump for delivering power to the antenna for transmission and for system circuits. The charge
pump stores charge from received RF (radio frequency) at the card antenna in its vicinity. [The charge
pump is a simple circuit that consists of the diode and high value ferroelectrics material-based capacitor.]
The details of the basic hardware units are as follows:Rel | aa oe
1, The Microcontroller used can be MC68HC11DO or PICI6C34 or a smart card processor Philips
Smart XA ora similar ASIP Processor. MC68HC11D0 has 8 KB intemal RAM and 32 kB EPROM
and 2/3 wire protected memory. Most cards use 8-bit CPUs. The recent introduction in the cards is of
a 32-bit RISC CPU. A smart card CPU should have special features, for example, a security lock. The
Jock is for a certain sections of the memory. A protection bit at the microcontroller may protect | kB
or more data from modification and access by any external source or instructions outside that memory.
Once the protection bit is placed at the maskable ROM in the microcontroller, the instructions or data
within that part of the memory are accessible from instructions in that part only (internally) and not
accessible from the external instructions or instructions outside that part. The CPU may disable access
by blocking the write cycle placement of the data bits on the buses for instructions and data protection
at the physical memory after certain phases of card initialization and before issuing the card to the
user. Another way of protecting is as follows: The CPU may access by using the physical addresses,
which are different from the logical address used in the program.
ROM is used in the card. The usual size is 8 or 64 kB for usual or advanced cryptographic features in
the card, respectively. Full or part of ROM bus activates only after a security check. The processor
protects a part of the memory from access. The ROM stores the following.
i. Fabrication key, which is a unique secret key for each card. It is inserted during fabrication.
ii, Personalization key, which is inserted after the chip is tested on a printed circuit board. Physical
addresses are used in the testing phase. The key preserves the fabrication key and this key insertion
preserves the card personalization. After insertion of this key, RTOS and applications use only
logical addresses.
iii, RTOS codes
Application codes
. A utilization lock to prevent modification of two PINs and to prevent access to the OS and
application instructions. It stores after the card enters the utilization phase.
3. EEPROM or Flash is scalable. These means that only that part of the memory required for a particular
operation will unlock for use. The authorizer will use the required part; the application will use the
other part. It is protected by the access conditions stored therein. It stores the following:
i. PIN Personal Identification Number), the allotment and writing of which is by the authorizer (for
example, a bank) and its use is possible by the latter only by using the personalization and fabrication
keys. It is for identifying the card user in future transactions. Card user is given this key.
Altematively, a modifiable password is given to the user and password opens the PIN key.
ii, An unblocking PIN for use by the authorizer (say the bank). Through this key, the card circuit
identifies the authorizer before unblocking. Data of the user unblocks for the authorizer and
storing of information on the card is possible by the authorizer through the host.
iii, Access conditions for various hierarchically arranged data files.
iv. Card user data, for example, name, bank and branch identification number and account number
or health insurance details.
y. Data post issue that the application generates. For example, in case of e-purse, the details of
previous transactions and current balance. Medical history and diagnosis details and/or previous
insurance claims and pending insurance claims record in case of a medical card,
vi, It also stores the application’s non-volatile data.
vii. Invalidation lock sent by the host after the expiry period or card misuse and user account closing
request. It locks the data files of the master or elementary individual file or bot.
4, RAM stores the temporary variables and stack during card operations by running the OS and the
application.Chip power supply voltage extracts by a charge pump circuit. The pump extracts the charge from the
signals from the host analogous to what a mouse does in a computer and delivers the regulated voltage
to the card chip, memory and IO system. Signals can be from antenna or from clock pin. In a typical
card operation using 0.18 jim technology, 1.6 to 5.5 V is the threshold limitand for a0.35 um technology,
2.710 5.5 V.
IO System of chip and host interact through asynchronous serial UART (Section 3.23) at 9.6 k or
106 k or 115.2 k baud/s. The chip interconnects to a card hosting system (reader and writer) either
through the gold contacts or through a centimeter sized antenna on each side. The latter provides
contactless interconnection between the 1O pins, which are meant for contact-based interaction, RST
(Reset Signal from host) and Clock (irom host).
Wireless Communication for IO interaction is by radiations through the antenna coils for contactless
interaction. The card and host interact through a card modem and a host modem. The application
protocol data unit (APDU) is a standard for communication between the card and host computer.
Modulation is with 10% index amplitude modulating carrier of 13.66-13.56 Mbps ASK (amplitude
shifted keying) is used for contactless communication at data rates of ~1 Mbps, One-sixteenth frequency
subcarrier modulates through BPSK (Binary Phase Shifted Keying).
Embedded Software Smart card embeds the following software components:
PI Aves
. Boot-up, initialisation and OS programs
Smart card secure file system
Connection establishment and termination
Communication with host
Cryptography algorithm
Host authentication
Card authentication
. Saving addition parameters or recent new data sent by the host (for example, present balance left)
The smart card is an exemplary secure embedded system with security software. The card needs
cryptographic software. Embedded software in the card needs special features in its operating system over
and above the MS DOS or UNIX system features. Special features needed are as follows:
1:
2. Restricted run-time environment.
3. Its OS, every method, class and run time library should be scalable.
4,
5.
Protected environment. It means software should be stored in the protected part of the ROM.
Code-size generated should be optimum. The system needs should not exceed 64 KB memory.
Limited use of data types: multidimensional arrays, long 64-bit integer and floating points and very
limited use of the error handlers, exceptions (Section 4.2.2), signals (Sections 6.5 and 7.10), serialization,
debugging and profiling. [Serialization is the process of converting an object into a data stream for
transferring it to network or from one process to another. The de-serialized data are the receiver end].
A three-layered file system for the data. One file for the master file to store all file headers. A header
means file status, access conditions and the file lock. The second file is a dedicated file to hold a file
grouping and headers of the immediate successor elementary files of the group. The third file is the
elementary file to hold the file header and its file data.
‘There is either a fixed length file management or a variable length file management with each file
having a predefined offset.
Classes for the network, sockets, connections, data grams, character-input output and streams, security
management, digital-certification, symmetric and asymmetric keys-based cryptography and digital
signatures.48 Embedded Systems
1.10.4 Digital Camera
Digital cameras may have 4 to 6 M pixel still images, clear visual display (ClearVid) CMOS sensor, 7 cm
wide LCD photo display screen, enhanced imaging processor, double anti blur solution and high-speed
processing engine, 10X optical and 20X digital zooms and can also record high definition video-clips. It
therefore has speaker microphone(s) for high quality recorded sound. It has an audio/video out port for
connecting to a TV/DVD player or computer.
Let us assume that the camera is still just a camera. Figures 1.14(a) and (b) show hardware and software
components in a simple digital camera. Assume that the camera has the following components: .
LCD or Touch scrden for frame view |
Bluetooth ] Flash Memory
ASIP CCDDSP
Microcontroller
CCD signal processing task
| Fixelco-processing task
| JPEG coder | [ JPEG decoder
LCD, Bluetooth, COM and USB Pot device drivers
| Light, ion ard depay devco drives
|
|
1.14 (a) Digital camera hardware components (b) Digital camera software components
1. Ithaskeys on the camera. That enables a user to operate the camera, It has navigation keys to navigate
through the images back and forth,
2. Shutter, lens and charge coupled device (CCD) array sensors for images in sizes 2592 x 1944 pixels =
5038848 pixels, VGA (E-mail) 640 x 480 = 307200 pixels, 2592 x 1728 = 3.2 M pixels, 2048 x 1536
pixels = 3 M pixels, or 1280 x 960 pixels = 1 M pixels.
3. Ithasa good resolution photo quality LCD display unit on the back of camera to show photographs
or recorded video-clips. It displays text such as image-title, shooting data and time and serial number.
It displays messages. It displays the GUI menus when the user interacts with the camera.
4. Ithasa self-timer lamp for flash.
Internal memory flash to store OS and embedded software, and limited number of image files.
6. Flash memory stick of 2 GB or more for large storage.‘Iniroduétion to Embedded Systems
7. Ithas Universal Serial Bus (USB) port (Section 3.10.3) or Bluetooth interface, which connects it to a
computer and printer.
Camera Functions Assume that the camera functions is as follows:
1. It displays the frame view on the LCD screen so that user can adjust the camera inclination before
shooting the frame.
It displays the saved images on the LCD using navigation keys.
3. When akey for opening the shutter is pressed, the flash lamp glows and the self-timer circuit switches
off the lamp automatically.
4, The frame light falls on the CCD array, which transmits the bits for each pixel in each row in the frame
through an ADC. Bits from dark area pixels in each row are used for offset corrections in the CCD
signal for light intensities in each row.
5. The CCD bits of each pixel in each row and column are offset corrected using a CCD signal processor
(ccpsp).
6. The processed signals are compressed using a JPEG CODEC and saved in one jpg file for each frame.
A DSP does compression using the the discrete cosine transformations (DCTs) and decompression by
inverse DCT. Thereafter, it also does Huffman coding for JPEG compression.
7. A DAC sends the inputs for the display unit. The DAC gets the input from the pixel processor, which
gets the inputs from the JPEG files for the saved images and gets input directly from the CCDSP
through the pixel processor or the frame in the present view.
N
Digital Hardware units ‘The camera embeds the following hardware units.
Microcontroller or ASIP
Multiple processors (CCDSP, DSP, pixel processor and others)
RAM for storing temporary variables and stack
ROM for application codes and RTOS codes for scheduling tasks
Timer, flash memory for storing user preferences, contact data, user address, user date of birth, user
identification code, ADC, DAC and interrupt controller (Sections 1.3.3, 1.3.5, 13.7 and 1.3.11)
USB controller (Section 3.10.3)
Direct memory access controller (Section 4.8)
LCD controller (Section 3.3.4)
Battery
veer
Pera
Software components The camera embeds the following software components:
CCD signal processing for off-set correction
JPEG coding
JPEG decoding
Pixel processing before display
Memory and file systems
Light, flash and display device drivers
COM, USB port and Bluetooth device drivers for port operations for printer and computer
communication control
Novae p
1.10.5 Mobile Phone
The mobile phone today has a large number of features. It has sophisticated hardware and software._ Embedded Systems _
|
Hardware units _Amobile phone embeds an SoC (System-on-Chip)integrating the following hardware units.
1, Microcontroller or ASIP [An ASIP is configured to process encoding and deciphering and another
does the voice compression. Third ASIC dials, modulates, demodulates, interfaces the keyboard and
touch screen or multiple line LCD graphic displays, and processes the data input and recall of data
from memory].
DSP core, CCDSP, DSP, video, voice and pixel processors
Flash, memory stick, EEPROMs and SRAMs.
Peripheral circuits, ADC, DAC and interrupt controller
Direct memory access controller (Section 4.8)
LCD controller (Section 3.3.4)
Battery
say een
Software components The mobile phone software development tools are as follows:
1. OS (Windows Mobile, Palm, Symbian) or BREW
2. Java 2 Micro Edition (J2ME) along with KVM as a Java Virtual Machine (Section 5.7.4)
3. Java Wireless toolkit with JDK (Java Development Kit)
The mobile phone embeds the following software components:
1. Memory and file systems
2. Keypad, LCD, serial, USB, 3G or 2G port device drivers for port operations for keypad, printer and
‘computer communication control
3. SMS (Short Messaging Service) message creation and communicator, contact and PIM (personal
information manager), task-to-do manager and email
4. Mobile imager for uploading pictures and MMS (multimedia messaging service)
5. Mobile browser for access to the Web
6. Downloader for Java games, ring-tones, games, wall papers
7.
8.
Simple camera with (Section 1.10.4)
Bluetooth synchronization, IrDA and WAP connections support (Section 3.13)
1.10.6 Mobile Computer
The mobile computer has Windows CE or Windows mobile as OS. It has a touch screen for GUI. The user
uses a stylus to enter commands. Ithas a virtual keypad (the keypad displayed on the screen and entries of text
and commands is through the stylus.
In addition to phone, a mobile computer has following software components:
OS (Windows CE, Windows Mobile, PocketPC, Palm OS or Symbian OS)
Touch screen GUIs, memory and file systems
Memory stick
Outlook, Intemet explorer, Word, Excel, Powerpoint, and handwritten text processor
Applications or enterprise software
veyeee
1.10.7 A Set of Robots
Consider a set of 8 robots. One robot is the master robot (music director) and seven are slave robots (conductors),
Assume that the set is used to play an orchestra. Figures 1.14(a) and (b) show hardware and software components,
in the set of robots. Assume that the robot has the following components.
1. The master robot signals the commands and slave robots play accordingly.sows
Master Robot Functions Assume that master robot functioning is as follows
2.
2s
Each robot is assumed to have five degrees of freedom. Each robot has a mechanical system of five
degrees of freedom. At each degree of freedom, there is a servomotor. A servomotor controls by
PWM method (Section 1.3.7). Each motor is controlled in a sequence to let the robot perform the
desired action.
Each robot has a microcontroller with expansion ports, PO, ..., P8. Actually a single ASIC can perform
multiple port functions of a microcontroller. However since the engineering cost of ASIC development
is high, a general purpose microcontroller 68HC12 or 8051 is used.
‘The port outputs connect the motors and PWM outputs drive the motors in each robot.
Each robot has a serial IO with IrDA protocol. (Section 3.13.1)
Internal memory flash to store the OS, embedded software and limited amount of music.
There is a music file processor for playing the music. Slave robots have speaker outputs for playing,
musie.
Itreceives commands from a remote controller to start and stop the music and the code for the specific
orchestra to be played.
Itsends PWM signals to the ports for moving the sticks in both hands as per the program.
Itestablishes and binds the sockets (the virtual devices) connection with the slaves. It sends the signals
through sockets using IrDA protocols. The byte streams response to the clients are as per the music
file to be played by the slave.
Slave Robot Functions Assume that slave robot functioning is as follows:
1
2
3.
It establishes and binds the sockets (the virtual devices) connection with the master.
It receives from a master socket the commands accept () and write ( ); it also receives commands to
start and stop music and the code for the specific orchestra to be played.
Itreceives the signals through sockets using IrDA protocols. The byte streams from the server are as
per the music file being played.
Hardware units Robots embed the following hardware units,
PI ava
Microcontroller or ASIP
Music file processor
RAM for storing temporary variables and stack
ROM for application codes and RTOS codes for scheduling robot actions and tasks
Timer, flash memory for storing user preferences and music files
IrDA controller (Section 3.13.1)
Direct memory access controller (Section 4.8)
Power supply source or battery
Software components Robots embed the following software components:
PI AWA
. Socket functions
Music coding
Music decoding
Memory and file systems
Light, flash and display device drivers
InDA and socket port device drivers
Motor drivers
TO ISRs(s2|
(a
Client and server sockets
‘Music file processing
"IDA protocol stack Bluetooth protocol
‘Music instrument and Bluetooth or IrDA device drivers
(0) |
Fig. 1.15 (a) Hardware components in the set of robots (b) software components in the set of
robots in which 2 master robots signals the commands and slave robots play according
to the signals from the master
“4.11 “CLASSIFICATION OF EMBEDDED SYSTEMS
We can classify embedded systems into three types as follows.
1. Small scale embedded systems: These systems are designed with a single 8- or 16-bit
microcontroller: they have little hardware and software complexities and involve board-level design.
‘They may even be battery operated. When developing embedded software for these, an editor, assembler
and cross assembler, an integrated development environment (ISE) tool specific to the microcontroller
r processor used, are the main programming tools. Using “C’ language, programs are compiled into
the assembly and executable codes are appropriately located in the system memory. The software has
to fit within the memory available and keep in view the need to limit power dissipation when the
system is running continuously.
2. Medium scale embedded systems: These systems are usually designed with a single or a few
16- or 32-bit microcontrollers, DSPs or RISCs. These systems may also employ the readily available
single purpose processors and IPs (explained later) for the various functions—for example, bus
interfacing. [ASSPs and IPs may also have to be appropriately configured by the system software
before being integrated into the system-bus.] Medium scale embedded systems have both hardware
and software complexities. For complex software design, the following programming tools are available:
C/C+4/Visual C+4/Java, RTOS, source code engineering tool, simulator, debugger and an integrated
development environment, Software tools also provide solutions to hardware complexities.
3. Sophisticated embedded systems: Sophisticated embedded systems have enormous hardware
and software complexities and may need several IPs, ASIPs, scalable processors or configurable processors
and programmable logic arrays. They are used for cutting edge applications that need hardware and
software co-design and components that have to be integrated in the final system, They are constrained
by the processing speeds available in their hardware units. Certain software functions such as encryptionIntroduction to Embedded Systems 53
and deciphering algorithms, discrete cosine transformation and inverse transformation algorithms, TCP/
IP protocol stacking and network driver functions are implemented in the hardware to obtain additional
speeds. The software implements some of the functions of the hardware resources in the system.
Development tools for these systems may not be readily available at a reasonable cost or may not be
available at all. In some cases, a compiler or retargetable compiler might have to be developed for these.
A retargetable compiler is one that configures according to the given target configuration in a system. ]
“4.42” SKILLS REQUIRED FOR AN EMBEDDED SYSTEM DESIGNER
Anembedded system designerhasto develop a product using the available tools within the given specifications,
cost and time frame. [Chapters 6, 13 and 14 will cover the design aspects of embedded systems]
1. Skills for Small Scale Embedded System Designer: Author Tim Wilmshurst in his book
states that the following skills are needed in the individua: or team that is developing a small-
scale system: “Full understanding of microcontrollers with a basic knowledge of computer architecture,
digital electronic design, software engineering, data communication, control engineering, motors and
actuators, sensors and measurements, analog electronic design and IC design and manufacture”. Specific
skills will be needed in specific situations. For example, control engineering knowledge will be needed
for design of control systems, and analog electronic design knowledge will be needed when designing
the system interfaces. The basic aspects of the following topics will be described in this book to
prepare the designer who already has a good knowledge of the microprocessor or microcontroller to
be used. (i) Computer architecture and organization. (ii) Memories. (iii) Memory allocation,
(iv) Interfacing memories. (v) Burning (a term used for porting) the executable machine codes in
PROM or ROM. (v) Use of decoders and demultiplexers. (vi) Direct memory accesses. (vii) Ports.
(viii) Device drivers in assembly. ix) Simple and sophisticated buses. (x) Timers. (xi) Interruptservicing
mechanism, (xii) C programming elements. (xiii) Memory optimization, (xiv) Selection of hardware
and microconuoller. (xv) Use of In-Circuit-Emulators (ICE), cross-assemblers and testing equipment,
(xvi) Debugging the software and hardware bugs by using test vectors. Basic knowledge in other
areas—software engineering, data communication, control engineering, motors and actuators, sensors
and measurements, analog electronic design and IC design and manufacture—can be obtained
from the standard text books available. A designer interested in small-scale embedded systems
may not need at all concepts of interrupt latencies and deadlines and their handling, the RTOS
programming tools described in Chapters 9 and 10 and the program models given in Chapter 6.
2. Skills for Medium Scale Embedded System Designer: Knowledge of ‘C’/C++/Java
programming, RTOS programming and program modeling skills are must to design medium-scale
embedded-system. Knowledge of the following are critical. (i) Tasks or threads and their scheduling by
RTOS. (ii) Cooperative and preemptive scheduling. (iii) Inter processor communication functions. (iv)
Use of shared data, and programming the critical sections and re-entrant functions. (v) Use of semaphores,
mailboxes, queues, sockets and pipes. (vi) Handling of interrupt-latencies and meeting task deadlines. (vii)
Use of various RTOS functions. (vii) Use of physical and virtual device drivers. [Refer to Sections 4.2.6,
7.10 and 7.11.] Chapters4 to 10 give detailed descriptions of these seven along with examples, and Chapters
11 and 12 provide on understanding of their use with the help of case studies. A designer must have access
to an RTOS programming tool with Application Programming Interfaces (APIs) for the specific
microcontroller to be used. Solutions to various functions like memory-allocation, timers, device drivers
and interrupt handing mechanism are readily available as the APIS of the RTOS. The designer needs 10Embedded Systems
know only the hardware organization and use of these APIs. The microcontroller or processor then represents
‘a small system element for the designer and a little knowledge may suffice.
3. Skills for Sophisticated Embedded System Designer: A team is needed to co-design and
solve the high level complexities of hardware and software design. Embedded system hardware
engineers should have skills in hardware units and basic knowledge of *C’/C++ and Java, RTOS and
other programming tools. Software engineers should have basic knowledge in hardware and a thorough
knowledge of °C’, RTOS and other programming tools. A final optimum design solution isthen obtained
by system integration,
am) Summary
«An embedded system is one that has embedded software in a computer-hardware, which makes it a system
dedicated for an application(s) or a specific part of an application or product or a part of a larger system.
* The embedded system processor can be a general-purpose processor chosen from a number of families of
microprocessors. Altematively, an ASIP for example microcontrollers, embedded processors and DSPs may be
designed for specific application on a VLSI chip. An application specific instruction set processor (ASSP) may
be additionally used for fast hardwired implementation of a certain part of the embedded software. A sophisticated
embedded system may also use a multiprocessor or dual core unit.
+ Embedded systems locate a software image in ROM. The image often consists of the following: (i) Boot up
program. (ii) Initialization data. (ii) Strings for an initial sereen display or system state. (iv) Programs for the
‘multiple tasks that the system performs. (v) RTOS kernel.
© The embedded system needs a power source and controlled and optimized power dissipation from the total
energy requirement. A charge pump provides a power-supply-less system in certain embedded systems
«The embedded system needs clock and reset circuits. Use of the clock manager is a recent innovation.
= The embedded system needs interfaces: Input Output (IO) ports, serial UART and other ports to accept inputs and
to send outputs by interacting with peripherals, display units, keypad or keyboard.
© The embedded system may need bus controllers for networking its buses with other systems,
© The embedded system needs timers and a watchdog timer for the system clock and for real-time program scheduling
and control.
» The embedded system needs an interrupt-controlling unit.
© The embedded system may need an ADC for taking analog input from one or multiple sources. It needs a DAC
using PWM for sending analog output 1o motors, speakers, sound systems, ete.
«The embedded system may need an LED or LCD or touch sereen display units, keypad and keyboard, pulse
dialer, modem, transmitter, multiplexers and demultiplexers,
+ Embedded software is usually made in the high-level languages C, C++, Java or visual C+ with certain features
added, enabled or disabled for programming. Use of *C’ and C+ also facilitates the incorporation of assembly
language codes,
‘The embedded system most often needs a real-time operating system for real-time programming and scheduling,
device drivers, file system or device management and multitasking,
» The embedded system needs a debugger.
* A large number of applications and products employ embedded systems. A number of software tools are needed
in the development and design phase of an embedded system.
+ Five applications are described in detail: An automatic chocolate vending machine, a smart card, digital camera,
mobile phone, mobile computer and robots playing an orchestra,
» AVLSI chip can embed ASIP or a GPP core and IPs for the specific application. A system on-chip is the concent
in embedded systems: for example, a mobile phone in which analog and digital circuits, processors and software
reside on a chip and become a systIntroduction to Embedded Systems [55]
© The design process is abstracted by (i) definitions and analysis of system requirements, design metrics (Table 1.8)
and validation requirements for
requirements, (i) specifications
ly developed systems specifications, There has to be consistency in the
i) architecture (iv) components (v) system integration.
© Design metries are power dissipation, performance, process deadlines, user interfaces, size, engineering cost,
manufacturing cost, flexibility, prototype development time, time-to-market, system and user safety and
maintenance.
© The challenge in the process designing the system is to optimize competing design metrics.
Keywords and their Definitions
ASIP (Application Specific
Instruction Set)
Assembler
ASSP (Application Specific
‘System Processor)
Bus
Cache
Clock
CODEC
Coder
Compiter
A circuit that converts the analog input to digital 8, 10 or 12 bits. The analog input is
applied between positive and negative pins and is converted with
respect tothe reference voltage(s). When input equals reference positive and negative
voltage, then all output bits equal 1, ané when O, then all output bits equal 0.
A processor with an instruction set designed for specific application on a VLSI
chip; for example, microcontroller, DSP, IO, media, network or other domain-specific
processor
{A program that translates assembly language software into the machine codes placed
ina file called ‘.exe” (executable) file
A processing unit for system specific tasks, for example, image processing,
compression and decompression, and that is integrated through the buses with the
‘main processor in embedded system
A bus consists of acommon set of parallel lines toconnect multiple devices, hardware
units and systems for communication between two of these at any given instance.
A communication protocol specifies the ways of communication of signals on bus.
Protocol also specifies ways of arbitration when several devices need to communicate
through the bus or ways of polling from the device requirements of the bus at an
instance.
‘A fast read and write on-chip memory for the processor execution unit. It stores
instructions and data fetched in advance from ROM or RAM for use in the execution,
unit and for data write back for RAM. It has an advantage in that the processor
execution unit does not have to wait for instructions and data from external buses
and also does faster write back of data meant for RAM.
Fixed frequency pulses that an oscillator circuit generates and that controls all
operations during processing and all timing references of the system. Frequency
depends on the needs of the processor circuit. A processor, if it needs a
100 MHz clock then its minimum instruction processing time is a reciprocal of it,
which is 10 ns in a single cycle per instruction processing,
A circuit for encoding the input information in fewer bits and for decoding the
encoded information into the complete set of the original. Voice, speech, image and
‘ideo signals and bits can be encoded and decoded. The CODEC also functions as,
a compression and decompression unit for voice, speech, image and video signals
A coder which is a part of CODEC circuit is used to encode the input information.
AA program that, according to the processor specification, generates machine codes
from high level language. The codes are called object codes.DAC
Decoder
Demuttiplexer
Design metrics
Device Driver
Device Manager
Device Programmer
Embedded system
File
File System
FPGA
GPP (General-purpose
Processor)
Anput Output (10) ports
Interrupt controller
(handler)
2 Di
fA
Embedded Systems
A cycle consists of fetch of an instruction from RAM/ROM, its execution at the
processor and writing back the results of the operations.
tal bits (8 or 10 or 12) converted to analog signal scaled to a reference voltage.
‘When all input bts equal 1, then analog output equals the difference between the
positive and negative reference pin voltages: when all input bits equal 0, then the
analog output equals negative pin reference voltage
: A decoder circuit that decodes the input address and activates a selected output
among the many outputs. It is used for selecting one among severab addressable
units. A decoder also decodes the encoded bits and generates the output bits, signal
or information.
tal circuit that has digital outputs in multiple channels. The channel to which
output is sent from the input is the one that is addressed by the channel address bits
at the demultiplexer input. A demultiplexer takes the input and transfers it to a
select channel output among the multiple output channels.
The parameters that define design requirements and must be kept in view during
cach stage of design process.
2 High level language functions, such as open (configure), connect, bind, listen, read
or write or close the device. Each function calls an interrupt service routine
(Software) that runs after the programming of control register (or word) of a
peripheral device (or virtual device) to allow the device inputs or outputs. The
routine reads the status register for device status, gets the inputs from the device
and writes the output to the device
Software to manage multiple devices and their drivers.
It takes the inputs from a file generated by the locator and burns the fusable link to
actually store the data and system codes at the ROM.
+ Assystem that has embedded software in a computer-hardware that makes ita system
dedicated for an application or a specific part of an application or product, ota part
of a larger system.
A data structure (or virtual device) that sends the records (characters or words) to a
data sink (for example, a program) and thet stores the data from the data source (for
example, a program). A file in a computer may also be stored in the hard disk.
2 Afile system specifies the ways a file can be created, called, named, used, copied,
saved or deleted.
: These are Field Programmable Gate Arrays on a chip. The chip has a large number
of arrays with each element having links. Each element of array consists of several
XOR, AND, OR, multiplexer, demultiplexer and tristate gates. Complex digital
circuit functions are created by appropriate programming of the links on transferring
data from memory.
2A processor from a number of families of processors, microcontrollers,
embedded processors and digital signal processors (DSPs) having a general-purpose
instruction set and readily available compilers to enable programming in a high
level language.
+ The system gets the inpats and outputs from these. Through these, the keypad or
LCD units or touchscreen or peripherals and external systems connect tothe system.
A unit that controls (handles) processor operations arising out of an interrupt
from a source.Introduction to Embedded Systems 57
Kernel
Linker
Loader
Locator
Mask and ROM mask
Memory
Memory Stick
Multiplexer
Microcontroller
Modem
Multitasking
Physical Device
Pipe
Process
‘An OS program with the following functions: memory allocation and deallocation,
task scheduling, interprocess communication, effective management of shared
memory access by using signals, exception (error) handling signals, semaphores,
‘queues, mailboxes, pipes and sockets /O management, file system, interrupts control
(handler), device drivers and device management
Liquid crystal display—a crystal that absorbs or emits light on application of 3 to
4'V 50 0 60 Hz voltage pulses with currents ~ $0 HA. Multisegment and multiline
LCD units are used for a display of digits, characters, charts, pictograms and short
messages with very low power dissipation.
Light Emitting diode—a diode that emits ted, green, yellow or infrared light on
forward biasing between 1.6 V 10 2 V and currents between 8-15 mA. Multisegment
and multiline LED units are used for bright display of digits, characters, charts anid
short messages.
A program that Links the compiled codes with other codes and provides input for a
loader or locator.
A program that reallocates the physical memory addresses for londing into the
system RAM memory. Reallocation is necessary, as the available memory may not
slart from Ox0000 at any given instant of processing in a computer. The loader is a
part of the OS in s computer.
{A program to reallocate the linked files of the program application and the RTOS
codes at the actual addresses of the ROM memory. It creates a file in a standard
format. The file is called a ROM image.
Created at a foundry for fabrication of a chip. The ROM mask is created from a
ROM image file
This stores all the programs, input data and output data. The processor fetches
instructions from it and gives the processed results back to it,
‘A memory stick (card) is unit of memory for video, images, songs, or speeches and
is used as large storage in digital camera and mobile systems. For example, Sony
memory stick Micro (M2) has size 15x12.5x1.2 mm and functions as flash memory
of 2 GB.)
AA digital circuit that has digital inputs at any instance in multiple chanrels. The
channel for which the output is sent from the input is the one that is addressed by
the channel address bits at the multiplexer input. A multiplexer takes the input
‘among the multiple input channels and transfers a selected channel input to the
‘ouput channel.
A unit with a processor. Memory, timers, a watchdog timer, interrupt controller,
ADC or PWM, and so on are provided as required by the application.
A circuit to modulate the outgoing bits into pulses usually used on the telephone
line and to demodulate the incoming pulses into bits for incoming messages.
Processing codes for the different tasks as directed by the OS,
A device like a printer or keypad connected to the system port
A data structure (or virtual device), which is sent a byte stream from a data source
(Gor example, a program) and which delivers the byte stream to a data sink (for
‘example, a printer),
A program or task or thread that has a distinet memory allocation of its own and.
has one or more functions or procedures for a specific job. The process may shareProcessor
Pulse Width Modulator
(wm)
Real-time operating system
RAM
Registers
Reset
Reset circuit
ROM
System
System on Chip
Timer
Touchscreen
UART
Virtual Device
VLSI chip
Watchdog timer
Embedded Systems
the memory (data) with other tasks. A processor may ran multiple processes
separately or concurrently as directed by the OS.
A processor executes the instruction cycles and executes one process or many 3s
per the command (instruction) given to it.
A modulator that modulates the pulse width as per the input bits. It provides a pulse
of width scaled to the analog output desired, On integrating PWM output the desired
DAC operation is achieved.
Operating system software for real-time programming and scheduling,
process and memory manager, device drivers, device management and multitasking.
‘This is a random access read and write memory that the processor uses to store
programs and data that are volatile and which disappear on power down or when
switched off.
These are associated with the processor and temporarily store the variable
values from the memory and from the execution unit during processing of an
instruction.
A processor state in which the processor registers aequire initial values and from
which starts an initis! program; this program is usually the one that also runs cn
power up.
A circuit to force a reset state that gets activated for a short period on power up.
When reset is activated, the processor generates a reset signal for the other system
units needing reset.
‘A read only memory that locates the following in it—embedded software, initial
data and strings and operating system or RTOS.
A way of working, organizing or doing one or a series of tasks by following @ fixed
plan, program and set of rules.
‘A system on a VLSI chip that has all the necessary needed analog as well as digital
circuits; for example, in a mobile phone.
A unit to provide the time for the system clock and real-time operations and
scheduling. It generates interrupts on timeouts as per the preset time or on overflow
‘or on successful comparison of present time with a preset time or on capturing the
time on an event.
‘An input as well as an output device that is used t0 enter a command, choose a
menu or to give user reply as input by physically touching at a screen position
either by the finger or by a stylus. A stylus is thin pencil-shaped object. It is held
between the fingers and used just as a pen is used to mark a dot. The screen displays
the choices or commands, menus, dialog boxes and icons, similar to a computer
display.
Universal Asynchronous Receiver and Transmitter
A file or socket or pipe-like device that is programmable for opening, closing,
reading and writing similar to a physical device.
A very large-scale integrated circuit made on silicon with ~1M and above transistor.
A timer that resets the processor in case the program gets stuck for an unexpected
length of time.hh.
12.
13.
4
1s.
16.
1.
18.
19.
20.
21
22.
23.
24,
26.
21.
28.
29.
30.
31.
32.
33.
34.
Review Questions
Define a system. Now define an embedded system,
‘What are the essential structural units in the following? (a) a microprocessor (b) an embedded processor
(©) a microcontroller (d) a DSP (e) an ASIP. List each of these.
How does a DSP differ from a general-purpose processor (GPP)? [Sections 1.2.1, 1.7.3 and 23.3].
Whatare the advantages and disadvantages ofthe following? (a «processor with only a fixed-point arithmetic uit
and (b) a processor with additional floating-point arithmetic processing unit.
How does a microcontroller differ from a DSP? [Sections 1.2.3, 1.7.2, 2.1 and 2.3.5).
Explain single purpose processors use in convergence technology embedded systems (a) smart mobile phone with
mail client, Internet connectivity and image-frame downloads and (b) digital camera.
‘Compare features in a family chip (or core) of each of the following: a microprocessor, microcontroller, RISC
processor, DSP and ASSP.
Why do later generation systems operate the processor at low voltages (S2 V) and perform IOs at (~3.3 V)?
‘What are the techniques of power and energy management in a system?
‘What is the advantage of running a processor at reduced clock speed in certain sections of instructions and at full
speed in other sections?
Whats the advantage of the following? (a) Stop instruction (b) Wait instruction (c) Processor idle mode operation
(@) Cache-use disable instruction (e) Cache with multiways and blocks in an embedded system.
‘What do we mean by charge pump? How does a charge pump supply power in an embedded system without using
power-supply lines?
‘What do you mean by ‘real time” and ‘teal time clock"?
‘What is the role of processor reset and system reset?
Explain the need of watchdog timer and reset after the watched time.
What is the role of RAM in an embedded system?
Why do we need multiple actions and multiple controlling tasks for devices in an embedded system? Explain, using
as an example the embedded system, the remote of colour TV.
When do we need multitasking OS?
When do we need an RTOS?
‘Why should the embedded system RTOS be scalable?
Explain the terms IP core, FPGA, CPLD, PLA and PAL
‘What do you mean by System-on-Chip (SoC)? How will the definition of an embedded system change with a
System-on-Chip?
‘What are the advantages offered by an FPGA for designing an embedded system?
‘What are the advantages offered by an ASIC for designing an embedded system?
‘What are the advantages offered by an ASIP for designing an embedded system?
Real time video processing needs sophisticated embedded systems with hard real time constraints. Why? Explain.
Why does a processor system always need an ‘Interrupts Handler (Interrupt Controller)"?
What role does a linker play?”
‘Why do we use a loader in a computer system and a locator in an embedded system?
‘Why does a program reside in the ROM in the embedded system?
Define ROM image and explain each section of an ROM image in a system.
‘When is the compressed program and data in ROM used? Give five examples of embedded systems having these
in their ROM images.
‘When is SRAM used and when DRAM? Explain your answers.
‘What do we mean by the following: physical device, virtual device, plug and play device, bus self-powered device,
evice management and device-specific processor.Embedded Systems
35. Define design metrics in embedded systems. What are the different competing design metrics? What are the constraints
of embedded system design?”
36. How is power dissipation optimized?
37. What are the challenges faced in designing an embedded system?
Practice Exercises
38. Search for the definitions of embedded system in the books referred to in the ‘References’ section and tabulate
these with the definitions in column 1 and the reference names in column 2.
39. Classify the embedded systems into small scale, medium scale and sophisticated systems. Now, reclassify these
embedded systems with and without real-time (response time constrained) systems and give 10 examples of each.
40. An automobile cruise control system is to be designed in a project. What will be skills needed in the team of
hardware and software engineers?
41. Take value, x = 1.7320508075688. It is squared once again by a floating-point arithmetic processor unit. Now x
is squared by a 16-bit integer fixed point arithmetic processing unit. How does the result differ? [Note: Fixed-point
unit will multiply only 17320 with 17320, divide the result by 10000 and then again divide the result by 10000.]
42. Design a four-column table. Write two examples of embedded systems in columns 2 and 3. In Column 1, write the
type of processor needed among the following: microprocessor, microcontroller, embedded processor, digital signal
processor, ASSP, single purpose and media processor. Give your reasoning in column 4.
43. Why does a CMOS 10 circuit power dissipation reduce by compared to 5 V, factor of half, -(3.3/5), in 10 3.3 V
operation?
44, What will be the reduction in power dissipation for a CMOS circuit when voltage reduces from a5 V to a 1.8V
operation?
45. List the various type of memories and application of each in the following: robot, electronic smart weight display
system, ECG LCD display-cur-recorder, router, digital camera, speech processing, smart card, embedded firewall/
router, mal cient caré, and transreceiver system with collision control and jabber control. (Collision control means
‘wansmission and reception when no other system on the networ the network. Jabber control mezns
control of continuous streams of random data flowing on a network, which eventually chokes a network]
46. Tabulate hardware units needed in each of the systems: camera, mobile computer and robot.
47. Give two examples of embedded systems, which need one or more of following units. (a) DAC (Using a PWM)
(b) ADC (c) LCD display (d) LED displays (e) Keypad (f) Pulse dialer (g) Modem (h) Transreceiver.
48. An ADCis a 10-bit ADC. Ithas reference voltages, Vig = 0.0 V and Vag, 1.023 V. What will be the ADC outputs
‘when inpats are (a) -0.512 V (b) +0.512 V and (c) +2047V? What will be the ADC outputs in three situations when.
@ Veg. = 0.512 V and Vig, = 1.023 V Gi) Vee. = 1.024 V and Vice. = 2.047 V and (i) Vee. = -1024 V and
Veet, = 42.047 V.
49, Tabulate the advantages and disadvantages of using coding languages as follows: (a) Machine coding (b) Assembly
(©) C (d) C++ and (e) Java.
50. List the software tools needed in designing each of the embedded system—camera, mobile phone and robot.
51. Justify the use of physical and virtual devices drivers in embedded systems.
‘52, The cost of designing an embedded system may be thousands of times the cost of its processor and hardware units.
Explain this statement.
53. An FPGA (Field Programmable Gate Arrays) core integrated with a single or multiple processor unit on chip. How
do these help in the design of sophisticated embedded systems for real time video processing?
54. List the memory units and processor needed in a smart card8051 and Advanced
Processor Architectures,
Memory Organization
and Real-world
Interfacing
‘The previous chapter dealt with the following:
Embedded system embeds software and RTOS.
Embedded system embeds software in hardware
consisting of microprocessor or microcontroller
or DSP or ASIP and single purpose processors.
Embedded system has memory (ROM, RAM and
caches), ports, timers, devices and interfacing
circuits.
Microcontroller hardware consists of processing
unit, RAM, ROM, timing and interrupt handling
devices and other application specific units as a
single chip or VLSI core.
Design metrics, processes and challenges.
Software, device drivers and device-manager.
Software tools.L
£
A
R
N.
rT
N
G
Bw Oo
&
omer Aa
In this chapter, we will learn the following
1. 8051 architecture in brief and its processor, memory, poris, counters/timers,
serial 10 and interrupt handler units
2. Real world interfacing, and internal and external buses that interconnect the
processor with the system memories, 10 devices and all other system units
3, Interfacing examples with keyboard, displays, ADC and DACs
4. Advanced processors x86, ARM and SHARC architectures
5, Processor and memory organization
6. Instruction-level parallelism and superscalar, processing, pipelining and cache
units for improved computational performance of the processor by faster
program execution
7. Various types of memory and their uses
8. Devices and memory addresses allocations
9, Performance metrics to measure the performance of a processor
10, Processor selection for embedded system
11, Memory selection for embedded system
“3.1 “B051 ARCHITECTURE
The following subsections summarize the 8051 architecture in brief. A reader may
refer to a standard text for details.
2.1.1 8051 Microcontroller Architecture
Figure 2.1 shows the architecture of the classic 8051 microcontroller. Classic means
the original version, based upon which new enhancements and versions are provided.
The classic version consists of following hardware:
1. A 12 MHz clock. Processor instruction cycle time is | ps.
2. An 8-bit ALU. The internal bus width is 8-bit
3. CISC (Complex Instruction Set Computer) architecture. [CISC provides many
modes for addressing operands in arithmetic, logical and other instructions.
Several complex instructions take more than one cycle time. Complex
instructions implement in hardware not by separate hardwired logic circuits
for cach instruction but by a microprogram control circuit.)
Special bit manipulation instructions.
A program counter, in which the initial default reset value defined by the
processor is 0x0000.
6. A stack pointer, in which the initial default value defined by the processor is
0x07.
we‘8051 and Advanced Processor Architectures, Memory Organization and Real-world Interfacing
Reset
Ee] eS Ge wot Ose Port Pt
cain as i r ' a
t — | 4
iA Execution unit ‘SFA 10 and
; — devices |
ID
ALU A.B, PSW, SP SFRs
{ é
Condition test branch logic
eee = Register Barks of 6 registers
t t
Control and Sequencing Circuit ROM and RAM
t r — - PC PortP2
Interrupt Control Grout | ere
AB-AIS © ‘ADO - ADS.
Fig. 2.1 8051 Architecture
7. A simple architecture, with no floating-point processor, no cache, no memory management unit, no
atomic operations unit, no pipeline and no instruction level parallelism. (Sections 2.3 and 2.5). There
is no DMA controller (Section 4.8) in the classic and most other versions.
8. A Harvard memory architecture (Section 2.4.2). The program memory and data memory have separate
address spaces from 0x0000 and separate control signal(s).
9. On-chip RAM of 128 bytes. The 8052 version provides for RAM of 256 bytes; 32 bytes of RAM are
also used as four banks (sets) of registers. Each register-set (bank) thus has eight registers. The external
data/stack memory can be added upto 64 kB in most versions. In certain 8051 enhancements, this limit
has been enhanced to 16 MB.
10. There are special function registers (SFRs). These are PSW (processor status word), A (accumulator),
B register, SP (stack pointer) and registers for serial [Os, timers, ports and interrupt handler.
11. 8351 version has on-chip ROM; 8751 version EPROM; 8951 version has on-chip EEPROM or flash
memory of 4 kB. Several versions provide for higher capacity ROM. Additional program memory can
be added extemally upto 64 KB. In extended 8051 and unified address space versions (8051 EX and
MX versions), this limit has been extended to 16 MB.
12. ‘Two external interrupt pins, INTO and INT1.
13. Four ports PO, P1, P2 and P3 of 8 bits each in single chip mode. (Section 2.1.3) There are two timers
(Section 2.1.5) and a serial interface (SI). It can be programmed for three full duplex UART modes for
a serial IO. [10 with each bit of a word successive transmitted on the data line for a time interval.] The
SI can also be programmed for half duplex synchronous IO (Section 2.1.6).cnn ye
14. Classic version has no pulse width modulator and provides on support to DAC. (Section 1.3.7) It has
no modem, no watchdog timer, no ADC. Certain versions support watchdog timer and ADC. Siemens
‘SAB 80535-N supports ADC with programmable reference voltage. Advanced versions support these
features and choice of version depends on system requirement. (Section 2.8 and 2.9).
2.1.2 Instruction Set
Figure 2.2 shows instruction types in the 8051 set, There are seven types of instructions.
Full instruction set and instructions in detail can be referred to from a microcontroller text or manual. The
imporint instructions are as follows:
Data Transfer Instructions Data transfer instructions move (copy) one source operand to another
destination. MOV A, R,andMOV R,, A are for moving (copying) the data into A from R, and to R,. Ry is
the n™ register in a set of 8 registers. PSW bits RSO and RSI predefine the set.
Data transfer instructions MOV A, @R, andMOV @R;, A are for moving (copying) the data into A from
@R, and to @R,. R; is the i register in a set of 8 registers. PSW bits RSO and RSI predefine the set. @R,means
data transfer to an 8.-bit address pointed by the contents of the i® register in the set.
Four data transfer instructions are MOV direct, #data, MOV A,#data, MOV R,,#data and
MOV @R,, #data for moving 8-bit data into direct or A or R, or @R; Direct means data transfer to an 8-bit
address of internal 128B RAM or SFR address. @R, means data transfer to an 8-bit address pointed by the
contents of the i'* register in the set (i = 0 ori).
‘Seven data transfer instructions are MOV direct,direct, MOV A,direct, MOV direct, A,
MOV direct,R,, MOV R,,direct, MOV direct,@R,, and MOV @R,, direct are for moving
data between the 8-bit direct address to direct or A or R, or @R,. Direct means data transfer to or from an 8-
bit address of internal 128B RAM or SFR address. @R, means data transfer to an 8-bit address pointed by
contents of i'® register in the set (i = 0 or 1).
‘There is a 16-bit external memory data pointer, DPTR. The MOV DPTR, data6 instruction is used to
send 16 bits specified in datal6 to DPTR.
MOVX (move external instruction) will transfer the data to or from external data memory. These instructions
are MOVX A, @DPTR and MOVX @DPTR, A. @DPTR means address as pointed by 16 bits of DPTR. For
an 8-bit extemal memory address, instead of DPTR, @R, is used (i = 0 or 1). MOVC (move code from
external program memory instruction) will transfer the data from the external program memory. Instructions
areMOVC A, @A +DPTRandMOVC A, @A+PC.
For stack operations, there are PUSH direct and POP direct instructions.
Bit Manipulation Instructions Each bit of certain SFRs and an 8-byte intemal RAM are assigned bit
addresses in 8051 hardware. There are bit manipulation instructions to clear, set, AND, OR, MOY the bit.
Byte Manipulation Instructions There are byte manipulation instructions to rotate right A, rotate left
A, rotate right A with carry, rotate left A with carry, complement A, clear A and swap with A lower and upper
nibble (set of 4 bits).
Arithmetic Instructions Arithmetic instructions of the source operand is stored in the accumulator and
the result of the operation is also stored in the accumulator. For example, ADD A, R,, It adds the byte in A
with the byte in the n® register. (A — A +R,). Three arithmetic instructions are ADD, ADDC (add including
carry bit) and SBBB (subiract including borrow bit). Carry bit is set to 1 when an operation results in carry or