Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 130

Introduction to Real

Time Embedded Systems


Basics of Computer Architecture
 A computer, as its name indicates is a machine used for
computing. Computing, which many years ago meant arithmetic
calculations, has now given way to large amounts of ‘data
processing’. As such, it is more reasonable to designate the
computer now as a ‘data processing machine’.
 For performing its designated tasks, this machine requires many
components, which can broadly be divided as hardware and
software. Hardware is obviously, the physical constituents of a
computer. Software is the collection of programs which directs
the hardware to perform its tasks.
Th e major parts are the CPU, memory and input/output devices.
• The heart of a computer is the ‘central processing unit’.
• The CPU usually is a ‘microprocessor’, which means that it is
usually a separate and self contained chip.
• The CPU processes the data given to it, according to the programs
meant to operate on these data.
• The program consists of ‘instructions’.
• These instructions are decoded by the CPU, which generates
control signals necessary to activate the arithmetic and logic units
of the CPU. As such, the CPU contains the arithmetic logic unit
and the control unit.
• All these activities are timed and synchronized by a pulse train of
fixed frequency. This is the clock signal, and it also has the job of
synchronizing the activity of the CPU with the activity on the bus.
Introduction of Embedded System
• An embedded system is an electronic system which is designed to perform
one or a limited set of functions, using hardware and software.
• Electronic/Electro mechanical system which is designed to perform a specific
function and is a combination of both hardware and firmware (Software)
• Every embedded system is unique, and the hardware as well as the firmware
is highly specialized to the application domain.
• Embedded systems are becoming an inevitable part of any product or
equipment in all fields including household appliances, telecommunications,
medical equipment, industrial control, consumer products, etc.
• E.g. Electronic Toys, Mobile Handsets, Washing Machines, Air Conditioners,
Automotive Control Units, Set Top Box, DVD Player etc…
• Having hardware and software makes an embedded system a
computer, but this computer performs only a limited set of
functions. Thus, we exclude the PC from the embedded system
world, and name it as a general purpose computer.
• Therefore, an embedded system is a ‘special purpose’ computing
unit—meaning that it will have a processor and associated
software. The software associated with the application is ‘burned’
into the ROM of the processor; therefore, it is better to designate it
as a ‘firmware’.
• Take the case of an automobile, for example, a car. It has a number of
‘electronic control units (ECUs)’ as part of what is called ‘automobile
electronics’—each of these units has a processor, which controls one or other
of the various parts of the car such as engine, brakes, lights, doors and so on.
Application Domain of Embedded Systems
i) Consumer electronics: Cameras, music players, TVs, DVD players,
microwave ovens, washing machines, refrigerators and remote controls.
ii) Household appliances/home security systems: Air-conditioners,
intruders and fire alarm systems.
ii) Automobile controls: Anti-lock braking system, engine and
transmission control,
door and wiper control, etc.
iv) Hand-held devices: Mobile phones, PDAs, MP3 players, digicams,
etc.
v) Medical equipments: Scanners, ECG and EEG units, testing and monitoring
equipments.
vi) Banking: ATMs, currency counters, etc.
vii) Computer peripherals: Printers, scanners, webcams, etc.
viii) Networking: Routers, switches, hubs, etc.
ix) Factories: Control, automation, instrumentation and alarm systems.
xi) Aviation: Airplane controls, guidance and instrumentation systems.
xii) Military: Control and monitoring of military equipment's.
xiii) Robotics: Used in factories, household and hobby-related activities.
xiii) Toys
Desirable Features and General Characteristics
of Embedded Systems
 It should have one or a small set of functions which it is expected to
