Embedded Systems Notes (1)
Embedded Systems Notes (1)
1
EMBEDDED SYSTEM :
AN INTRODUCTION
Unit Structure
1.0 Objectives
1.1 Introduction
1.2 Definition of Embedded System
1.3 History of Embedded System
1.4 Embedded System & General purpose computer
1.5 Classification of Embedded System
1.6 Application of Embedded System
1.7 Purpose of Embedded System
1.8 Review Questions
1.9 References & Further Reading
1.0 OBJECTIVES
1.1 INTRODUCTION
1.5.1 On generation
1. First generation(1G):
⦿ Built around 8bit microprocessor & microcontroller.
⦿ Simple in hardware circuit & firmware developed.
⦿ Examples: Digital telephone keypads.
2. Second generation(2G):
⦿ Built around 16-bit µp & 8-bit µc.
⦿ They are more complex & powerful than 1G µp & µc.
⦿ Examples: SCADA systems
3. Third generation(3G):
⦿ Built around 32-bit µp & 16-bit µc.
⦿ Concepts like Digital Signal Processors(DSPs),
Application Specific Integrated Circuits(ASICs) evolved.
⦿ Examples: Robotics, Media, etc.
4. Fourth generation:
⦿ Built around 64-bit µp & 32-bit µc.
⦿ The concept of System on Chips (SoC), Multicore
Processors evolved.
⦿ Highly complex & very powerful.
⦿ Examples: Smart Phones.
2. Medium-scale:
⦿ Slightly complex in hardware & firmware requirement.
⦿ Built around medium performance & low cost 16 or 32 bit
µp/µc.
⦿ Usually contain operating system.
⦿ Examples: Industrial machines.
6
3. Large-scale:
⦿ Highly complex hardware & firmware.
⦿ Built around 32 or 64 bit RISC µp/µc or PLDs or Multicore
Processors.
⦿ Response is time-critical.
⦿ Examples: Mission critical applications.
1.5.4 On triggering
⦿ Embedded systems which are “Reactive” in nature can
be based on triggering.
⦿ Reactive systems can be:
✓ Event triggered
✓ Time triggered
1. Data Collection/Storage/Representation
▪ Embedded system designed for the purpose of data collection
performs acquisition of data from the external world.
▪ Data collection is usually done for storage,analysis,
manipulation and transmission.
▪ Data can be analog or digital.
7
2. Data communication
▪ Embedded data communication systems are deployed in
applications from complex satellite communication to simple
home networking systems.
▪ The transmission of data is achieved either by a wire-line
medium or by a wire-less medium.
▪ Data can either be transmitted by analog means or by digital
means.
▪ Wireless modules-Bluetooth, Wi-Fi.
▪ Wire-line modules-USB, TCP/IP.
▪ Network hubs, routers, switches are examples of dedicated
data transmission embedded systems.
4. Monitoring
▪ All embedded products coming under the medical domain are
with monitoring functions.
▪ Electro cardiogram machine is intended to do the monitoring of
the heartbeat of a patient but it cannot impose control over the
heartbeat.
▪ Other examples with monitoring function are digital CRO,
digital multi-meters, and logic analyzers.
5. Control
▪ A system with control functionality contains both sensors and
actuators.
8
❖❖❖❖
9
❖❖❖❖
10
3
CORE THE OF EMBEDDED SYSTEM
Unit Structure
6.0 Objectives
6.1 Introduction
6.2 Core of embedded systems
6.2.1 General purpose and domain specific processor.
6.2.1.1 Microprocessors
6.2.1.2 Microcontrollers.
6.2.1.3 Digital signal processors
6.2.2 Application Specific Integrated Circuits. (ASIC)
6.2.3 Programmable logic devices(PLD’s)
6.2.4 Commercial off-the-shelf components(COTs)
6.3 Sensors & Actuators
6.4 Communication Interface
6.5 Review Questions
6.6 References & Further Reading
3.0 OBJECTIVES
3.1 INTRODUCTION
3.2.1.1 MICROPROCESSORS
• A microprocessor is a silicon chip representing a central
processing unit.
• Developers of microprocessors.
o Intel – Intel 4004 – November 1971(4-bit).
o Intel – Intel 4040.
o Intel – Intel 8008 – April 1972.
o Intel – Intel 8080 – April 1974(8-bit).
o Motorola – Motorola 6800.
o Intel – Intel 8085 – 1976.
o Zilog - Z80 – July 1976.
RISC CISC
▣ Reduced Instruction ▣ Complex
Set Instruction Set
Computing Computing
▣ It contains lesser number of ▣ It contains greater number of
instructions. instructions.
▣ Instruction pipelining ▣ Instruction pipelining feature
and
increased execution speed. does not exist.
▣ Orthogonal ▣ Non-orthogonal
instruction set(all
set(allows each instruction to instructions are not allowed to
operate on any register and use operate on any register and
any addressing mode. use any addressing mode.
▣ Operations are performed on ▣ Operations are performed
registers only, only memory either on registers or memory
operations are load and store. depending on instruction.
▣ A larger number of registers ▣ The number of general
are available. purpose registers are very
limited.
▣ Programmer needs to write more ▣ Instructions are like macros
code to execute a task since in C language. Aprogrammer
instructions are simpler ones. can achieve the desired
functionality with a single
instruction which in turn
provides the effect of using
more simpler singleinstruction
in RISC.
• Endiannes
o Endianness specifies the order which the data is stored in
the memory by processor operations in a multi byte system.
3.2.1.2 MICROCONTROLLERS.
• A logic gate has a fixed function but a PLD does not have a
defined function at the time of manufacture.
• Advantages of PLDs :-
1) PLDs offer customer much more flexibility during the
design cycle.
5) Advantages of COTS:
1) Ready to use
2) Easy to integrate
3) Reduces development time
6) Disadvantages of COTS:
1) No operational or manufacturing standard (all
proprietary)
• Sensor
• A Sensor is used for taking Input
• It is a transducer that converts energy from one form to
another for any measurement or control purpose
• Ex. A Temperature sensor
• Actuator
• Actuator is used for output.
• It is a transducer that may be either mechanical or electrical
which converts signals to corresponding physical actions.
• Ex. LED (Light Emitting Diode)
• LED is a p-n junction diode and contains a CATHODE and
ANODE
• For functioning the anode is connected to +ve end of power
supply and cathode is connected to –ve end of power supply.
• The maximum current flowing through the LED is limited by
connecting a RESISTOR in series between the power supply
and LED as shown in the figure below
18
❖❖❖❖
22
4
CHARACTERISTICS & QUALITY
ATTRIBUTES OF EMBEDDED SYSTEMS
Unit Structure
10.0 Objectives
10.1 Introduction
10.2 Characteristics of Embedded System
10.3 Quality Attributes of Embedded System
10.3.1 Operational Attributes
10.3.2 Non Operational Attributes
10.4 Review Questions
10.5 References & Further Reading
4.0 OBJECTIVES
4.1 INTRODUCTION
4. Distributed
• Certain embedded systems are part of a larger system and
thus form components of a distributed system.
• Ex. Currently available cell phones. The cell phones that have
the maximum features are popular but also their size and
weight is an important characteristic.
6. Power concerns
• It is desirable that the power utilization and heat dissipation
of any embedded system be low.
24
b) Throughput
• Throughput deals with the efficiency of system.
• It can be defined as rate of production or process of a
defined process over a stated period of time.
• In case of card reader like the ones used in buses,
throughput means how much transaction the reader can
perform in a minute or hour or day.
c) Reliability
• Reliability is a measure of how much percentage you rely
upon the proper functioning of the system .
25
d) Maintainability
• Maintainability deals with support and maintenance to the
end user or a client in case of technical issues and product
failures or on the basis of a routine system checkup
• It can be classified into two types :-
e) Security
• Confidentiality, Integrity and Availability are three corner
stones of information security.
• Confidentiality deals with protection data from unauthorized
disclosure.
• Integrity gives protection from unauthorized modification.
• Availability gives protection from unauthorized user
• Certain Embedded systems have to make sure they conform
to the security measures. Ex. An Electronic Safety Deposit
Locker can be used only with a pin number like a password.
f) Safety
• Safety deals with the possible damage that can happen to the
operating person and environment due to the breakdown of an
embedded system or due to the emission of hazardous
materials from the embedded products.
• A safety analysis is a must in product engineering to evaluate
the anticipated damage and determine the best
26
b) Evolvability
• For embedded system, the qualitative attribute “Evolvability”
refer to ease with which the embedded product can be
modified to take advantage of new firmware or hardware
technology.
c) Portability
• Portability is measured of “system Independence”.
• An embedded product can be called portable if it is capable of
performing its operation as it is intended to do in various
environments irrespective of different processor and or
controller and embedded operating systems.
❖❖❖❖
28
29
30
31
8
EMBEDDED SYSTEMS: MEMORY
Unit Structure
36.0 Objectives
36.1 Introduction
36.2 Types of Memory
36.3 Types of RAM
36.3.1 SRAM
36.3.2 DRAM
36.4 Types of ROM
36.4.1 MASKED
36.4.2 PROM
36.4.3 EPROM
36.5 Types of Hybrid Memory
36.5.1 NVRAM
36.5.2 FLASH
36.5.3 EEPROM
36.6 DIRECT MEMORY ACCESS (DMA)
36.7 Review Questions
36.8 References & Further Reading
37.0 OBJECTIVES
8.1 INTRODUCTION
c) HYBRID
• It is combination of RAM as well as ROM
• It has certain features of RAM and some of ROM
• Like RAM the contents to hybrid memory can be read
and written
• Like ROM the contents of hybrid memory are non volatile
8.5.1 EEPROMs
a. EEPROMs stand for Electrically Erasable and
Programmable ROM.
b. It is same as EPROM, but the erase operation is
performed electrically.
c. Any byte in EEPROM can be erased and rewritten as
desired
8.5.2 Flash
a. Flash memory is the most recent advancement in memory
technology.
b. Flash memory devices are high density, low cost,
nonvolatile, fast (to read, but not to write), and electrically
reprogrammable.
c. Flash is much more popular than EEPROM and is rapidly
displacing many of the ROM devices.
d. Flash devices can be erased only one sector at a time, not
byte by byte.
8.5.3 NVRAM
a. NVRAM is usually just a SRAM with battery backup.
b. When power is turned on, the NVRAM operates just like
any other SRAM but when power is off, the NVRAMdraws
enough electrical power from the battery to retain its
content.
c. NVRAM is fairly common in embedded systems.
d. It is more expensive than SRAM.
35
❖❖❖❖
36
10
EMBEDDED SYSTEMS: PERIPHERALS
Chapter Structure
56.0 Objectives
56.1 Introduction
56.2 Testing Non Volatile Memory Devices
56.3 Control and Status Registers
56.4 Device Driver
56.5 Watchdog timer
56.6 Review Questions
56.7 References & Further Reading
10.0 OBJECTIVES
10.1 INTRODUCTION
• Checksum
➢ Checksums basically deals with the question whether the
data stored in a memory device is valid or not?
➢ To do this the checksum of the data in the memory device
is computed and stored along with the data. The moment
when we have to confirm the validity of the data,we just
have to recalculate the checksum and compare it with
previous checksum. If the two checksums match, the data
is assumed to be valid.
➢ The simplest checksum algorithm is to add up all the data
bytes discarding carries.
➢ A Checksum is usually stored at some fixed location in
memory. This makes it easy to compute and store the
check sum for the very first time and later on to compare
the recomputed checksum with the original one.
➢ Disadvantage: A simple sum-of-data checksum cannot
detect many of the most common data errors.
struct TimerCounter
{
unsigned short count; // Current Count, offset 0x00
unsigned short maxCountA;// Maximum Count, offset 0x02
unsigned short _reserved; // Unused Space, offset 0x04
unsigned short control; // Control Bits, offset 0x06
};
➢ It is hardware equipment.
➢ It is special purpose hardware that protects the system from
software hangs.
➢ Watchdog timer always counts down from some large number
to zero
➢ This process takes a few seconds to reset, in the meantime,
it is possible for embedded software to “kick” the watchdog
timer, to reset its counter to the original large number.
➢ If the timer expires i.e. counter reaches zero, the watchdog
timer will assume that the system has entered a state of
software hang, then resets the embedded processor and
restarts the software
➢ It is a common way to recover from unexpected software
hangs
➢ The figure below diagrammatically represents the working of
the watchdog timer
❖❖❖❖
42
11
EMBEDDED OPERATING SYSTEM
Chapter Structure
67.0 Objectives
67.1 Introduction
67.2 Basics
67.2.1 Tasks
67.2.2 Task States
67.3 Scheduler
67.3.1 Scheduling Points
67.3.2 Ready List
67.3.3 Idle task
67.4 Context Switch
67.5 Task Synchronization
67.6 Real Time Characteristic
67.7 Selection Process
67.8 Review Questions
67.9 References & Further Reading
11.0 OBJECTIVES
11.1 INTRODUCTION
11.2 BASICS
11.2.1 Tasks
▪ Task is a piece of code or program that is separate from
another task and can be executed independently of the other
tasks.
▪ Multiple tasks are not executed at the same time instead they
are executed in pseudo parallel i.e. the tasks execute inturns
as the use the processor.
TaskId id;
Context context;
TaskState state;
Priority priority;
44
int * pStack;
Task * pNext;
void (*entryPoint)();
private:
static TaskId nextId;
};
11.2.2 Task States
11.3 SCHEDULER
1. First-in-first-out
▪ First-in-first-out (FIFO) scheduling describes an operating
system which is not a multitasking operating system.
▪ Each task runs until it is finished, and only after that is the next
task started on a first come first served basis.
3. Round robin.
▪ Round robin scheduling uses algorithms that allow every
task to execute for a fixed amount to time.
▪ So the head of this list is always the highest priority task that
is ready to run.
▪ When this binary flag is set, the shared data buffer is assumed
to be in use by one of the tasks. All other tasks must wait until
that flag is cleared before reading or writing any of the data
within that buffer.
i. Deterministic
▪ An OS is said to be deterministic if the worst case
execution time of each of the system calls is calculable.
❖❖❖❖
49
12
EMBEDDED SYSTEMS: INTEGRATED
DEVELOPMENT ENVIRONMENT
Chapter Structure
79.0 Objectives
79.1 Introduction
79.2 Embedded IDE
79.3 Types of file generated on cross compilation
79.4 DISASSEMBLER/ DECOMIPILER
79.5 SIMULATOR
79.6 FirmWare Debugging
79.7 Review Questions
79.8 References & Further Reading
12.0 OBJECTIVES
12.1 INTRODUCTION
This chapter explains the IDE used for embedded systems. It then
explains the different types of files that are generated on cross compilation.
Then it gives an account of utility tools like Disassembler/ Decomipiler,
Simulator and then FirmWare Debugging.
1. List File(.lst):-
• Listing file is generated during the cross-compilation
process.
• It contains an information about the cross compilation
process like cross compiler details, formatted source
text(‘C’ code), assembly code generated from the source
file, symbol tables, errors and warnings detected during
the cross-compilation process.
• The list file contain the following sections:
1. Page Header
• It indicates the compiler version name, source file name,
Date, Page No.
• Example: C51 COMPILER V8.02 SAMPLE 05/23/2006
11:12:58 PAGE 1
2.Command Line
• It represents the entire command line that was used for
invoking the compiler.
• C51 COMPILER V8.02, COMPILATION OF MODULE
SAMPLE OBJECT MODULE PLACED IN sample.obj
51
3.Source Code
• It contains source code along with line numbers
• Line level Source
1 //Sample.c for printing Hello World!
2 //Written by xyz
3 #include<stdio.h>
1 //Body part starts
2
3
4
5
6 //Body part end
4 void main()
5 {
6 printf(“Hello World”);
7 }
8 //Header part ends
4. Assembly listing
• It contains the asembly code generated by
compiler for even given ‘C’ code.
• ASSEMBLY LISTING OF GENERATED OBJECT
CODE;
• FUNCTION main(BEGIN)
;SOURCE LINE #5
;SOURCE LINE #6
0000 7BFF MOV R3,#0FFH
0002 7A00 R MOV
R2,#HIGH?SC_0
5. Symbol listing
• It contains symbolic information about the various
symbols present in the cross compiled source file.
• Eg: NAME, TYPE, SFR, SIZE.
•
6. Module Information
• The module information provides the size of
initialized and un-initialized memory areas defined
by the source file.
Module Information Static Overlayable
Code Size 9 -------------
Constant size 14 -------------
Bit size ------- -------------
END OF MODULE INFORMATION
52
4. Map File(.MAP)
• Also called as Linker List file. Map file contains information
about the link/locate process and is composed of a number
of sections described below:
I. Page Header
Each MAP file contains a header which indicates the
linker version number, date, time and page number.
V. Memory Map
It lists the starting address, length, relocation type and
name of each segment in the program
53
12.5 SIMULATOR
• Advantages
1. Simple and straight forward.
• Simulators are a software utility with assumptions about the
underlying hardware. So it only requires concentrating on
debugging of the code, hence straight forward.
2. No Hardware
• Simulators are purely software oriented.
• The IDE simulates the target CPU. The user needs to know
only about the target specific details like memory map of
various devices.
• Since no hardware is required the code can be written and
tested even before the hardware prototype is ready thus
saving development time
3. Simulation options
• Simulators provide various simulation options like I/O
peripherals or CRO or Logic analyzers.
55
• Disadvantages
1. Lack of real time behavior
• A simulator assumes the ideal condition for code
execution.
• Hence the developer may not be able to debug the code
under all possible combinations of input.
• The results obtained in simulation may deviate from
actual results on target hardware.
• Emulators
• The terms simulators and emulators are very confusing but
their basic functionality is the same i.e. to debug the code.
There is a difference in which this is achieved by both the
tools.
❖❖❖❖
57
58