Mes - Module 05 Part A July - 2024
Mes - Module 05 Part A July - 2024
Embedded Environment
Embedded System Components(Part A): Embedded Vs General
computing system, History of embedded systems, Classification of
Embedded systems, Major applications areas of embedded systems,
purpose of embedded systems. Core of an Embedded System
including all types of processor/controller, Memory.
Chapter 01 & 02 from Textbook 02
Embedded system Development Environment – Block diagram
(excluding Keil), Disassembler/decompiler, simulator, emulator and
debugging techniques, target hardware debugging, boundary scan
Chapter 13 from Text book 02(Shibu K V, “Introduction to Embedded Systems”)
1
Embedded System
Components(Part A):
2
Introduction
3
Introduction
4
What is an Embedded
System?
5
Embedded system
6
What is an Embedded System?
9
General Purpose Computing Embedded System
System
• Applications are alterable • The firmware of the embedded
(programmable) by the user system is pre-programmed, and it is
• i.e., the end user can re-install non-alterable by the end-user (There
the operating system, and also may be exceptions for system
add or remove user supporting OS kernel image flashing
applications through special hardware settings)
• Performance is the key deciding • Application-specific requirements
factor in the selection of the (like performance, power
system. Always, ‘Faster is Better’ requirements, memory usage, etc.)
are the key deciding factors
10
General Purpose Computing System Embedded System
• Less tailored or not tailored • Highly tailored to take advantage
towards reduced operating of the power saving modes
power requirements, options for supported by the hardware and
different levels of power the operating system
management(Monolithic)
• Response requirements are not • For certain category of embedded
time-critical systems like mission critical
systems, the response time
requirement is highly critical.
• Need not be deterministic in • Execution behaviour is deterministic
execution behaviour for certain types of embedded
systems like ‘Hard Real Time’ systems
11
History of Embedded Systems
• Embedded systems were in existence even before the IT revolution.
• Built around the old vacuum tube and transistor technologies.
• Advances in semiconductor and nanotechnology and IT
revolution gave way to the development of miniature/tiny
embedded systems.
• The first recognised modern embedded system is the Apollo
Guidance Computer (AGC) developed by the MIT Instrumentation
Laboratory for the lunar project/expedition carried out by a team..
• It was designed to provide guidance, navigation, and control for the
Apollo spacecraft
12
History of Embedded Systems
• AGC Specification:
• It had 36K words of fixed memory(ROM-72 KB) and 2K words of
erasable memory.(RAM- 332kb)
• The clock frequency of was 1.024 MHz and it was derived from a
2.048 MHz crystal clock.
• The first mass-produced embedded system was the Autonetics D-17
guidance computer for the Minuteman-I missile in 1961.
• It was built using discrete transistor logic and a hard-disk for main
memory.
• The first integrated circuit was produced in September 1958 and
computers using them began to appear in 1963.
13
Classification of Embedded Systems
14
1. Classification Based on Generation
• First Generation - 1960
• Second Generation - 1970
• Third Generation - 1980
• Fourth Generation - 1990
• Next Generation
15
Classification Based on Generation
(continued)
• First Generation (1970-1990)
• Early embedded systems were built around 8-bit microprocessors
like 8085 and Z80 and 4-bit microcontrollers.
• Simple in hardware circuits with firmware developed in assembly
code.
• These systems used individual components like transistors and
resistors.
16
Classification Based on Generation (continued)
• First Generation examples:
• Digital telephone keypads, stepper motor control units, etc.
• D-17B computer, developed by Autonetics in 1965 for the
Minuteman I missile guidance system.
• The first modern, real-time embedded computing system 1960:
• The Apollo Guidance Computer (AGC), developed in the 1960s at
MIT for the Apollo Program.
17
Classification Based on Generation (continued)
• Second Generation (1970s)
• Embedded systems built around 16-bit microprocessors and 8-bit
or 16-bit microcontrollers.
• Instruction set were much more complex and powerful than the
first generation.
• It was powerful and sophisticated systems than the first
generation.
• Some of the second-generation embedded systems contained
embedded operating systems for their operation.
• E.g.: Data acquisition systems, SCADA systems(Supervisory Control And Data
Acquisition, etc.
18
Classification Based on Generation (continued)
• Third Generation 1980s
• Embedded systems built around 32-bit microprocessors and
16-bit microcontrollers.
• Application and domain specific processors/controllers
• Such as Digital Signal Processors (DSP) and Application
Specific Integrated Circuits (ASICs) came into picture.
• The instruction set of processors became more complex(CISC)
and powerful and the concept of instruction pipelining also
evolved.
19
Classification Based on Generation (continued)
20
Classification Based on Generation (continued)
• Fourth Generation 1990s
• The advent of System on Chips (SoC), reconfigurable processors
and multicore processors are bringing these features
• High performance,
• Tight integration and
• Miniaturization into the embedded device market.
• The SoC technique implements a total system on a chip by
implementing different functionalities with a processor core on
an integrated circuit.
21
Classification Based on Generation (continued)
22
Classification Based on Generation
(continued)
• Next Generation(present technology)
• The processor and embedded market is highly dynamic
and demanding.
• The next generation embedded systems are expected to
meet growing demands in the market.
• Communication with server on the cloud computing
23
Demands in the market
• Security:
• Hardware-level encryption and multi-factor authentication to
protect data and systems from breaches
• AI and Machine Learning:
• Integration of AI and Machine Learning (ML) for predictive
maintenance, data analysis, and real-time decision-making
• Edge computing:
• Network connectivity for new functions related to control,
device status, and data
• Sustainability:
• Energy-efficient designs and power optimization to align with
the global emphasis on environmentally conscious technology
solutions (green computing)
24
2. Classification Based on Complexity and Performance
25
Classification Based on Complexity and Performance
(continued)
• Small-Scale Embedded Systems
• These systems use either a single 8 or 16-bit microprocessor or
controller.
• They have limited memory and processing power.
• They also have relatively lower hardware and software
complexities.
• They may or may not contain an operating system for their
functioning.
• Usually built around low performance and low cost 8-bit or 16-bit
microprocessors/microcontrollers.
26
Classification Based on Complexity and Performance
(continued)
• Small-Scale Embedded Systems
• They are majorly found in gadgets like electronic toys, smartcards,
etc.
• The main programming tools used for these systems include an
editor, cross assembler, and integrated development environment
(IDE).
• Simple in application needs and the performance requirements
are not time critical.
• E.g.: An electronic toy, smart cards, simple home appliances, etc.,
27
Classification Based on Complexity and Performance
• Medium-Scale Embedded Systems
• These come with 16-bit or 32-bit microprocessors or
controllers, ASICs (Application Specific Integrated Circuit), or
DSPs.
• Also, they have a fair amount of memory and processing
power.
• These systems have complexities in both hardware and
software and run on a real-time operating system (RTOS).
• They are often employed in home appliances, medical devices,
and automotive systems.
• The main programming tools used for these systems include C, C++, JAVA, Visual C++, RTOS, etc.
28
Classification Based on Complexity and Performance
• Medium-Scale Embedded Systems
• Slightly complex in hardware and firmware (software)
requirements.
29
Based on Complexity and Performance (continued)
• Large-Scale Embedded Systems
• These systems have highly complex hardware and software, like ones
built on 32-bit or 64-bit RISC processors,
• System-on-Chip (SoC), processors/controllers, and scalable and
configurable processors.
• A high-performance real-time OS is usually required for task
scheduling, prioritization, and management.
• They are used in innovative applications that demand hardware and
software design.
• Such as aerospace technologies, industrial automation, and wireless
communication systems.
30
Classification Based on Complexity and
Performance (continued)
• Highly complex in hardware and firmware (software) requirements.
• They are employed in mission critical applications
demanding high performance.
• Decoding/encoding of media, cryptographic function
implementation, etc. are examples of processing requirements
which can be implemented using a co-processor/hardware
accelerator.
31
3. Classification Based on Deterministic Behaviour
33
Classification Based on Deterministic Behaviour
34
4. Classification Based on Triggering
• Event-triggered systems
• Time-triggered systems
35
Classification Based on Triggering
Event-triggered systems
• These systems rely on specific external events or activities to
initiate tasks.
• They respond to changes in variables
• Such as temperature, pressure, or user inputs, making them
more adaptive to their environment.
• They are particularly suited for applications requiring
immediate responses or real-time reactions, such as intrusion
detection systems, medical device monitoring, etc.
36
Classification Based on Triggering
Time-triggered systems
• These systems are activated or initiated at pre-determined
intervals or at a specific point in time.
• In these systems, the tasks are scheduled to be executed based
on a predefined time or periodic timer, which ensures the
timely and consistent execution of processes.
• They are used for data collection, industrial systems with
routine control loops, and scheduled car maintenance systems.
37
Major Application Areas of Embedded Systems
38
Major Application Areas of Embedded Systems
(continued)
6. Computer peripherals: Printers, scanners, fax machines, etc.
7. Computer networking systems: Network routers, switches, hubs,
firewalls, etc.
8. Healthcare: Different kinds of scanners, EEG, ECG machines, etc.
9. Measurements & Instrumentation: Digital multimeters, digital
CROs, logic analyzers, PLC systems, etc.
10. Banking & Retail: Automated teller machines (ATM) and currency
counters, point of sales (POS), etc.
11. Card readers: Barcode, smart card readers, hand held devices, etc.
39
Purpose of Embedded Systems
40
Purpose of Embedded Systems (continued)
1. Data Collection/Storage/Representation
• Embedded systems 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.
• The term "data" refers all kinds of information, viz. text, voice, image,
video, electrical signals and any other measurable quantities.
• Data can be either analog (continuous) or digital (discrete).
• The collected data may be stored or transmitted, or it may be
processed, or it may be deleted instantly after giving a meaningful
representation.
41
Purpose of Embedded Systems (continued)
42
Purpose of Embedded Systems (continued)
2. Data Communication
• Embedded data communication systems are deployed in
applications ranging from complex satellite communication systems
to simple home networking systems(IoT).
• The transmission is achieved either by a wire- line medium or by a
wireless medium.
• The data collecting embedded terminal itself can incorporate data
communication units like
• wireless modules (Bluetooth, ZigBee, Wi-Fi, EDGE, GPRS,
etc.) or
• wire-line modules (RS- 232C, USB, TCP/IP, PS2, etc.).
43
Purpose of Embedded Systems (continued)
44
Purpose of Embedded Systems (continued)
45
Purpose of Embedded Systems (continued)
46
Purpose of Embedded Systems (continued)
4. Monitoring
• Almost embedded products coming under the medical domain
are used for monitoring.
• A very good example is the Electro Cardio Gram (ECG) machine
for monitoring the heartbeat of a patient.
• The machine is intended to do the monitoring of the
heartbeat.
• It cannot impose control over the heartbeat.
• The sensors used in ECG are the different electrodes
connected to the patient's body.
47
Purpose of Embedded Systems
(continued)
48
Purpose of Embedded Systems (continued)
5. Control
• Embedded systems with control functionalities impose control
over some variables according to the changes in input variables.
• A system with control functionality contains both sensors and
actuators.
• Sensors are connected to the input port for capturing the
changes in environmental variable or measuring variable.
• The actuators connected to the output port are controlled
according to the changes in input variable to put an impact on
the controlling variable to bring the controlled variable to the
specified range.
49
Purpose of Embedded Systems (continued)
50
Purpose of Embedded Systems (continued)
6. Application Specific User Interface
• These are embedded systems with
application-specific user interfaces like
buttons, switches, keypad, lights, bells, display
units, etc.
• Cell phone is an example for this.
• Example: A cell phone with an application-
specific user interfaces
• In mobile phone the user interface is provided A cell phone
through the keypad, graphic LCD module,
system speaker, vibration alert, etc.
51
A Typical Embedded System
52
➢A typical embedded system (Fig. 2.1) contains a single chip controller ,
it can be
✓ Microprocessor' (e.g. Intel 8085)
✓ Microcontroller (e.g. Atmel AT89C51)
✓ Field Programmable Gate Array (FPGA) device (e.g. Xilinx Spartan)
✓ Digital Signal Processor (DSP)
(e.g. Blackfin® Processors from Analog Devices)
✓ Application Specific Integrated Circuits
(e.g. ADE7760 Single Phase Energy Metering IC)
• An embedded system can be viewed as a Reactive system.
• The control is achieved by processing the information coming
from the sensors and user interfaces and controlling some
actuators that regulate the physical variable.
60
General Purpose Processor (GPP) vs. Application-
Specific Instruction Set Processor (ASIP)
Application-Specific Instruction Set Processor (ASIP)
• ASIPs are processors with architecture and instruction set optimised to specific-
domain/application requirements (network processing, automotive, telecom, media
applications, digital signal processing, control applications, etc.
• Most of the embedded systems are built around application specific instruction
set processors.
• Some microcontrollers (like automotive AVR, USB AVR from Atmel), system on
chips, digital signal processors, etc. are examples for application specific
instruction set processors (ASIPs).
• ASIPs incorporate a processor and on-chip peripherals, demanded by the application
requirement, program and data memory.
61
b). Microcontrollers
• A Microcontroller is an integrated chip that contains a CPU, scratch pad
RAM, special and general-purpose register arrays, on chip ROM/FLASH
memory for program storage, timer and interrupt control units and
dedicated I/O ports.
• A microcontroller contains all the necessary functional blocks for
independent working.
• Having greater place in embedded domain in place of microprocessors.
• They are cheap, cost effective and are readily available in the market.
• Ex: Atmel, Texas Instruments, Toshiba, Philips, Freescale, NEC, Zilog, Hitachi, Mitsubishi,
Infineon, ST Micro Electronics, National, Microchip, Analog Devices, Daewoo, Intel,
Maxim, Sharp, Silicon Laboratories, TDK, Triscend, Winbond, etc. are the key players in
the microcontroller market.
62
c). Digital Signal Processors – domain specific
• Digital Signal Processors (DSPs) are powerful special purpose
8/16/32 bit microprocessors
• Designed specifically to meet the computational demands and power
constraints of today's embedded audio, video, and communications
applications.
• Digital signal processors are 2 to 3 times faster than the general-
purpose microprocessors in signal processing applications.
• This is because of the architectural difference between the two.
• DSPs implement algorithms in hardware which speeds up the execution
whereas general purpose processors implement the algorithm in
firmware
63
c). Digital Signal Processors
64
DSP
66
RISC vs. CISC Processors/Controllers
68
RISC CISC
• Lesser Number of instructions • Greater number of Instructions
• Instruction pipelining and increased • Generally no instruction pipelining feature
execution speed
• Orthogonal instruction set (Allows each • Non-orthogonal instruction-set (All instructions are not allowed to
instruction to operate on any register and operate on any register and use any addressing mode. It is
use any addressing mode) instruction-specific)
• Operations are performed on registers only, • Operations are .'performed on registers or memory depending on the
the only memory operations are load and instruction
store
• A large number of registers are available • Limited number of general purpose registers
• Programmer needs to write more code to • Instructions are like macros in C language. A programmer .can
execute a task since the instructions are achieve the desired functionality with a single instruction which in
simpler ones turn provides the effect of using more simpler single instructions in
RISC
70
The concept of Load Store Architecture
71
• Suppose x, y and z are memory locations and we want to add the
contents of x and y and store the result in location z.
• Under the load store architecture, the same is achieved with 4
instructions
• The first instruction load Rl, x loads the register R1 with the
content of memory location x,
• the second instruction load R2,y loads the register R2 with the
content of memory location y.
• The instruction add R3, Rl, R2 adds the content of registers Rl
and R2 and stores the result in register R3.
• The next instruction store R3,z stores the content of register R3
in memory location z.
72
• The conventional instruction execution by the processor follows
the fetch-decode-execute sequence.
• Where the ‘fetch’ part fetches the instruction from program
memory or code memory.
• The decode part decodes the instruction to generate the
necessary control signals.
• The execute stage reads the operands, perform ALU operations
and stores the result.
• In conventional program execution, the fetch and decode
operations are performed in sequence.
73
• For simplicity let’s consider decode and execution together.
• During the decode operation the memory address bus is available
and if it is possible to effectively utilize it for an instruction fetch,
the processing speed can be increased.
• In its simplest form instruction pipelining refers to the
overlapped execution of instructions.
• Depending on the stages involved in an instruction (fetch, read
register and decode, execute instruction, access an operand in
data memory, write back the result to register, etc.), there can be
multiple levels of instruction pipelining.
74
The three-stage pipelining concept
75
4. Programmable Logic Devices
77
Programmable Logic Devices (continued)
• There are no NRE costs (Non-Recurring Engineering costs are
one-time costs that are incurred during the pre-production
phase of a new product or product enhancement.)
• They include the costs of research, design, development,
testing, and other functions required to create the product.
• The final design is completed much faster than that of a
custom, fixed logic device.
78
Programmable Logic Devices (continued)
79
5.Commercial Off-the-Shelf Components (COTS)
80
5.Commercial Off-the-Shelf Components (COTS)
• Advantages:
• They are readily available in the market
• Cheap means less expensive
• Developer can cut down his development time to a
great extent
• Reduces the time to market
81
Commercial Off-the-Shelf Components (COTS)
(continued)
82
Commercial Off-the-Shelf Components (COTS)
(continued)
83
Memory
• Memory is an important part of a Microprocessor/
Microcontroller based embedded systems.
• On-chip and off-chip memory
• If the processors/controllers contain built in memory and this
memory is referred as on-chip memory.
• Others do not contain any memory inside the chip and requires
external memory to be connected with the controller/processor to
store the control algorithm. It is called off-chip memory.
• Also, some working memory is required for holding data temporarily
during certain operations.
84
Types of memory used in embedded system
applications
85
A. Program Storage Memory (ROM):
• The program memory or code storage memory of an
embedded system stores the program instructions. The code
memory retains its contents even after the power is turned off. It
is generally known as non-volatile storage memory.
1. Masked ROM (MROM)
2. Programmable Read Only Memory (PROM) / (OTP)
3. Erasable Programmable Read Only Memory (EPROM)
4. Electrically Erasable Programmable Read Only Memory (EEPROM)
5. FLASH
86
Program Storage Memory (ROM)
1. Masked ROM (MROM):
• Masked ROM is a one-time programmable device("hard-wired
ROM," )
• Mask ROM is programmed during the manufacturing process (such
as for storing firmware and system code) and we can't alter it
afterward
• The device is factory programmed according to the data provided
by the end user.
• The primary advantage of this is low cost for high volume
production. They are the least expensive type of solid state
memory.
87
Program Storage Memory (ROM)
1. Masked ROM (MROM):
• Masked ROM is a good for storing the embedded firmware
for low cost embedded devices.
• Once the design is proven and the firmware requirements are
tested and frozen, the binary data (The firmware cross
compiled/assembled to. target processor specific machine
code) corresponding to it can be given to the MROM
fabricator.
• The limitation with MROM based firmware storage is the
inability to modify the device firmware against firmware
upgrades.
88
Program Storage Memory (ROM)
2.Programmable Read Only Memory (PROM) / (OTP)
• Unlike Masked ROM Memory, One Time Programmable Memory
(OTP) or PROM is not pre-programmed by the manufacturer.
• The end user is responsible for programming these devices.
• This memory has nichrome or polysilicon wires arranged in a
matrix.
• It is programmed by a PROM programmer which selectively bums
the fuses according to the bit pattern to be stored.
89
Program Storage Memory (ROM)
• Fuses which are not blown/burned represents a logic “1” whereas
fuses which are blown/bumed represents a logic “0”.
• The default state is logic “1”.
• OTP is widely used for commercial production of embedded
systems whose proto-typed versions are proven and the code is
finalized.
• It is a low cost solution for commercial production.
• PROMs are often used in microcontrollers based applications,
mobile phones, video game consoles, and other consumer and
automotive electronics.
90
Program Storage Memory (ROM)
3. Erasable Programmable Read Only Memory (EPROM)
• OTPs are not useful and worth for development purpose.
• During the development phase the code is subject to continuous
changes and using an OTP each time to load the code is not
economical.
• Erasable Programmable Read Only Memory (EPROM) gives the
flexibility to re-program the same chip.
• EPROM stores the bit information by charging the floating gate of
an FET.
91
Program Storage Memory (ROM)
92
Program Storage Memory (ROM)
4.Electrically Erasable Programmable Read Only Memory
(EEPROM)
• As the name indicates, the information contained in the EEPROM memory
can be altered by using electrical signals at the register/Byte level.
• They can be erased and reprogrammed in-circuit.
• These chips include a chip erase mode and in this mode they can be
erased in a few milliseconds.
• It provides greater flexibility for system design. The only limitation is their
capacity is limited when compared with the standard ROM (A few
kilobytes).
93
Program Storage Memory (ROM)
5. FLASH
• FLASH is the latest ROM technology and is the most popular ROM
technology used in today’s embedded designs.
• FLASH memory is a variation of EEPROM technology.
• It combines the re-programmability of EEPROM and the high
capacity of standard ROMs.
• FLASH memory is organized as sectors (blocks) or pages.
• FLASH memory stores information in an array of floating gate MOS-
FET transistors.
94
Program Storage Memory (ROM)
95
B. Read-Write Memory/Random Access Memory (RAM)
96
1. Static RAM (SRAM)
97
2.Dynamic RAM (DRAM)
• Dynamic RAM stores data in the form of charge.
• They are made up of MOS transistor gates.
• Advantages – high density and low cost compared to SRAM.
• Disadvantage – since the information is stored as charge it gets
leaked off with time and to prevent this they need to be refreshed
periodically.
• Special circuits called DRAM controllers are used for the refreshing
operation.
• The refresh operation is done periodically in milliseconds interval.
98
Dynamic RAM (DRAM)
• The relative merits and demerits of SRAM and DRAM technology.
SRAM Cell DRAM Cell
Made up of 6 CMOS transistors Made up of a MOSFET and a capacitor
(MOSFET)
Doesn't require refreshing Requires refreshing
Low capacity (Less dense) High capacity (Highly dense)
More expensive Less expensive
Fast in operation. Typical access time Slow in operation due to refresh requirements.
is 10ns Typical access time is 60ns. Write operation is
faster than read operation.
99
NVRAM - Non-volatile RAM
3.NVRAM(Non-volatile RAM )
• Non-volatile RAM is a random-access memory with battery
backup.
• It contains 5 static RAM based memory and a minute battery
for providing supply to the memory in the absence of external
power supply.
• The memory and battery are packed together in a single
package.
• The life span of NVRAM is expected to be around 10 years.
100
C. Memory According to the Typeof Interface
101
C. Memory According to the Typeof Interface
102
Memory Selection for Embedded Systems
(continued)
• There are two parameters for representing a memory:
• Size of the memory chip
• Word size of the memory
104
PART B:
Embedded system Development Environment – Block diagram
(excluding Keil), Disassembler/decompiler, simulator, emulator
and debugging techniques, target hardware debugging, boundary
scan
Chapter 13 from Text book 02(Shibu K V, “Introduction to
Embedded Systems”)
105
A typical embedded system development environment is illustrated in Figure
2. (IDE)
5. Signal sources
3. (EDA)
1. Host
4. An emulator
hardware
7. target
hardware
6. hardware
debugging
tools
106
The development environment consists of
1. A Development Computer (PC) or Host, which acts as the
heart of the development environment.
2. Integrated Development Environment (IDE) Tool for
embedded firmware development and debugging.
3. Electronic Design Automation (EDA) Tool for Embedded
Hardware design.
107
4. An emulator hardware for debugging the target board,
5. Signal sources (like Function generator) for simulating
the inputs to the target board.
6. Target hardware debugging tools (Digital CRO,
Multimeter, Logic Analyzer, etc.) and
7. The target hardware.
108
2. THE INTEGRATED DEVELOPMENT ENVIRONMENT
(IDE)
• It is an integrated environment for developing and debugging
the target processor specific embedded firmware.
• IDE is a software package which bundles
• A ‘Text Editor (Source Code Editor)’,
• ‘Cross-compiler
• ‘Linker’ and
• ‘Debugger’.
109
Some IDEs may provide
• Interface to target board emulators,
• Target processor’s/controller’s flash memory programmer,
etc.
• IDEs can be either command line-based, or GUI based.
• Command line-based ides may include little or less GUI
support.
• GUI based ides provide a visual development environment with
mouse click support for each action. Such ides are generally
known as visual ides.
110
• IDEs used in embedded firmware development are slightly
different from the generic/basic IDEs(high level language-
based development for desktop applications).
• In Embedded Applications, the IDE is either supplied by the
target processor/controller manufacturer or by third party
vendors or as Open Source.
• Ex: MPLAB is an IDE tool supplied by microchip for developing
embedded firmware using.
• Keil pVision3 from Keil software is an example for a third party IDE,
which is used for developing embedded firmware.
111
TYPES OF FILES GENERATED ON CROSS-COMPILATION
• Cross-compilation is the process of converting a source code
written in high level language (like ‘Embedded C’) to a target
processor/controller understandable machine code
• Example: ARM processor or 8051 microcontroller specific machine
code).
• The conversion of the code is done by software running on a
processor/controller.
• “The software performing this operation is referred as the
‘Cross-compiler”.
• In a single word cross-compilation is the process of cross
platform software/firmware development .
112
• Cross assembling is like cross-compiling; the only difference
is that the code written in a target processor/controller
specific Assembly code is converted into its corresponding
machine code.
• The application converting Assembly instruction to target
processor/controller specific machine code is known as
“cross-assembler.”
• Cross- compilation/cross-assembling is carried out in
different steps and the process generates various types of
intermediate files.
113
The various files generated during the cross -compilation/cross-
assembling process are:
1. List File (.1st),
2. Hex File (.hex),
3. Pre-processor Output file,
4. Map File (File extension linker dependent),
5. Object File (.obj)
114
DISASSEMBLER/DECOMPILER
115
• Decompiler performs the reverse operation of compiler/cross-
compiler.
• The disassemblers/decompiler for different family of
processors/controllers are different.
• Disassemblers/Decompiler are deployed in reverse
engineering.
• Reverse engineering is the process of revealing the technology
behind the working of a product.
116
• Disassemblers/Decompilers are powerful tools for analysing
the presence of malicious codes (virus information) in an
executable image.
• Disassemblers/Decompilers are available as either freeware
tools readily available for free download from internet or as
commercial tools.
• It is not possible for a disassembler/decompiler to generate an
exact replica of the original assembly code/high level source
code in terms of the symbolic constants and comments used.
117
SIMULATORS, EMULATORS AND DEBUGGING
119
Simulator-based debugging
• Simulators simulate the target hardware, and the firmware
execution can be inspected using simulators.
• The features of simulator-based debugging are listed below.
1. Purely software based
2. Doesn’t require a real target system
3. Very primitive (Everything is a simulated one)
4. Lack of Real-time behaviour
120
Advantages of Simulator Based Debugging
• Simulator based debugging techniques are simple and
straightforward.
1. No Need for Original Target Board:
• Simulator based debugging technique is purely software
oriented.
• IDE’s software support simulates the CPU of the target board.
• User only needs to know about the memory map of various
devices within the target board.
• Since the real hardware is not required, firmware
development can start well in advance immediately after the
device interface and memory maps are finalized.
• This saves development time.
121
Advantages of Simulator Based Debugging
122
3. Simulates Abnormal Conditions:
• With simulator’s simulation support we can input any
desired value for any parameter during debugging the
firmware and can observe the control flow of firmware.
• It really helps the developer in simulating abnormal
operational environment for firmware.
• So it helps the firmware developer to study the behaviour of
the firmware under abnormal input conditions.
123
Limitations of Simulator based Debugging
124
Limitations of Simulator based Debugging
125
Emulators and Debuggers
126
What is debugging and why debugging is required?
127
Emulators and Debuggers
1. Hardware debugging:
• It deals with the monitoring of various bus signals and
checking the status lines of the target hardware.
2. Firmware debugging: It deals with
• Examining the firmware execution,
• Execution flow,
• Changes to various CPU registers and
• Status registers on execution of the firmware to ensure
that the firmware is running as per the design.
128
Why is debugging required?
• Firmware debugging is performed to discover the bug or the error
in the firmware which creates the unexpected behaviour.
• Firmware is analogous to the human body in the sense it is
widespread and/or modular.
• Any abnormalities in any area of the body may lead to sickness.
• How is the region causing illness identified correctly when you are
sick?
• If we look back, where no sophisticated diagnostic techniques
were available, only a skilled doctor was capable of identifying
the root cause of illness, that too with his solid experience.
129
Why is debugging required?
130
• During the early days of embedded system development, there
were no debug tools available and the only way was “Burn the
code in an EEPROM and pray for its proper functioning”.
• If the firmware does not crash, the product works fine, If the
product crashes, the developer is unlucky.
• He needs to sit back and rework on the firmware till the
product functions in the expected way.
131
• Most of the time the developer had to seek the help of an
expert to figure out the exact problem creator.
• As technology has achieved a new dimension from the early
days of embedded system development, various types of
debugging techniques are available today.
132
• A brief history of firmware debugging
133
1. Incremental EEPROM Burning Technique
135
2. Inline Breakpoint Based Firmware Debugging
• In-line breakpoint-based firmware debugging is a method where
we insert debugging code (like printf statements) directly into the
firmware to check if the code is executing as expected at specific
points.
• Firmware: It is a combination of both hardware and firmware. It is a type of
software, specifically low-level code embedded in hardware, Which controls
the device's basic functions.
• This technique essentially functions as a simple breakpoint
system,
• Allowing to print messages to a terminal or logger to track the
program's flow and verify if it's reaching the intended locations.
136
2. Inline Breakpoint Based Firmware Debugging
137
3. Monitor Program Based Firmware Debugging
(supervisor program)
• Monitor program-based firmware debugging is the first adopted
aggressive method for firmware debugging.
• In this approach a monitor program which acts as a supervisor is
developed.
• Monitor program-based firmware debugging" refers to using a
specialized debugging tool, often a "monitor program", to
examine and control the execution of firmware within a target
system.
138
3. Monitor Program Based Firmware Debugging
(supervisor program)
• This allows developers to identify and resolve issues in the
firmware while it's running, which is crucial for debugging
embedded systems and other hardware-software
integrations
• The monitor program controls the downloading of user code
into the code memory, inspects and modifies
register/memory locations.
• The monitor program implements the debug functions as per
a pre-defined command set from the debug application
interface.
139
• The monitor program contains the following set of minimal features.
1. Command set interface to establish communication with the debugging
application
2. Firmware download option to code memory
3. Examine and modify processor registers and working memory (RAM)
4. Single step program execution
5. Set breakpoints in firmware execution
6. Send debug information to debug application running on host machine
140
4. In Circuit Emulator (ICE) Based Firmware
Debugging
141
4. In Circuit Emulator (ICE) Based Firmware
Debugging
142
• Figure illustrates the different subsystems and interfaces of an
‘Emulator’ device.
(Plug-On Device)
143
5. On-Chip Firmware Debugging (OCD)
144
5. On-Chip Firmware Debugging (OCD)
145
• Processors/controllers with OCD support incorporate a
dedicated debug module to the existing architecture.
• OCD module implements dedicated registers for controlling
debugging.
• An On-Chip Debugger can be enabled by setting the OCD enable
bit.
• Debug related registers are used for debugger control
(Enable/disable single stepping, Freeze execution, etc.) and
breakpoint address setting
146
Target Hardware Debugging
• Even though the firmware is bug free and everything is intact
in the board, our embedded product need not function as per
the expected behaviour in the first attempt.
• Because of various hardware related reasons like..
• Dry soldering of components,
• Missing connections in the PCB due to any un-noticed errors
in the PCB layout design,
• Misplaced components,
• Signal corruption due to noise, etc.
147
Target Hardware Debugging
• The only way to sort out these issues and figure out the real
problem creator is debugging the target board.
• Hardware debugging is not like firmware debugging.
• Hardware debugging involves the monitoring of various
signals of the target board (address/data lines, port pins, etc.).
• Checking the inter connection among various components,
circuit continuity checking, etc.,
• There are various hardware debugging tools available to use
in Embedded Product Development.
148
1. Magnifying Glass (Lens)
150
2. Multimeter
• A multimeter is used for measuring various electrical
quantities like
• Voltage (both AC and DC),
• Current (DC as well as AC),
• Resistance,
• Capacitance,
• Continuity checking,
• Transistor checking,
• Cathode and anode identification of diode, etc.
• Any multimeter will work over a specific range for each
measurement.
151
• A multimeter is the most valuable tool in the toolkit of an
embedded hardware developer.
• It is the primary debugging tool for physical contact-based
hardware debugging and almost all developers start debugging
the hardware with it.
• In embedded hardware debugging it is mainly used for
checking the “circuit continuity” between different points on
the board, measuring the supply voltage, checking the signal
value, polarity, etc.
• Both analog and digital versions of a multimeter are available.
152
3. Digital CRO
153
• Monitoring the crystal oscillator signal from the target board is a
typical example of the usage of CRO for waveform capturing and
analysis in target board debugging.
• CROs are available in both analog and digital versions.
• Though Digital CROs are costly, feature wise they are best suited
for target board debugging applications.
• Digital CROs are available for high frequency support, and they
also incorporate modem techniques for recording waveform over
a period of time, capturing waves on the basis of a configurable
event (trigger) from the target board
154
4. Logic Analyser
155
• In target board debugging applications, a logic analyser captures
the states of various port pins, address bus and data bus of the
target processor/controller, etc.
• Logic analysers give an exact reflection of what happens when a
particular line of firmware is running.
• This is achieved by capturing the address line logic and data line
logic of target hardware.
• Most modem logic analysers contain provisions for storing
captured data, selecting a desired region of the captured
waveform, zooming selected region of the captured waveform,
etc.
156
5. Function Generator
• Function generator is not a debugging tool. It is an input signal
simulator tool.
• A function generator can produce various periodic waveforms
like sine wave, square wave, saw-tooth wave, etc. with
different frequencies and amplitude.
• Sometimes the target board may require some kind of periodic
waveform with a particular frequency as input to some part of
the board.
• Thus, in a debugging environment, the function generator
serves the purpose of generating and supplying required
signals.
157
13.6 BOUNDARY SCAN
• As the complexity of the hardware increase, the number of chips
present in the board and the interconnection among them may
also increase in turn it will increase the complexity.
• The traditional methods used in the PCB become small to
reduce the total board space occupied by them and multiple
layers may be required to route the inter connections among the
chips.
• With small device packages and multiple layers for the PCB it will
be very difficult to debug the hardware using magnifying glass,
multimeter, etc. to check the interconnection among the various
chips.
158
• Boundary scan is a technique used for testing the
interconnection among the various chips, which support JTAG
(Joint Test Action Group) interface, present in the board.
• A JTAG port which contains the five signal lines namely
1.TDI (Test Data In)
2.TDO (Test Data Out)
3.TCK (Test Clock)
4.TMS (Test Mode Select)
5.TRST (Test Reset) optional.
• These form the Test Access Port (TAP) for a JTAG supported chip
and each device will have its own TAP.
• The PCB also contains a TAP for connecting the JTAG signal lines
to the external world.
159
This forms a boundary scan path. Figure illustrates the same.
Test Access
Port (TAP)
160
• A boundary scan path is formed inside the board by
interconnecting the devices through JTAG signal lines.
• The TDI pin of the TAP of the PCB is connected to the TDI pin of
the first device.
• The TDO pin of the first device is connected to the TDI pin of
the second device.
• In this way all devices are interconnected and the TDO pin of the
last JTAG device is connected to the TDO pin of the TAP of the
PCB.
• The clock line TCK and the Test Mode Select (TMS) line of the
devices are connected to the clock line and
• Test mode select line of the Test Access Port of the PCB
respectively.
161
• The boundary scan cell is a multipurpose memory cell.
• The boundary scan cell associated with the input pins of an IC
is known as input cells.
• The boundary scan cells associated with the output pins of an
IC is known as output cells.
• The boundary scan cells can be used for capturing the input
pin signal state and passing it to the internal circuitry,
capturing the signals from the internal circuitry and passing it
to the output pin, and shifting the data received from the Test
Data In pin of the TAP.
162
• The boundary scan cells associated with the pins are
interconnected and they form a chain from the TDI pin of the
device to its TDO pin.
• The boundary scan cells can be operated in
• Normal mode
• Capture mode
• Update mode
• Shift mode.
163
• ICs supporting boundary scan it contain additional boundary
scan related registers for facilitating the boundary scan
operation.
• Instruction Register,
• Bypass Register,
• Identification Register, etc.
• The Instruction Register is used for holding and processing
the instruction received over the TAP.
• The bypass register is used for bypassing the boundary scan
path of the device and directly interconnecting the TDI pin
of the device to its TDO.
164
• Different instructions are used for testing the interconnections
and the functioning of the chip.
• Extest, Bypass, Sample and Preload, Intest, etc. are examples
for instructions for different types of boundary scan tests,
• Whereas the instruction Runbist is used for performing a self
test On the internal functioning of the chip.
• The Runbist instruction produces a pass/fail result.
• Boundary Scan Description Language (BSDL) is used for
implementing boundary scan tests using JTAG.
• BSDL is a subset of VHDL and it describes the JTAG
implementation in a device.
165
• BSDL provides information on how boundary scan is implemented
in an integrated chip.
• The BSDL file is used as the input to a Boundary Scan Tool for
generating boundary scan test cases for a PCB.
• Automated tools are available for boundary scan test
implementation from multiple vendors.
• The ScanExpress Boundary Scan (JTAG) product from Corelis
Inc. (www.corelis.comJ is a popular tool for boundary scan test
implementation.
166
References
1. Shibu K V, “Introduction to Embedded Systems”, Tata McGraw Hill, 2009.
2. Raj Kamal, “Embedded Systems: Architecture and Programming”, Tata
McGraw Hill, 2008.
167