perform efficiently.
It should be designed for low-power dissipation, because many systems are
battery powered.
It has limited memory and limited number of peripherals.
Applications are not meant to be alterable by the user.
Many of them are not accessible directly, that is, they may be part of the
control unit of a larger system, so no interference in operation is possible.
They need to be highly reliable.
Many of them need to operate with time constraints.
EMBEDDED SYSTEMS VS. GENERAL
COMPUTING SYSTEMS
Smart phones ?
• the a dividing line between desktop systems and embedded systems in certain
areas of embedded applications are shrinking in certain contexts.
• Smart phones are typical examples of this. Nowadays smart phones are
available with RAM 2 to 3 GB and users can extend most of their desktop
applications to the smart phones and it invalidates the clause “Embedded
systems are designed for a specific application” from the characteristics of
the embedded system for the mobile embedded device category.
• smart phones come with a built-in operating system and it is not modifiable
by the end user. It makes the clause: “The firmware of the embedded system
is unalterable by the end user”, still a valid clause in the mobile embedded
device category.
History of Embedded Systems
• Embedded systems were in existence even before the IT
revolution. In the olden days, embedded systems were built around
the old vacuum tube and transistor technologies and the embedded
algorithm was developed in low level languages.
• Advances in semiconductor and nano-technology and IT
revolution gave way to the development of miniature embedded
systems.
• With this realization, the personal computing sector grew and along with that,
the idea of embedding intelligence into computer chips took new wings. It was
realized that along with a computational engine, other functions can be
incorporated into a single chip.
• Memory and other functional blocks, when added to a microprocessor gave it
the name microcontroller or embedded processor.
• It was actually the development of the concept of such types of processing
units with peripherals and memory on a single chip that gave the necessary
impetus for the growth of embedded systems.
• Two engineers in TI (Texas Instruments), Gary Boone and Michael Cochran,
are credited with creating the fi rst microcontroller TMS 1000, which became
a commercial product in 1974. It had ROM, RAM and clock circuitry on the
chip along with the processing unit.
• In 1977, Intel emerged in this field with the 8048, a microcontroller which
had RAM and ROM and which became widely used in PC keyboards.
• In 1980, Intel introduced the 8051 MCU and called it MCS-51
architecture. Over the years, it became very popular especially because
Intel allowed others also to manufacture and sell it.
• In 1982, Intel introduced the 80186 and called it an embedded processor.
• It had the same computing engine as the 8086, but had a number of
peripherals inside it, like timers, DMA controllers, clock generators and so
on. Th is chip was never used in PCs—all its applications were in
embedded products.
• Other popular microcontroller series are PIC by Microchip and ATMega
by AVR. Besides this there are a number of smaller players also in the
market.
• Th is outlook that microcontrollers alone paved the way for the
development of the embedded industry development may not very
true, however. If we look at any embedded system today, we know
that it is not ‘electronics’ alone that has made miraculous strides.
• Along with electronics, sensors, actuators, displays, mechanical
parts and software developments have also made giant strides to
fuel the growth of the embedded industry.
What are the challenges in this field now?
• New and innovative products are continually appearing in the market. The
three Ps of innovation frequently highlighted are ‘Price, Performance and
Power’.
• This obviously means that performance needs to be increased, but keeping
power dissipation and price as low as possible. This translates to using low-
power dissipating processors, sensors and actuators, all of which must be able
to boast of high performance.
• The factors performance and power dissipation directly conflict each other,
and keeping prices low is an additional issue. But in spite of all these
challenges, the embedded industry is moving ahead in leaps and bounds.
Real Time Embedded System
Real Time
• “‘Real’-time usually means time as prescribed by external sources”
• For example the time struck by clock (however fast or late it might be). The timings
generated by your requirements. You may like to call someone at mid-night and send
him a picture. This external timing requirements imposed by the user is the real-time
for the embedded system.
• Embedded (Embodiment)
• “Embodied phenomena are those that by their very nature occur in real time
and real space”
• In other words, A number of systems coexist to discharge a specific function in
real time.
• “A Real Time Embedded System” (RTES) is precisely the union of subsystems
to discharge a specific task coherently. Hence forth we call them as RTES.
Characteristics of an RTES
Single-Functioned
• Here “single-functioned” means specific functions. The RTES is usually
meant for very specific functions. Generally a special purpose
microprocessor executes a program over and over again for a specific
purpose.
• If the user wants to change the functionality, e.g. changing the mobile
phone from conversation to camera mode or calculator mode the
program gets flushed out and a new program is loaded which carries out
the requisite function.
• These operations are monitored and controlled by an operating system
called as Real Time Operating System (RTOS) which has much simpler
complexity but more rigid constraints as compared to the conventional
operating systems such as Micro Soft Windows and Unix etc
Tightly Constrained
• The constraints on the design and marketability of RTES are more rigid than
their non-real-time non-embedded counter parts.
• Time-domain constraints are the first thing that is taken care while developing
such a system. Size, weight, power consumption and cost are the other major
factors.
Reactive and Real Time
• Many embedded systems must continually react to changes in the
system’s environment and must compute certain results in real time
without delay.
• For example, a car’s cruise controller continually monitors and reacts
to speed and brake sensors. It must compute acceleration or
deceleration amounts repeatedly within a limited time; a delayed
computation could result in a failure to maintain control of the car.
Common Architecture of Real Time Embedded
Systems
• Any system can hierarchically divided into subsystems. Each sub-system may
be further segregated into smaller systems. And each of these smaller systems
may consist of some discrete parts. This is called Hardware configuration.
• these parts may be programmable and therefore must have some place to keep
these programs.
• In RTES the on-chip or on-board non-volatile memory does keep these
programs. These programs are the part of the Real Time Operating System
(RTOS) and continually run as long as the gadget is receiving power.
• A part of the RTOS also executes itself in the stand-by mode while taking a
very little power from the battery. This is also called the sleep mode of the
system.
• Both the hardware and software coexist in a coherent manner. Tasks which can
be both carried out by software and hardware affect the design process of the
system.
• For example a multiplication action may be done by hardware or it can be done
by software by repeated additions.
• Hardware based multiplication improves the speed at the cost of increased
complexity of the arithmetic logic unit (ALU) of the embedded processor.
• On the other hand software based multiplication is slower but the ALU is
simpler to design.
• These are some of the conflicting requirements which need to be resolved on
the requirements as imposed by the overall system. This is known as
Hardware-Software Codesign or simply Codesign.
• A Desktop Computer will have more open standards than an Embedded
System. This is because of the level of integration in the later.
• Many of the components of the embedded systems are integrated on to a
single chip. This concept is known as System on Chip (SOC) design. Thus
there are only few subsystems left to be connected.
Architecture of an Embedded System
The explanation of various parts as follows:
• User Interface: for interacting with users. May consists of keyboard, touch
pad etc
• ASIC: Application Specific Integrated Circuit: for specific functions like
motor control, data modulation etc.
• Microcontroller(μC): A family of microprocessors
• Real Time Operating System (RTOS): contains all the software for the system
control and user interface
• Controller Process: The overall control algorithm for the external process. It
also provides timing and control for the various units inside the embedded
system.
• Digital Signal Processor (DSP) a typical family of microprocessors
• DSP assembly code: code for DSP stored in program memory
• Dual Ported Memory: Data Memory accessible by two processors at the
same time
• CODEC: Compressor/Decompressor of the data
• User Interface Process: The part of the RTOS that runs the software for User
Interface activities
• Controller Process: The part of the RTOS that runs the software for Timing
and Control amongst the various units of the embedded system
Classification of Embedded Systems:
• Based on Generation
• Based on Complexity & Performance Requirements
• Based on deterministic behavior
• Based on Triggering
Based on Generation
• First Generation: The early embedded systems built around 8-bit
microprocessors like 8085 and Z80 and 4-bit microcontrollers.
• EX. stepper motor control units, Digital Telephone Keypads etc.
• Second Generation: Embedded Systems built around 16-bit microprocessors
and 8 or 16-bit microcontrollers, following the first generation embedded
systems.
• EX.SCADA, Data Acquisition Systems etc.
• Third Generation: Embedded Systems built around high performance 16/32
bit Microprocessors/controllers, Application Specific Instruction set
processors like Digital Signal Processors (DSPs), and Application Specific
Integrated Circuits (ASICs).The instruction set is complex and powerful.
• EX. Robotics, industrial process control, networking etc
• Fourth Generation: Embedded Systems built around System on Chips (SoC’s),
Reconfigurable processors and multicore processors. It brings high
performance, tight integration and miniaturization into the embedded device
market.
• EX Smart phone devices, MIDs etc
• Embedded Systems - Classification based on Complexity & Performance
Small Scale: The embedded systems built around low performance and low cost 8
or 16 bit microprocessors/ microcontrollers. It is suitable for simple applications
and where performance is not time critical. It may or may not contain OS.
Medium Scale: Embedded Systems built around medium performance, low cost
16 or 32 bit microprocessors / microcontrollers or DSPs. These are slightly complex
in hardware and firmware. It may contain GPOS/RTOS.
Large Scale/Complex: Embedded Systems built around high performance 32 or 64
bit RISC processors/controllers, RSoC or multi-core processors and PLD. It requires
complex hardware and software.
These system may contain multiple processors/controllers and co-units/hardware
accelerators for offloading the processing requirements from the main processor.
It contains RTOS for scheduling, prioritization and management.
• Embedded Systems - Classification Based on deterministic behavior:
It is applicable for Real Time systems. The application/task execution behavior for an
embedded system can be either deterministic or non-deterministic These are
classified in to two types
1. Soft Real time Systems: Missing a deadline may not be critical and can be
tolerated to a certain degree
2. Hard Real time systems: Missing a program/task execution time deadline can have
catastrophic consequences (financial, human loss of life, etc.)

