Introduction to
Embedded Systems
Gaurav Sharma
C-DAC HYD
AGENDA
• Embedded Systems
• µP vs µC
• Processor Architecture
• Memories
• I/O
• BUSES
Why Learn ES
– Lot of hype
–Everybody else is doing it
–My friends got a job in ES,hence....
–Desktop would die soon
–My brother in US told me to learn it ....
Embedded Systems Defined ?
• No formal definition
• Generally accepted to be a type of computer designed to
solve a specific problem or task
• A combination of hardware and software, and perhaps
additional mechanical or other parts, designed to
perform a dedicated function.
• In some cases, embedded systems are part of a larger
system or product
EMBEDDED SYSTEM
➢ 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.
➢ A type of computer designed to solve a specific problem or task.
➢ A System that is dedicated for a particular Task.
App1 App2 App3
OS App1 App2 App3
HARDWARE HARDWARE
Typical embedded
General purpose system
computer System
Embedded Market
vivekn@cdac.in
Design Consideration
Power & Size
Cost Memory
Requirement
Embedded
System
S/W Performance
Reliability & flexibility
Development
Time
General Framework
• Embedded systems typically use a processor combined
with other hardware and software to solve a specific
computing problem.
• The processors range from simple (by today’s standards)
8-bit microprocessor/microcontrollers to the worlds
fastest and most sophisticated 64-bit microcontrollers.
• Embedded system software ranges from a small
executive to a large real-time operating system (RTOS)
with a graphical user interface (GUI).
• Embedded systems range from large computers such as
an air traffic control system to small computers.
Embedded System looks like . .
Memory
CPU chips
Serial
Digital I/O
Analog I/O
LAN
I/O controller chips
CPUs
• CPUs can be
– Microprocessors or Micro controllers
• Any CPU can be studied by knowing following features
of CPU
– Clock speed, Address bus size, Data bus size, Register size
– Register set, Instruction set, Address spaces, Endian type
– Interrupt support, DMA support
– Instruction and Data cache
– Memory management
– Protection features (user/supervisor modes)
Micro Processors
• Micro Processor is the Integration of a number of useful
function in a single IC Package
• These functions are
– Execute the stored set of instructions to carry out user
defined task
– Ability to access external memory chips for both read
and write data from and to the memory
Microprocessor Vs Microcontroller
• Contains ALU, GP Registers, In addition to processor, it has in-
SP, PC, Clock timing circuit built ROM, RAM, IO devices,
and interrupts Timers
• Requires more H/W, increase Requires less H/W, reduces PCB
in PCB size size & increases reliability
Microcontroller Defined
• Very similar to a Microprocessor
• It typically includes a CPU, memory, and other
peripherals.
Classification of Microcontrollers
• μc are classified into :
– 8 bit μc e.g.: AVR 8515, Intel 8051, Motorola HC05
– 16 bit μc e.g.: Siemens 80167, Intel 80C196
– 32 bit μc e.g.: ARM Cortex ,MCF5272, Power PC 8xxx
– 64 bit μc e.g.: ARM Texas 64xxx series
• The number of bits indicate the internal Data Bus of a
μc.
• It shows how many bits of data the μc can process
simultaneously.
Processor Architecture
Princeton Harvard
• Contains 2 separate memory
• Single Main Memory holding spaces- code & data
both program and Data
• Simple memory structure • Complex memory Structure
CPU Code and Data code CPU data
RISC vs CISC – Architecture
RISC CISC
Fixed width instructions Variable length instruction
Few formats of instructions Several formats of
instructions
Load/Store Architecture Memory values can be used
as operands in instructions
Large Register bank Small Register Bank
Instructions are pipelinable Cannot pipeline instructions
RISC vs CISC - Organization
RISC CISC
Hardwired instruction decode Microcode ROMS instruction
decoder
Single cycle execution of Multi cycle execution on
instruction instruction
RISC CISC
Feature Low Power RISC PC/Desktop CISC
Power A few hundreds of milliwatts Many watts
Compute Speed 200-520 Mega Hz 2-5 Giga Hz
Memory Management
Cost Dollars Tens to hundreds of Dollars
Environmental High Temp, Low EM Needs Fans, FCC/CE
Emissions approval an issue
Life cycle of an instruction
• As the instruction moves through the processor it goes
through the following stages.
– Fetch : Instruction fetched from the address stored in the
program counter.
– Decode : Instruction decoded and registers read
– Execute : in the ALU
– Write back : Results written back to registers or memory.
• Note : each stage takes one clock cycle
• The Instruction execution requires 4 clock cycles
Fetch Decode Execute Writeback
Cycle 1 Cycle 2 Cycle 3 Cycle 4
Non Pipelined Example
1ns 2ns 3ns 4ns 5ns 6ns 7ns 8ns
F1 D1 E1 W1
F2 D2 E2 W2
Instruction 1 Instruction 2
• 2 instructions take 4ns each
• A stage is used once every 4ns
• The resultant throughput is 4 cycles per instruction (CPI)
Pipeline Example
• Each stage is 1ns 2ns 3ns 4ns 5ns 6ns 7ns 8ns
utilized at every F1 D1 E1 W1
clock cycle. F2 D2 E2 W2
F3 D3 E3 W3
• 5 Instructions F4 D4 E4 W4
are executed in
F5 D5 E5 W5
8ns
F6 D6 E6
• Resultant F7 D7
throughput is 1 F8
instruction per
Instruction 1
cycle
Instruction 2
Instruction 3
Instruction 4
Instruction 5
Big Endian Little Endian
• Stores the most significant part Stores the least significant part
first
first e.g.: Intel
• e.g.: Motorola
e.g.: consider data 0x4567 at
location 0x5050
45
67
67
45
Memory Mapped IO IO Mapped IO
• IO devices are treated as like • IO devices are separately
interfaced.
memory . • Separate instruction set
• Memory related instructions available .
should be used to access IO .
memory memory
Input
CPU
Input memory
CPU output
output
Memory
RAM Hybrid ROM
DRAM SRAM Flash EPROM PROM Masked
NVRAM EEPROM
General components of a Microcontroller
• CPU – Heart of the controller. Composed of registers,
ALU, instruction decoder and the control circuitry.
• On Chip Memory – Used to store information
Memory
RAM (Volatile)
ROM(Non Volatile)
1.SRAM
1.PROM
2.DRAM
2.UV-EPROM
3.NV-RAM
3.EEPROM
4.FLASH
General components of a Microcontroller
• I/O Ports
– Used to interface with the peripheral devices and the
controller.
– Analog I/O and Digital I/O
• Timer/Counter
– For keeping Time and/or calculating the amount of
time between events
– For counting the events
– Baud rate generation
FLASH MEMORY
• Flash is believed to be close to perfect memory
• Advantages
– Fast read speeds
– Long-term data retention at much lower cost
• Drawbacks
– Doesn’t allow random bytes to be updated on the fly
– Limitations on number of times it can be re-written
Types of Flash Memory
NOR NAND
NOR vs NAND
• The arrangement of these cells
• The parallel interconnection of is significantly more compact
than in NOR.
the memory cells helps account
• The select gates allow higher
programming and erase
for their fast random read
voltages to be used without
disturbing the charge stored in
accessibility.
unselected cells.
• fast programming and erase
times
• Poor random read
performance
The winner is . . .
• NOR provides faster reads and allows random byte
access
• NAND writes and erases data faster, costs less per Mb
and uses less power than NOR.
• If the ROM (here flash) is rarely updated, then NOR is
obvious choice
• If data is being logged to a flash disk then NAND is the
right memory
DEVELOPMENT ENVIRONMENT
Keil uVision IDE
Host - Target Development Environment
• The distinguishing feature of embedded software development is
host-target development environment.
• All the development tools like Editors, compilers and linkers are
available on the host machine.
• Typical host machines are Windows 7,8,10 and Unix workstations
where the above development tools are available
• Application programs will be written on the host, get compiled,
linked and get the executable file
• Target systems are the ones where compiled and linked code is
executed
• Target systems being a microprocessor based boards does not offer
any development environment themselves, so an host machine is
required
Cross Compilers
• Another distinguishing feature of embedded software
development is cross compilers
• Cross compilers are the ones, which runs on a machine
based on one type of CPU and produces a machine
instructions for a different kind of CPU
Downloading
• Downloading is the process of loading the executable
image prepared on the host system on to a target board
• There are various methods to download the code to a
target machine. They are:
– Serial ports
– EPROM/FLASH
– Floppy disks
– Ethernet
– Across a common Bus
Debug Monitor
• Debug monitor is a software that resides in a ROM or EPROM of a
target board during the development process
• When a target board is powered on, the debug monitor program
runs and provides facilities for downloading and debugging the
application program
• In some cases both debug monitor and application program will
reside in the ROM. First control goes to debug monitor which will
pass control to the application program