ES Unit-1
ES Unit-1
INTRODUCTION:
An embedded system is an electronic system, which includes a single chip
microcomputers (Microcontrollers) like the ARM or Cortex or Stellaris LM3S1968.
It is configured to perform a specific dedicated application.
An embedded system is some combination of computer hardware and software, either
fixed in capability or programmable, that is designed for a specific function or for specific
functions within a larger system.
Here the microcomputer is embedded or hidden inside the system. Every embedded
microcomputer system accepts inputs, performs computations, and generates outputs
and runs in “real time.”
Ex: Cell phone, Digital camera, Microwave Oven, MP3 player, Portable digital assistant &
automobile antilock brake system Industrial machines, agricultural and process industry devices,
automobiles, medical equipment, household appliances, airplanes, vending machines and toys as
well as mobile devices are all possible locations for an embedded system etc.
1
ECE ES-UNIT-I SRIT
So, an embedded system must perform the operations at a high speed so that it can be readily
used for real time applications and its power consumption must be very low and the size of the
system should be as for as possible small and the readings must be accurate with minimum error.
The system must be easily adaptable for different situations.
Embedded system
Functional performance
Stand alone embedded systems small scale embedded system
Real time embedded system medium scale embedded s/m
a) Hard real time E.S
b) Soft Real time E.S
Networked embedded system large scale embedded system
Mobile embedded system .
Soft Real-Time system: A Real time system in which, the violation of time constraints
will cause only the degraded quality, but the system can continue to operate is known as
2
ECE ES-UNIT-I SRIT
a Soft real time system. In soft real-time systems, the design focus is to offer a guaranteed
bandwidth to each real-time task and to distribute the resources to the tasks. Ex: A
Microwave Oven, washing machine, TV remote etc.
Hard Real-Time system: A Real time system in which, the violation of time constraints
will cause critical failure and loss of life or property damage or catastrophe is known as a
Hard Real time system.
These systems usually interact directly with physical hardware instead of through a human
being .The hardware and software of hard real-time systems must allow a worst case execution
(WCET) analysis that guarantees the execution be completed within a strict deadline. The chip
selection and RTOS selection become important factors for hard real-time system design. Ex:
Deadline in a missile control embedded system , Delayed alarm during a Gas leakage , car airbag
control system , A delayed response in pacemakers ,Failure in RADAR functioning etc
Networked embedded systems: The networked embedded systems are related to a network with
network interfaces to access the resources. The connected network can be a Local Area Network
(LAN) or a Wide Area Network (WAN), or the Internet. The connection can be either wired or
wireless. The networked embedded system is the fastest growing area in embedded systems
applications. The embedded web server is such a system where all embedded devices are
connected to a web server and can be accessed and controlled by any web browser. Ex: A home
security system is an example of a LAN networked embedded system where all sensors (e.g.
motion detectors, light sensors, or smoke sensors) are wired and running on the TCP/IP protocol.
Mobile Embedded systems: The portable embedded devices like mobile and cellular phones,
digital cameras, MP3 players, PDA (Personal Digital Assistants) are the example for mobile
embedded systems. The basic limitation of these devices is the limitation of memory and other
resources. Based on the performance of the Microcontroller they are also classified into (i) Small
scaled embedded system (ii) Medium scaled embedded system and (iii) Large scaled embedded
system.
Small scaled embedded system: An embedded system supported by a single 8–16 bit
Microcontroller with on-chip RAM and ROM designed to perform simple tasks is a Small scale
embedded system.
Medium scaled embedded system: An embedded system supported by 16–32 bit Microcontroller
/Microprocessor with external RAM and ROM that can perform more complex operations is a
Medium scale embedded system.
Large scaled embedded system: An embedded system supported by 32-64 bit multiple chips
which can perform distributed jobs is considered as a Large scale embedded system.
3
ECE ES-UNIT-I SRIT
The embedded systems have a huge variety of application domains which varies from very
low cost to very high cost and from daily life consumer electronics to industry automation
equipments, from entertainment devices to academic equipments, and from medical instruments
to aerospace and weapon control systems. So, the embedded systems span all aspects of our
modern life. The following table gives the various applications of embedded systems.
S.No Embedded System Application
4
ECE ES-UNIT-I SRIT
A microcontroller is an integrated chip which comes with built-in memory, I/O ports,
timers, and other components.
Most embedded systems are built on microcontrollers, which run faster than a custom-built
system with a microprocessor, because all components are integrated within a single chip.
Operating system plays an important role in most of the embedded systems. But all the
embedded systems do not use the operating system.
The systems with high end applications only use operating system. To use the operating
system the embedded system should have large memory capability.
So, this is not possible in low end applications like remote systems, digital cameras, MP3
players, robot toys etc.
The architecture of an embedded system with OS can be denoted by layered structure as
shown below.
The OS will provide an interface between the hardware and application software.
5
ECE ES-UNIT-I SRIT
In the case of embedded systems with OS, once the application software is loaded into
memory it will run the application without any host system.
Coming to the hardware details of the embedded system, it consists of the following
important blocks.
CPU(Central Processing Unit)
RAM and ROM
I/O Devices
Communication Interfaces
Sensors etc. (Application specific circuitry)
A CPU is composed of an Arithmetic Logic Unit (ALU), a Control Unit (CU), and many
internal registers that are connected by buses.
The ALU performs all the mathematical operations (Add, Sub, Mul, Div), logical
operations (AND, OR), and shifting operations within CPU.
The timing and sequencing of all CPU operations are controlled by the CU, which is
actually built of many selection circuits including latches and decoders. The CU is
responsible for directing the flow of instruction and data within the CPU and continuously
running program instructions step by step.
The CPU works in a cycle of fetching an instruction, decoding it, and executing it, known
as the fetch-decode-execute cycle.
6
ECE ES-UNIT-I SRIT
For embedded system design, many factors impact the CPU selection, e.g., the maximum
size (number of bits) in a single operand for ALU (8, 16, 32, 64 bits), and CPU clock
frequency for timing tick control, i.e. the number of ticks (clock cycles) per second in
measures of MHz
CPU contains the core and the other components which support the core to execute
programs. Peripherals are the components which communicate with other systems or
physical world (Like ports, ADC,DAC, Watch dog Timers etc.). The core is separated
from other components by the system bus.
The CPU in the embedded system may be a general purpose processor like a microcontroller or a
special purpose processor like a DSP (Digital signal processor). But any CPU consists of of an
Arithmetic Logic Unit (ALU), a Control Unit (CU), and many internal registers that are connected
by buses. The ALU performs all the mathematical operations (Add, Sub, Mul, Div), logical
operations (AND, OR), and shifting operations within CPU
Memory:
7
ECE ES-UNIT-I SRIT
Communication Interfaces:
To transfer the data or to interact with other devices, the embedded devices are provided
the various communication interfaces like RS232, RS422, RS485 ,USB, SPI(Serial
Peripheral Interface ) ,SCI (Serial Communication Interface) ,Ethernet etc.
8
ECE ES-UNIT-I SRIT
Initially, buses were made up using electrical wires, but now the term bus is used more
broadly to identify any physical subsystem that provides equal functionality as the earlier
electrical buses.
Computer buses can be parallel or serial and can be connected as multidrop, daisy chain
or by switched hubs.
System bus is a single bus that helps all major components of a computer to communicate
with each other.
It is made up of an address bus, data bus and a control bus. The data bus carries the data
to be stored, while address bus carries the location to where it should be stored.
Address Bus
Address bus is a part of the computer system bus that is dedicated for specifying a
physical address.
9
ECE ES-UNIT-I SRIT
When the computer processor needs to read or write from or to the memory, it uses the
address bus to specify the physical address of the individual memory block it needs to
access (the actual data is sent along the data bus).
More correctly, when the processor wants to write some data to the memory, it will assert
the write signal, set the write address on the address bus and put the data on to the data bus.
Similarly, when the processor wants to read some data residing in the memory, it will
assert the read signal and set the read address on the address bus.
After receiving this signal, the memory controller will get the data from the specific
memory block (after checking the address bus to get the read address) and then it will place
the data of the memory block on to the data bus.
The size of the memory that can be addressed by the system determines the width of the
data bus and vice versa. For example, if the width of the address bus is 32 bits, the system can
address 232 memory blocks (that is equal to 4GB memory space, given that one block holds 1 byte
of data).
Data Bus
A data bus simply carries data. Internal buses carry information within the processor,
while external buses carry data between the processor and the memory.
Typically, the same data bus is used for both read/write operations. When it is a write
operation, the processor will put the data (to be written) on to the data bus.
When it is the read operation, the memory controller will get the data from the specific
memory block and put it in to the data bus.
Data bus is bidirectional, while address bus is unidirectional. That means data travels in
both directions but the addresses will travel in only one direction.
The reason for this is that unlike the data, the address is always specified by the processor. The
width of the data bus is determined by the size of the individual memory block, while the
width of the address bus is determined by the size of the memory that should be addressed by
the system.
Clock:
The clock is used to control the clocking requirement of the CPU for executing instructions
-6
and the configuration of timers. For ex: the 8051 clock cycle is (1/12)10
10
ECE ES-UNIT-I SRIT
second (1/12µs) because the clock frequency is 12MHz. A simple 8051 instruction takes
12 cycles (1ms) to complete. Of course, some multi-cycle instructions take more clock
cycles.
A timer is a real-time clock for real-time programming. Every timer comes with a counter
which can be configured by programs to count the incoming pulses. When the counter
overflows (resets to zero) it will fire a timeout interrupt that triggers predefined actions.
Many time delays can be generated by timers. For example ,a timer counter configured to
24,000 will trigger the timeout signal in 24000x 1/12µs = 2ms.
In addition to time delay generation, the timer is also widely used in the real-time embedded
system to schedule multiple tasks in multitasking programming. The watchdog timer is a
special timing device that resets the system after a preset time delay in case of system
anomaly. The watchdog starts up automatically after the system power up.
One need to reboot the PC now and then due to various faults caused by hardware or
software. An embedded system cannot be rebooted manually, because it has been
embedded into its system. That is why many microcontrollers come with an on-chip
watchdog timer which can be configured just like the counter in the regular timer. After a
system gets stuck (power supply voltage out of range or regular timer does not issue
timeout after reaching zero count) the watchdog eventually will restart the system to bring
the system back to a normal operational condition.
Embedded processor and their types
Processors can be of the following categories −
o Microprocessor
o Microcontroller
o Embedded Processor
o Digital Signal Processor
o Media Processor
Application Specific System Processor (ASSP)
11
ECE ES-UNIT-I SRIT
GPP core(s) or ASIP core(s) on either an Application Specific Integrated Circuit (ASIC)
or a Very Large Scale Integration (VLSI) circuit.
12
ECE ES-UNIT-I SRIT
13
ECE ES-UNIT-I SRIT
14
ECE ES-UNIT-I SRIT
15
ECE ES-UNIT-I SRIT
MEMORY TYPES
A program instruction codes and data are stored at the memory. A processing unit fetches the
instruction codes one by one and data, and executes the instructions. system memory functions as
a storage receptacle for the data and programs used by the computer. Memory system consists of
various types of memory units. Most systems have three types of memory: 1. Read-Only (ROM)
2. Random access memory (RAM) 3. Flash memory
ROM variants:
ROM nonvolatility is a most important asset. It is extremely useful to embed codes and data in a
system. As its name suggests, the contents of the read-only memory cannot be modified by the
computer program but may be read. A system has ROM unit(s) for bootstrap program(s), basic
input-output system (BIOS) program(s) and for vector addresses for the interrupts.
Example 1:
Different types of memory in varying capacities are available for use as per requirement. (1)
Masked ROM EPROM Of flash stores the embedded software (ROM image). Masked ROM is for
bulk manufacturing. (2) EPROM or [EPROM is used for testing and design stages. (3) [EPROM
(5 V Or 3.3 V form) is used to store the results during the system program runtime. It is erased
byte by byte and written during the system run. It is useful to store bytes, which modify at runtime
or new result, for example, the runtime system status, time, date. telephone number or contact
address.
Example 2:
ROM also holds embedded software as well as a program, which executes automatically by the
system every time it is turned on or reset. This program is called the bootstrap or "boot" loader,
and instructs the system to toad its operating system off its hard disk or other I/O device. The name
of this program comes from the idea that the system is "pulling itself up by its own bootstraps" by
executing a program that tells it how to load its own operating system.
I. Masked ROM
ROM means a masked ROM in strict sense. A mask is made at a foundry from the programmer
ROM image file. A masked ROM is built from a circuit, which has r inputs (A0 to Ar-1) and 8
outputs (D0 to D7). The circuit for the masked ROM is one of a set of 2r combinational circuits.
Appropriate masking gives a desired set of outputs at each combinational circuit. Certain links
fuse and others that are masked do not fuse. [A combination circuit is a circuit made up of logic
gates with a distinct set of output logic states during distinct input logic states. As soon as the
inputs change the output also changes at the circuit). the embedded designer (after thorough testing
and debugging) provides to a manufacturing foundry file having of desired output bits for the
various combinations of the input address hits. The manufacturer prepares the programming
16
ECE ES-UNIT-I SRIT
masks and then Program the ROM at a foundry. the ROM chips are then returned to the
manufacturer of the system.
Normally, one-time masking fee could he very high. Generally, therefore. a system manufacturer
will place the order, and the manufacturing foundry will accept the order tor a minimum of 1000
or more. pieces The masked ROM is a very cost-effective solution to a hulk user of ROM chips
pieces for the manufacture of embedded systems. An embedded-system manufacturer using a
masked ROM does not have to use a device programmer (ROM burner) each time a system ROM
is made using EPROM or PROM
ROM is a loosely used term. It actually means a masked ROM, PROM, OTP-ROM, EPROM and
EEPROM or flash for a hardware designer. EEPROM or flash memory is used when ROM needs
to be programmed during runtime and is used to hold the processed results (in non-volatile form).
A device programmer can program the versions of ROM at the designer or manufacturer site for
an embedded system.
Example:
Erase of EEPROM during an application-program run is done by sending all eight data bus bits as
1s for the write in the presence of a voltage (+5 V) and a short duration write pulse. Sending Is and
0s in the byte by a write instruction does EEPROM programming during a program run. Erasing
of a byte must precede the write. The processor within the system can do erasing and writing, as it
is similar to the writing in a RAM.
The difference is that in RAM, timing cycles are identical for the read and write. In EEPROM,
the write cycle has to be longer than in the case of RAM, and it must precede the erase of the byte
by writing OxFF. Further, an addition voltage Vpp signal is needed when erase and write occurs
to the EEPROM. The number of times an EEPROM can be written is 1 million times plus. There
is no limit tor RAM and a practically infinite number of writes is possible without writing Is first.
17
ECE ES-UNIT-I SRIT
ROM embeds: Program codes for various tasks. interrupt service routines, operating system kernel,
initialization (bootstrap program and data) and the standard data or table or constant strings. The
ROM is not only used for program and data storage, but also used for obtaining the preprogrammed
logic, outputs and output sequences for the given sets and sequences of inputs
An EEPROM is usable by erase over 1 million times. It can be erased during runtime itself. Flash
memory is usable about 10000 times for repeated erasing followed by programming during the
runtime. The PROM is written only once by a device programmer or first-time system run.
Example:
Three examples of EEPROM memory applications are as follows. (i) Storing current date and time
in a machine, (ii) Storing port statuses, and (iii) Storing driving malfunctions and failure history in
an automobile for use by mechanics later on. Examples of uses of OTP ROM are as follows. (i)
Smart-card identity number and user's personal information, (ii) Storing boot programs and initial
data like a pictogram displaying a seal or monogram, and (iii) ATM card, credit card or identity
card. Once the various details are written at the bank and handed over to the account holder, there
is no modification possible in the embedded PROM at the card. Just as a paper holds information
permanently, once it is written or printed, so also does a PROM.
Random access memory can he both read and, written, and is used to hold the programs, operating
system, and data required by the system. RAM is generally volatile, meaning that it does not retain
the data stored in it when the system's power is turned off Any data that needs to be stored while
the system is off must be written to a permanent storage device, such as a flash memory or hard
disk. SRAM (static RAM) is used most commonly. Each cell consists of four MOSFETs. The
charge remains static in the circuit. DRAM is used mostly in computers or high memory-density
systems. The charge losses in the circuit made of a single MOSFET per cell. A refresh controller
circuit reads the bit of each cell and writes again within specified interval.
Uses of RAM
The RAM is for storing the variables during program run and storing the stack. It stores in input
and output butlers, for example, of speech or image.
Flash Memory
Flash memory is a form of EEPROM in which a sector of bytes can he erased in a flash. Flashes
of even 3 V form and capacity 2, 4 and 8GB are available. A sector can be from 256 kB to 16 kB.
The advantage over EEPROM is that the erasing of many bytes simultaneously saves time in
18
ECE ES-UNIT-I SRIT
each erase cycle that precedes a write cycle. The disadvantage is that once a sector is erased, each
byte writes into it again one by one and that takes too long a time.
Flash stores the results byte by byte during a system run after a full sector erase. flash is thus very
useful when a processed image or voice is to be stored or a data set or system configuration data
it to be stored, which can be upgraded as and when required. For example, in flash, a new image
(after compressing and processing) can be stored and the old one erased from a sector in single
instruction cycle. Three examples of flash memory applications are as follows. (i) Storing the
photographs in a digital camera. (ii) Storing voice compressed form in a voice recorder. (iii)
Storing messages and contact addresses in a mobile phone.
A new version of flash is boot block flash. A sector is reserved to store once only at the time of
first boot. Later on, it is protected from any further erase. In other words, it has an 0-IP sector also
that can be used to store ROM images like in a ROM. Boot block flash has an OPT sector(s) also
to store boot programs and initial data or permanent system configuration data. It serves by storing
ROM image or its part in OTP sector(s) and at the same time serves by storing as a flash in other
wools.
Embedded systems do not use secondary memory, CDROM or hard disks however many use
media card as secondary memory. Media card is a memory card or micro card of 1,4 or 8 GB flash
memory\ Digital cameras, video cameras and mobile phones use this card.
1, Requirements
Definition and analysis or system requirements. it means obtaining complete clarity required
purpose. Inputs, outputs, functioning, design metrics and validation for the finally developed
systems specifications: There should also be consistency in the requirements. Example is a design
process which requires talk time of four hours in a day on the one hand, and requires battery that
needs recharging after two days on the other hand. Both requirements from the designed System
are inconsistent.
2. Specifications
Clear and precise description of parameters and functions of the required systems to guide the user
for, expectations from the system. It guides the design of system architecture
Example: Designer needs specifications for (1) hardware, for example, peripherals, devices
processor and memory specifications, (ii) data types and processing specifications,(iii) expected
19
ECE ES-UNIT-I SRIT
system behavior specifications, (iv) constraints of design, and (v) expected life cycle specifications
of the product, Process specifications are analyzed by making lists of inputs on events, outputs on
events, and processes activated on each event.
3. Architecture
Design of data models, attributes in data structure. data flow graphs. program models. software
architecture layers and hardware architectures are defined in the architecture.
4. Components
The fourth level is the component-level design. Software components processes. interfaces and
algorithms are defined in this level. Software development process can he modeled on component-
based, object-oriented model. Design of hardware components, AS1Ps, special function
processors. AS1Cs and IPs are defined for the VLSI. Hardware components may be defined for
circuit on board as follows: (a) Microprocessor, ASIP and single-purpose processors
(b) Memory RAM ROM or internal and external flash or secondary memory (c) Peripherals (d)
Internal and external devices to the system Ports and buses (e) interfacing circuit (f) Power source
or battery
5. System Integration
Designed components ire integrated in the system. Components may work fine independently but
when integrated may not fulfill the design metrics. Below table lists the actions at each step in the
design process.
20
ECE ES-UNIT-I SRIT
Assembly-Language Programming
1. Assembly codes are sensitive to the processor, memory, ports and devices. Assembly
software gives a precise control of the processor internal devices. and makes full use of
processor-specific features of processor instruction set and addressing modes.
2. Machine codes are compact, and are processor and memory sensitive. The system thus
needs a smaller memory. No additional memory needed due to data type's selection,
conditions and declarations of rules. A program is also not compiler specific and library-
function specific.
3. Certain codes such as device-driver codes may need only few assembly instructions.
Assembly codes for these can be compact and precise. and are conveniently written.
4. Bottom-up-design approach is easily usable. Approach to this way of designing a program
is as follows: First code the basic functional modules (submodules) and then use these to
build a bigger module. Submodules of the specific and distinct sets of actions are first
coded. Programs for delay, counting_ finding time intervals and many applications can be
written. Then the final program is designed by integrating the modules.
High-level language coding of source .files in C. C++, C#, Visual C++, or Java provides great
programming ease. and has many advantages. Therefore. most embedded programming is in the
high-level language. Basic advantages are as follows:
21
ECE ES-UNIT-I SRIT
4. The program facilitates 'type checking'. This makes a program less prone to error. For
example, type checking does not permit subtraction, multiplication and division on the char
data types.
5. The program facilitates use of program-flow-control structures, such as loops and
conditional statements.
6. The program has portability, and is not processor specific. Therefore, when hardware
changes, only the modules for the device drivers and device management, initialization and
program-locator modules, and initial boot-up record data need modifications, OS takes care
of these functions.
1. Editor
The first tool you need for Embedded Systems Software Development Tools is text editor.
This is where you write the code for your embedded system.
The code is written in some programming language. Most commonly used language is C or
C++.
2. Compiler
A compiler is used when you are done with the editing part and made a source code.
So we can say that a compiler is used to convert a high level language code in to low level
programming language.
22
ECE ES-UNIT-I SRIT
3. Assembler
The third and an important one among Embedded Systems Software Development Tools is an
assembler.
The function of an assembler is to convert a code written in assembly language into machine
language.
All the mnemonics and data is converted in to op codes and bits by an assembler.
We all know that our computer understands binary and it works on 0 or 1, so it is important to
convert the code into machine language.
That was the basic function of an assembler, now I am going to tell you about a debugger.
4. Debugger
It is important to test whether the code you have written is free from errors or not. So, a
debugger is used for this testing.
Debugger goes through the whole code and tests it for errors and bugs.
It tests your code for different types of errors for example a run time error or a syntax error
and notifies you wherever it occurs.
The line number or location of error is shown by debugger so you can go ahead and rectify it.
So from the function, you can see how important tool a debugger is in the list of Embedded
Systems Software Development Tools.
5. Linker
The next one in basic Embedded Systems Software Development Tools is a linker.
A linker is a computer program that combines one or more object code files and library files
together in to executable program.
It is very common practice to write larger programs in to small parts and modules to make job
easy and to use libraries in your program.
All these parts must be combined into a single file for execution, so this function requires a
linker.
23
ECE ES-UNIT-I SRIT
6. Simulator
A simulator helps you to see how your code will work in real time.
You can see how sensors are interacting, you can change the input values from sensors, and
you can see how the components are working and how changing certain values can change
parameters.
7. RTOS:
An Operating system(OS) for multitasking, process, memory, IO, network, devices, file system
and for real-time control of processes.
8. Prototyper:
For simulating source code engineering including compiling, debugging and navigating through
the codes using a browser, summarizing complete status of final target system during the
development phase. Tornado Prototyper from Windriver for integrated cross-development
environment with a set of tools.
9. Cross-assembler:
For converting object codes or executable codes for a processor at development system to other
codes for another processor for embedded system and vice versa.
24
ECE ES-UNIT-I SRIT
10. Cross-compiler:
For compiling source codes for a another processor and vice versa
11. Locator:
Uses cross-assembler output and a memory allocation map and provides the locator-program’s
output.
12. Interpreter:
Software and hardware environment that consists of simulators, editors, compilers, assemblers,
RTOS, debuggers, stethoscope, tracer, emulators, logic analyzers, application codes burners for
the integrated development of a system.
25
ECE ES-UNIT-I SRIT
26
ECE ES-UNIT-I SRIT
27
ECE ES-UNIT-I SRIT
28