• Embedded Systems - Classification Based on Triggering:


These are classified into two types 1. Event Triggered : Activities within the system
(e.g., task run-times) are dynamic and depend upon occurrence of different events .
2. Time triggered: Activities within the system follow a statically computed schedule
(i.e., they are allocated time slots during which they can take place) and thus by
nature are predictable.
Purpose of Embedded Systems:
• The air compressor unit acts as the actuator. The compressor is
controlled according to the current room temperature and the
desired temperature set by the end user.
Hardware Architecture
Interrupts
• Interrupt is a signal to the processor that some important event has occurred.
For example., the processor does not keep on checking.
Memory
Clock Circuitry

fgdfgf
• Light Emitting Diodes (LEDs)
• LEDs are the most widely use d output devices in embedded systems. Red , green and
yellow LEDs are used for status display as well as for indications of visual alarms for such
events as power supply failure. Blue and white LEDs are also available, but they are very
expensive.
Software Architecture
• An embedded operating system does all these activity .
2.4.1 TCP/IP Protocol Suite
• The application process (say for transferring a file) generates an application
byte stream which is divided into TCP segments and sent to the IP layer.
• The TCP segment is encapsulated in the IP datagram and sent to the data link
layer. The IP datagram is encapsulated in the data link layer frame.
• The data link layer frame is sent to the physical layer interface and then the
bit stream is sent over the transmission medium. At the destination, each
layer strips off the header, does the necessary processing based on the
information in the header and passes the remaining portion of the data to
the higher layer.
Current Trends
To address the challenges just mentioned, various trends are being adopted.
i) Multi-core processors:
It has become very clear that trying to improve processor performance by
increasing clock frequencies is fraught with difficulties, because the direct
result of higher clock frequency is high power dissipation.
Thus, the option of using more than one processor core (at lower clock
frequencies) is being tried out. Thus, the current smart phones and gaming
consoles use multi-core processors.
It may be understood that if there are two cores, one may be a DSP core while
the other is a general purpose core. Th e design of multi core systems requires
new design environments which are being developed at a rapid rate.
ii) Embedded and real-time operating systems:
With the emergence of complex applications, many new
embedded and real-time operating systems have become
popular.
Linux has emerged as a popular embedded OS, and others like
Android and newer versions of Symbion have came up for
mobile applications and handheld devices.
iii) Newer areas of deployment of embedded devices:
Embedded devices have applications in the entertainment, healthcare
and automotive segments. Besides that, there are applications in the
communication and military fields as well. Research and
development in these fi elds is going ahead.
SOFTWARE DEVELOPMENT TOOLS
• An embedded system, as we see, includes both hardware and software. To
develop the hardware and software in unison, a number of tools become
necessary. Another related term is ‘firmware’. When software is embedded in
hardware, it becomes a ‘firmware’.
• The hardware involved here is a non-volatile memory which is part of an MCU
or system board. Currently flash ROM is the device of choice for firmware.
• To understand the program development steps.
• The assumption is that the hardware design is being done parallel, and out to
develop, test and port the software onto the embedded systems board.
• It is only after the software is thoroughly tested can it be burned into the flash
(ROM) of the target processor.
An Embedded Board
A Host Computer and an Embedded Board
The program to be run on the selected MCU cannot be simply burned
on its flash without testing and making sure that it is working as per
the required specifications. Th is part of developing a working and
tested program called ‘software development’.
The Integrated Development Environment (IDE)
• An integrated development environment (IDE) is a programming
environment that has
been packaged as an application program, consisting of a code editor, a cross
compiler, a debugger, and a graphical user interface (GUI) builder.

