You are on page 1of 62

Embedded Systems

SUSHMA RAWAL

What is an Embedded System?


An Embedded System is a microprocessor based system that is embedded as a subsystem, in a larger system (which may or may not be a computer system).

SUSHMA RAWAL

What is an Embedded System?


Hardware and Software which is part of a much larger system and expected to function without human intervention Respond, monitor, control external environment using sensors and actuators.

SUSHMA RAWAL

Definition
An embedded system is a computer system designed to perform one or a few dedicated functions often with real-time computing constraints. It is embedded as part of a complete device often including hardware and mechanical parts. By contrast, a general-purpose computer, such as a personal computer (PC), is designed to be flexible and to meet a wide range of end-user needs.

SUSHMA RAWAL

Definition
Embedded systems control many devices in common use today. Since the embedded system is dedicated to specific tasks, design engineers can optimize it to reduce the size and cost of the product and increase the reliability and performance. Some embedded systems are mass-produced, benefiting from economies of scale. User could select the functionality but cannot define the functionality. Embedded system is designed to perform one or limited number of functions, may be with choices or options.
SUSHMA RAWAL
5

An embedded system is a computer system with higher quality and reliability requirements than other types of computer systems.

SUSHMA RAWAL

Embedding a computer
output analog

CPU

input

analog

embedded computer

mem

SUSHMA RAWAL

Real time system A real time system is one in which the correctness of the computations not only depends on the logical correctness of the computations but also on the time at which the result is produced. If the timing constraints are not met, system failure is said to have occurred.

SUSHMA RAWAL

Real-Time systems
Realtime systems are those which can guarantee the completion of certain tasks within a predefined period of time with expected results.

SUSHMA RAWAL

Types of Real-Time systems


Hard Realtime system-Is one which must complete the task within the prededfined time with accurate results( no relaxation in Time and Results) Eg : Maintenance of Aircraft Cockpit Soft Realtime system- These are the systems for which an occasional failure to meet a deadline does not compromise the correctness of the system Eg: Automated Teller Machine
SUSHMA RAWAL
10

Application areas
Automotive: Ignition System, Engine Control, Brake System Industrial Control: Robotics and Control Systems Networking: Routers, Hubs Office Automation: Fax Machine, Printers, Scanners
SUSHMA RAWAL
11

Application areas
Embedded systems range from portable devices such as digital watches and MP3 players, to large stationary installations like traffic lights, factory controllers, or the systems controlling nuclear power plants

SUSHMA RAWAL

12

Automotive embedded systems


Todays high-end automobile may have 100 microprocessors: 4-bit microcontroller checks seat belt; microcontrollers run dashboard devices; 16/32-bit microprocessor controls engine. Embedded systems are controlled by one or more main processing cores that are typically either Microcontrollers or digital signal processors (DSP)

SUSHMA RAWAL

13

Characteristics of Embedded systems

Embedded systems are designed to do some specific task, rather than be a general-purpose computer for multiple tasks. Some also have real-time performance constraints that must be met, for reasons such as safety and usability. Others may have low or no performance requirements, allowing the system hardware to be simplified to reduce costs
SUSHMA RAWAL
14

Characteristics of Embedded systems


Embedded systems are not always standalone devices. Many embedded systems consist of small, computerized parts within a larger device that serves a more general purpose. For example, an embedded system in an automobile provides a specific function as a subsystem of the car itself.

SUSHMA RAWAL

15

Characteristics of Embedded systems


The program instructions written for embedded systems are referred to as firmware, and are stored in read-only memory or Flash memory chips. They run with limited computer hardware resources: little memory, small or non-existent keyboard and/or screen. Some degree of re-programmability is essential flexibility in upgrading, bug fixing, product customization Interact (sense, manipulate, communicate) with the external world

SUSHMA RAWAL

16

Characteristics of Embedded systems


Never terminate (ideally) Increasingly high-performance (DSP) & networked Sophisticated functionality.
Often have to run sophisticated algorithms or multiple algorithms.
Cell phone, laser printer.

Often provide sophisticated user interfaces.

SUSHMA RAWAL

17

Characteristics of Embedded systems


Real-time operation. Operation is time constrained: latency Must finish operations by deadlines. Hard real time: missing deadline causes failure. Soft real time: missing deadline results in degraded performance. Many systems are multi-rate: must handle operations at widely varying rates. Low manufacturing cost. Many embedded systems are mass-market items that must have low manufacturing costs. Limited memory, microprocessor power, etc.
SUSHMA RAWAL
18