• An IDE is specific for a particular family of MCUs


An IDE has at least the following:

• Code Editor
• Builder
• Simulator
• GUI (Graphical User Interface)
List of popular IDEs
Code Editor

• This editor allows code to be written, changed and saved


as files in folders called ‘projects’.
• During the course of the use of the IDE, the project folder
will be found to contain all the different types of files
associated with that project
GUI
Most windows based IDEs have a graphical user interface which makes it easy to
use.
Th is gives the facility to view all activities using the IDE. This is especially
attractive in the debug mode, when the contents of registers, memory and
peripherals have to be viewed.
Compiler

• A compiler is a program that translates one computer language


program (called source code) into another (object code).
• the name ‘compiler’ is used for programs that translate source code
from a high-level programming language to a lower level language
(assembly language or machine code.) For a machine to ‘run’ the
object code, the final conversion should be into the machine’s machine
code.
• In that case, the conversion from a high level language to assembly
code can be considered to be an intermediate step.
What is a Cross Compiler?
• This is a software which runs on one processor (x86 of the PC) and produces
code for another processor
• For example, the ARM processor IDE runs on an x86 PC
• Then the ARM program is cross compiled and the hex file generated is one
that runs on the ARM MCU
Assembler
This is a software which converts an assembly program to machine language .
Cross Assembler
• If the program for ARM, in the editor of the IDE is an assembly program, the
‘cross assembler’ in the IDE converts it to the machine language of ARM. Thus,
the assembler software which runs on one processor (x86 of the PC) produces
machine code for another processor, i.e., ARM. This is cross-assembly.
An assembler generates an ‘object file’ which contains the following information:
i) Machine code
ii) Re-locatable addresses of the code bytes
Builder
• Once the code has been written and saved as a file in a project, the next
step is ‘building the project’.
• A builder includes the compiler and the assembler.
• There is also a linker.
Disassembly
• Disassembling is the reverse process of assembling.
• In the ‘disassembly window’, the addresses of the code
lines, the machine code and the mnemonics can be seen
Linker
• This piece of software does the linking of many modules.
• There may be a number of source modules and a number of be a number of
library functions .
• By linking, that is, combining all these, we get the executable file, which is
usually designated as the ‘exe file’.
• It is this file which will be ‘loaded’ to the processor memory to get executed.

• In an IDE (take a look at the Keil IDE, for example), the processes of ‘compile,
assemble and link’ are together called ‘build’.
• The output from the build process is the hex fi le which can be loaded into the
flash of the processor or be simulated using the simulator of the IDE. Figure
shows the executable file being loaded into memory, using a ‘loader’.
Simulator
• This is also called a software debugger.
• This is a software which allows debugging of code by identifying
and correcting logical errors.
• Here, setting break points and single step execution is possible.
• The most important aspect of a software debugger in an
embedded system IDE is that the architecture of the selected
processor is ‘simulated’.
• if it is the 8051 MCU that has been selected, there is the facility to view the
registers, RAM and ROM locations of this MCU after each step of
execution. The available peripherals such as timers, GPIO, serial ports, etc.
are also viewable.
• There is the facility for simulating the external input ports and logic values.
• This means that if to an input GPIO pin, applying a ‘1’ as input is to be
given, it can be done and the result of this (in memory or a register) can be
observed.
Out of Circuit Programming

• The MCU can be taken and plugged into a universal


programmer.
• The programmer is connected to the host PC and the hex
code is burned onto the MCU.
An MCU Plugged into the Socket of a Universal Programmer
In System Programming (ISP)

• This is also called in-circuit programming.


• The idea here is that the MCU to be programmed
remains on the target board itself, that is, it is in the
system itself.
• Many boards are supplied with the necessary ISP
hardware and software (loaded in the host computer)
Emulator

• The term ‘emulate’ means to ‘imitate with effort’.


• Thus, what an emulator does in this context is to ‘imitate
hardware’.
• The hardware of interest is usually (but not necessarily)
the MCU which is to be used in the embedded board
under development.
• Thus, we use emulators for hardware debugging.
ICE (In-circuit Emulator)

• An ICE is an emulator included in a development setup


for a target board.
• A generic ICE box contains the emulator as well as the ISP
for downloading the code to the target
board.
• Many emulators have more advanced features like
performance analysis, coverage analysis, a trace buffer
and advanced trigger and breakpoint possibilities.
Hardware Simulator

• One such tool commonly used in the academic


environment is the Proteus VSM, which is a design suite
which offers the idea of ‘virtual modeling’ of MCU-based
circuitry with important external peripherals like LEDs,
LCDs, etc.

You might also like