Characteristics of Embedded systems


Low power. Power consumption is critical in battery-powered devices. Excessive power consumption increases system cost even in wall-powered devices. Size, weight, heat, reliability etc. Designed to tight deadlines.

SUSHMA RAWAL

19

Characteristics of Embedded systems


Manufacturing cost
-Non recurring engineering cost for design and development - cost of productions and marketing each unit Best technology choice will depend on number of units we plan to produce

SUSHMA RAWAL

20

Why do we care?
Estimated 98% of 8 Billion CPUs produced in 2000 used for embedded applications
Where Are the Processors?
Direct 2% Robots Vehicles 6% 12%

8.5B Parts per Year


Embedded Computers 80%

SUSHMA RAWAL

21

Views on embedded System


It is estimated that each year embedded software is written five times as much as 'regular' software The vast majority of CPU-chips produced world-wide today are used in the embedded market; only a small portion of CPU's is applied in PC's

SUSHMA RAWAL

22

Key Recent Trends


Increasing computation demands
e.g. multimedia processing in set-top boxes, HDTV

Increasingly networked
to eliminate host, and remotely monitor/debug embedded Web servers
e.g. Mercedes car with web server

cameras, disks etc. that sit directly on networks


SUSHMA RAWAL
23

Key Recent Trends


Increasing need for flexibility
time-to-market under ever changing standards!

Often must meet tight deadlines.


6 month market window is common.

Need careful co-design of h/w & s/w!

SUSHMA RAWAL

24

The co-design ladder


In the past:
Hardware and software design technologies were very different Recent maturation of synthesis enables a unified view of hardware and software
Sequential program code (e.g., C, VHDL) Compilers (1960's,1970's) Behavioral synthesis (1990's) Register transfers Assembly instructions Assemblers, linkers (1950's, 1960's) RT synthesis (1980's, 1990's) Logic equations / FSM's Logic synthesis (1970's, 1980's) Logic gates

Machine instructions

SW/HW codesign

Implementation Microprocessor plus program VLSI, ASIC, or PLD bits: software implementation: hardware

The choice of hardware versus software for a particular function is simply a tradeoff among various design metrics, like performance, power, size, and especially flexibility; there is no fundamental difference between what hardware or software can implement.
SUSHMA RAWAL
25

Hardware components of an Embedded System


CPU: Microprocessor/ Microcontroller/DSP Non Volatile memory: EPROM, Flash Volatile memory: DRAM, SRAM System clocks: RTC circuitry, System clock Standard devices: I/O ports, peripherals, Custom devices: FPGA, PAL Communication devices and drivers: Ethernet, RS232, USART Debug mechanism: Debug port, Watchdog timer, JTAG, ICE Buses for device networks: I2C, CAN, SPI, etc.
SUSHMA RAWAL
26

Essential Considerations
Response Time -- Real Time Systems Area Cost Portability Low Power (Battery Life) Fault Tolerance-continue operation despite hardware and software faults

SUSHMA RAWAL

27

Basics of Hardware-processor Classifications

SUSHMA RAWAL

28

Processor Classifications
Based on register size
-8 bit -32 bit

Based on Endianness
- Big Endian - Little Endian

Based of instruction set


- RISC - CISC
SUSHMA RAWAL
29

Processor Classifications
Based on Bus Architecture
-Von Neumann Architecture -Harvard Architecture

Based on Functionality
-General purpose Processors -Special purpose Processors-DSP, Network

SUSHMA RAWAL

30

Based on register size


Processors can be classified as 8 bit/16 bit/32 bit /64 bit based on the size of their internal registers. Typically, the data bus width equals the size of the data registers so that the register data can be read/written in one read/write cycle.

SUSHMA RAWAL

31

Based on Endianness
Big Endian Eg: SPARC, power PC Little Endian Intel processors Configurable Processors some processors can be configured during bootup process as big or little endian. Eg: ARM processors
SUSHMA RAWAL
32

Based on Instruction Set


RISC Only load/store instructions use the external memory. All instructions are same size and fixed length. Number of instructions available are less compared to CISC. Typically has less pipeline stages than CISC. Eg ARM processor.
SUSHMA RAWAL
33

Based on Instruction set


CISC Most instructions can operation directly on external memory. Hence require less number of registers. Instructions are of different sizes. Hence they take varied clock cycle to decode and execute each instruction Pipeline stages take varied times and hence pipeline is not so efficient as the RISC processors.
SUSHMA RAWAL
34

Based on Instruction set


CISC More number of instructions since many complex operations are implemented Eg: Intel Pentium processors

SUSHMA RAWAL

35

Based on Bus Architecture-Von Neumann


A Von-Neumann Machine Architecture provides one data path (bus) for both instruction and data As a result, the CPU can either be fetching an instruction from memory, or read/writing data to it Other than less complexity of hardware, it allows for using a single, sequential memory. Todays processing speeds vastly outpace memory access times, and we employ a very fast but small amount of memory (cache) 36 SUSHMA local to the processor RAWAL

Harvard Architecture refers to a memory structure where the processor is connected to two different memory banks via two sets of buses This is to provide the processor with two distinct data paths, one for instruction and one for data Through this scheme, the CPU can read both an instruction and data from the respective memory banks at the same time This inherent independence increases the throughput of the machine by enabling it to always prefetch the next instruction The cost of such a system is complexity in hardware Commonly used in DSPs
SUSHMA RAWAL
37

Based on Bus ArchitectureHarvard

Based on Bus Architecture


Modern processors employ a Harvard Architecture to read from two instruction and data caches, when at the same time using a Von-Neumann Architecture to access external memory

SUSHMA RAWAL

38

Based on Functionality
General purpose processors: - All the regular processors Special purpose processors: - Digital Signal Processors
DSP processors are microprocessors designed for efficient mathematical manipulation of digital signals. They are optimized for doing intense addition and multiplication operations.

SUSHMA RAWAL

39

Based on Functionality
-Network Processors . Used in routers. Multiple processors are
pipelined to process the network packets in a optimal way. . Each processor processes multiple packets concurrently in multiple threads. . Eg : IXP1200 from Intel

SUSHMA RAWAL

40

Various types of Memory


DRAM: Dynamic Random Access Memory very dense (1 transistor per bit) and inexpensive requires refresh and often not the fastest access times often used for main memories SRAM: Static Random Access Memory fast and no refresh required not so dense and not so cheap often used for caches
SUSHMA RAWAL
41

Various types of Memory


ROM: Read-Only Memory often used for bootstrapping All ROM devices can retain data and programs forever, even during power failure. PROM: Programmable ROM - Once programmed, its contents cannot be changed. - One time programmable.

SUSHMA RAWAL

42

Various types of Memory


EPROM: Erasable-and-programmable ROM - EPROM can be erased and programmed repeatedly. - Essential part of software development and testing.

SUSHMA RAWAL

43

Various types of Memory


Hybrid Devices - hybrid memories can be written as desired, like RAM, but maintained their contents without electrical power, just like ROM - two of hybrid devices EEPROM and Flash are ROM devices used to store code. - third hybrid device NVRAM, is modified version of SRAM. EEPROMs are electrically erasable and programmable.

SUSHMA RAWAL

44

Various types of Memory


Flash memory - high density, low cost, nonvolatile, fast and electrically erasable. - Flash devices can be erased one sector at a time. - sector sizes range from 256 bytes to 16 KB NVRAM - usually SRAM with a battery backup - when power is turned on, operates just like SRAM - when power is turned off, NVRAM draws power from battery to retain its data

SUSHMA RAWAL

45

The Embedded Software Development Process

SUSHMA RAWAL

46

The Tools
Compiler: Translates human readable code into assembly language or opcodes for a particular processor. Produces an object file. Assembler: Translates assembly language into opcodes. Also produces an object file. Linker: Organizes the object files, necessary libraries, and other data and produces a relocatable file.
SUSHMA RAWAL
47

The Tools
Relocatable file: an object file that holds code and data suitable for linking with other object files to create an executable or a shared object file. In other word, you can say that relocatable file is a foundation for creating executables and libraries. Locator: Takes the relocatable file and information about the memory of the system and produces an executable file. (By the way: gcc takes care of all of these functions at once)
SUSHMA RAWAL
48

The Tools: Embedded System Specifics


All of the tools run on the host computer, not the embedded computer. Compiler Assembler Linker Locator Another alternative is to add a real-time operating system or embedded operating system, which may have DSP capabilities like DSPnano RTOS.

SUSHMA RAWAL

49

The Tools: Embedded System Specifics


Cross Compiler A compiler that generates machine language for a different type of computer than the one the compiler is running in.
Cross-compiling doesnt guarantee correct target code due to (e.g., differences in word sizes, instruction sizes, variable declarations, library functions)

Cross Assembler An assembler that generates machine language for a different type of computer than the one the assembler is running in. It is used to develop programs for computers on a chip or microprocessors used in specialized applications that are either too small or are otherwise incapable of handling the development software.
SUSHMA RAWAL
50

Moving the program onto the embedded system


Remember, the program is written (and possibly run in an emulator) on a host computer, but it still needs to get onto the embedded system. Methods: Build/burn the program into the hardware (firmware or other flash memory) Bootloader: a bootloader resides on the embedded system and facilitates loading programs onto the system. Debug Monitor: The debug monitor is a more robust program on an embedded system that helps with debugging, and can include a bootloader as well.
SUSHMA RAWAL
51

Debugging
Debugging embedded systems can be facilitated with a Debug Monitor, or through a remote debugger on the host computer. A serial link is normally set up. Emulators can be used to test the system without utilizing the actual hardware A complete emulator provides a simulation of all aspects of the hardware, allowing all of it to be controlled and modified, and allowing debugging on a normal PC.

SUSHMA RAWAL

52

Debugging
An in-circuit debugger (ICD), a hardware device that connects to the microprocessor via a JTAG or Nexus interface. This allows the operation of the microprocessor to be controlled externally, but is typically restricted to specific debugging capabilities in the processor An in-circuit emulator (ICE) is a hardware device used to debug the software of an embedded system. An in-circuit emulator replaces the microprocessor with a simulated equivalent, providing full control over all aspects of the microprocessor. In-circuit emulation can also refer to the use of hardware emulation, when the emulator is plugged into a system (not always embedded) in place of a yet-to-be-built chip (not always a processor). These in-circuit emulators provide a way to run the system with "live" data while still allowing relatively good SUSHMA debugging capabilities. RAWAL

53

Debugging
Software Simulators allow the programmer to debug completely on the host system, which can be quicker . When it comes down to it, an oscilloscope and a multimeter can be your best friend for debugging.

SUSHMA RAWAL

54

Device Drivers
Device Any peripheral such as a graphics display, disk driver, terminal, or printer is a device. A device is usually considered to be a piece of hardware that you can connect to your computer system and that you wish to manipulate by sending commands and data.

SUSHMA RAWAL

55

Device Drivers
Three Classes of Device Character Devices ex: Key board, mouse, monitor, printer, Tape, etc., Block Devices Ex: CD-ROM, floppy, Hard disk, etc., Network Interfaces ex: Ethernet card, etc.,

SUSHMA RAWAL

56

Device Drivers
The OS interacts with devices through a program known as Device Driver A device driver is a specific type of computer software developed to allow interaction with hardware devices. Typically this constitutes an interface for communicating with the device, through the specific computer bus or communications subsystem that the hardware is connected to, providing commands to and/or receiving data from the device, and on the other end, the requisite interfaces to the operating system and software applications
SUSHMA RAWAL

57

Device Drivers
Structure of Device Driver is OS specific Some RTOS allow device drivers to be installed and removed dynamically. Statically linked driver, whose object code is linked with the kernel. The code of such device driver is physically contained in the kernel and therefore loaded in memory when the system boots. Dynamically linked driver, whose object code is NOT linked with the kernel. The code of such device driver is NOT contained in the kernel, and the device driver is loaded and unloaded as and when required.

SUSHMA RAWAL

58

Real time in operating systems


The ability of the operating system to provide a required level of service in a bounded response time.

SUSHMA RAWAL

59

Characteristics of an Embedded OS
Small footprint Memory Resident: size is important consideration
Data structure optimized Kernel optimized and usually in assembly language

Modular & extendible Provide efficient methods for resource management Real-time scheduling
tight-coupled scheduler and interrupts
SUSHMA RAWAL Power management capabilities
60

Who are the Embedded OS players


Wind River Systems VxWorks pSOS Mentor Graphics Nucleus Palm Computing PalmOS Symbian SymbianOS

SUSHMA RAWAL

61

Challenges in embedded system design


How much hardware do we need?
How big is the CPU? Memory?

How do we meet our deadlines?


Faster hardware or cleverer software?

How do we minimize power?


Turn off unnecessary logic? Reduce memory accesses?

SUSHMA RAWAL

62

You might also like