Top Banner
1 Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper - V Embedded Systems Unit - I Introduction : Embedded Systems and general purpose computer systems, history, classifications, applications and purpose of embedded systems. Core of Embedded Systems : Microprocessors and microcontrollers, RISC and CISC controllers, Big endian and Little endian processors, Application specific ICs, Programmable logic devices, COTS, sensors and actuators, communication interface, embedded firmware, other system components, PCB and passive components. Unit - II Characteristics and quality attributes of embedded systems : Characteristics, Operational and non- operational quality attributes, application specific embedded system - washing machine, domain specific - automotive. Unit - III Programming Embedded Systems : Structure of embedded program, infinite loop, compiling, linking and locating, downloading and debugging. Unit - IV Embedded hardware : Memory map, i/o map, interrupt map, processor family, external peripherals, memory - RAM, ROM, types of RAM and ROM, memory testing, CRC, Flash memory. Unit - V Peripherals : Control and Status Registers, Device Driver, Timer Driver-Watchdog Timers, Embedded Operating System, Real-Time Characteristics, Selection Process. Unit - VI Design and Development : Embedded System development environment - IDE, Types of file generated on cross compilation, disassembler / decompiler, simulator, emulator and debugging, embedded product development life-cycle, trends in embedded industry. Books : Programming Embedded Systems in C and C++, First Edition January, Michael Barr, O’ Reilly Introduction to embedded systems, Shibu K V Tata McGraw-Hill.
112

Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

Feb 06, 2018

Download

Documents

dobao
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

1

SyllabusS.Y.B.Sc (Information Technology)

Sem - IV, Paper - VEmbedded Systems

Unit - I Introduction : Embedded Systems and general purposecomputer systems, history, classifications, applicationsand purpose of embedded systems.

Core of Embedded Systems : Microprocessors andmicrocontrollers, RISC and CISC controllers, Big endianand Little endian processors, Application specific ICs,Programmable logic devices, COTS, sensors andactuators, communication interface, embedded firmware,other system components, PCB and passivecomponents.

Unit - II Characteristics and quality attributes of embeddedsystems : Characteristics, Operational and non-operational quality attributes, application specificembedded system - washing machine, domain specific -automotive.

Unit - III Programming Embedded Systems : Structure ofembedded program, infinite loop, compiling, linking andlocating, downloading and debugging.

Unit - IV Embedded hardware : Memory map, i/o map, interruptmap, processor family, external peripherals, memory -RAM, ROM, types of RAM and ROM, memory testing,CRC, Flash memory.

Unit - V Peripherals : Control and Status Registers, DeviceDriver, Timer Driver-Watchdog Timers, EmbeddedOperating System, Real-Time Characteristics, SelectionProcess.

Unit - VI Design and Development : Embedded Systemdevelopment environment - IDE, Types of file generatedon cross compilation, disassembler / decompiler,simulator, emulator and debugging, embedded productdevelopment life-cycle, trends in embedded industry.

Books :

Programming Embedded Systems in C and C++, First EditionJanuary, Michael Barr, O’ Reilly Introduction to embedded systems,Shibu K V Tata McGraw-Hill.

Page 2: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

2

References :

Embedded Systems, Rajkamal, TataMcGraw-Hill

Term Work :Assignments : Should contain at least 6 assignments (one perunit) covering the Syllabus.

Tutorial : At least three tutorials based on above syllabus must beconducted.

Practical List :

1) Configure timer control registers of 8051 and develop aprogram to generate given time delay.

2) Port I / O : Use one of the four ports of 8051 for O / Pinterfaced to eight LED’s. Simulate binary counter (8 bit) onLED’s.

3) Serial I / O : Configure 8051 serial port for asynchronous serialcommunication with serial port of PC exchange text messagesto PC and display on PC screen. Signify end of message bycarriage return.

4) Interface 8051 with D/A converter and generate square waveof given frequency on oscilloscope.

5) Interface 8051 with D/A converter and generate triangularwave of given frequency on oscilloscope.

6) Using D/A converter generate sine wave on oscilloscope withthe help of lookup table stored in data area of 8051.

7) Interface Stepper motor with 8051 and write a program tomove the motor through a given angle in clock wise or counterclock wise direction.

8) Generate traffic signal.9) Temperature controller.10) Elevator control.

Page 3: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

3

1EMBEDDED SYSTEM : AN INTRODUCTION

Unit Structure1.0 Objectives1.1 Introduction1.2 Definition of Embedded System1.3History of Embedded System1.4Embedded System & General purpose computer1.5Classification of Embedded System1.6Application of Embedded System1.7Purpose of Embedded System1.8Review Questions1.9References & Further Reading

1.0 OBJECTIVES

To understand what is an Embedded System and then define it Look at embedded systems from a historical point of view Classify embedded systems Look at certain applications & purposes of embedded systems

1.1 INTRODUCTION

This chapter introduces the reader to the world of embeddedsystems. Everything that we look around us today is electronic. Thedays are gone where almost everything was manual. Now even thefood that we eat is cooked with the assistance of a microchip (oven)and the ease at which we wash our clothes is due to the washingmachine. This world of electronic items is made up of embeddedsystem. In this chapter we will understand the basics of embeddedsystem right from its definition.

1.2 DEFINITION OF AN EMBEDDED SYSTEM

• An embedded system is a combination of 3 things:a. Hardwareb. Softwarec. Mechanical Components

And it is supposed to do one specific task only.

Page 4: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

4

• Example 1: Washing MachineA washing machine from an embedded systems point ofview has:a. Hardware: Buttons, Display & buzzer, electronic circuitry.b. Software: It has a chip on the circuit that holds the

software which drives controls & monitors the variousoperations possible.

c. Mechanical Components: the internals of a washingmachine which actually wash the clothes control the inputand output of water, the chassis itself.

• Example 2: Air ConditionerAn Air Conditioner from an embedded systems point of viewhas:a. Hardware: Remote, Display & buzzer, Infrared Sensors,

electronic circuitry.b. Software: It has a chip on the circuit that holds the

software which drives controls & monitors the variousoperations possible. The software monitors the externaltemperature through the sensors and then releases thecoolant or suppresses it.

c. Mechanical Components: the internals of an airconditioner the motor, the chassis, the outlet, etc

• An embedded system is designed to do a specific job only.Example: a washing machine can only wash clothes, an airconditioner can control the temperature in the room in which it isplaced.

• The hardware & mechanical components will consist all thephysically visible things that are used for input, output, etc.

• An embedded system will always have a chip (eithermicroprocessor or microcontroller) that has the code or softwarewhich drives the system.

1.3 HISTORY OF EMBEDDED SYSTEM

• The first recognised embedded system is the ApolloGuidance Computer(AGC) developed by MIT lab.

• AGC was designed on 4K words of ROM & 256 words ofRAM.

• The clock frequency of first microchip used in AGC was1.024 MHz.

• The computing unit of AGC consists of 11 instructions and16 bit word logic.

Page 5: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

5

• It used 5000 ICs.• The UI of AGC is known DSKY(display/keyboard) which

resembles a calculator type keypad with array of numerals.• The first mass-produced embedded system was guidance

computer for the Minuteman-I missile in 1961.• In the year 1971 Intel introduced the world's first

microprocessor chip called the 4004, was designed for usein business calculators. It was produced by the Japanesecompany Busicom.

1.4 EMBEDDED SYSTEM & GENERAL PURPOSECOMPUTER

The Embedded System and the General purpose computerare at two extremes. The embedded system is designed to performa specific task whereas as per definition the general purposecomputer is meant for general use. It can be used for playinggames, watching movies, creating software, work on documents orspreadsheets etc.

Following are certain specific points of difference betweenembedded systems and general purpose computers:

Criteria General PurposeComputer

Embedded system

Contents It is combination ofgeneric hardware and ageneral purpose OS forexecuting a variety ofapplications.

It is combination of specialpurpose hardware andembedded OS for executingspecific set of applications

OperatingSystem

It contains generalpurpose operating system

It may or may not containoperating system.

Alterations Applications are alterableby the user.

Applications are non-alterableby the user.

Key factor Performance” is keyfactor.

Application specificrequirements are key factors.

PowerConsumption

More Less

ResponseTime

Not Critical Critical for someapplications

Page 6: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

6

1.5 CLASSIFICATION OF EMBEDDED SYSTEM

The classification of embedded system is based on followingcriteria's: On generation On complexity & performance On deterministic behaviour On triggering

1.5.1 On generation1. First generation(1G): Built around 8bit microprocessor & microcontroller. Simple in hardware circuit & firmware developed. Examples: Digital telephone keypads.

2. Second generation(2G): Built around 16-bit µp & 8-bit µc. They are more complex & powerful than 1G µp & µc. Examples: SCADA systems

3. Third generation(3G): Built around 32-bit µp & 16-bit µc. Concepts like Digital Signal Processors(DSPs),

Application Specific Integrated Circuits(ASICs) evolved. Examples: Robotics, Media, etc.

4. Fourth generation: Built around 64-bit µp & 32-bit µc. The concept of System on Chips (SoC), Multicore

Processors evolved. Highly complex & very powerful. Examples: Smart Phones.

1.5.2 On complexity & performance1. Small-scale: Simple in application need Performance not time-critical. Built around low performance & low cost 8 or 16 bit

µp/µc. Example: an electronic toy

2. Medium-scale: Slightly complex in hardware & firmware requirement. Built around medium performance & low cost 16 or 32 bit

µp/µc. Usually contain operating system. Examples: Industrial machines.

Page 7: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

7

3. Large-scale: Highly complex hardware & firmware. Built around 32 or 64 bit RISC µp/µc or PLDs or Multicore

Processors. Response is time-critical. Examples: Mission critical applications.

1.5.3 On deterministic behaviour

This classification is applicable for “Real Time” systems. The task execution behaviour for an embedded system

may be deterministic or non-deterministic. Based on execution behaviour Real Time embedded

systems are divided into Hard and Soft.

1.5.4 On triggering Embedded systems which are “Reactive” in nature can

be based on triggering. Reactive systems can be:

Event triggered Time triggered

1.6 APPLICATION OF EMBEDDED SYSTEM

The application areas and the products in the embedded domainare countless.

1. Consumer Electronics: Camcorders, Cameras.2. Household appliances: Washing machine, Refrigerator.3. Automotive industry: Anti-lock breaking system(ABS), engine

control.4. Home automation & security systems: Air conditioners,

sprinklers, fire alarms.5. Telecom: Cellular phones, telephone switches.6. Computer peripherals: Printers, scanners.7. Computer networking systems: Network routers and

switches.8. Healthcare: EEG, ECG machines.9. Banking & Retail: Automatic teller machines, point of sales.10.Card Readers: Barcode, smart card readers.

1.7 PURPOSE OF EMBEDDED SYSTEM

1. Data Collection/Storage/Representation Embedded system 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. Data can be analog or digital.

Page 8: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

8

Embedded systems with analog data capturing techniquescollect data directly in the form of analog signal whereasembedded systems with digital data collection mechanismconverts the analog signal to the digital signal using analog todigital converters. If the data is digital it can be directly captured by digital

embedded system. A digital camera is a typical example of an embedded System with data collection/storage/representation of data. Images are captured and the captured image may be stored

within the memory of the camera. The captured image canalso be presented to the user through a graphic LCD unit.

2. Data communication Embedded data communication systems are deployed in

applications from complex satellite communication to simplehome networking systems. The transmission of data is achieved either by a wire-line

medium or by a wire-less medium. Data can either be transmitted by analog means or by digital

means. Wireless modules-Bluetooth, Wi-Fi. Wire-line modules-USB, TCP/IP. Network hubs, routers, switches are examples of dedicated

data transmission embedded systems.

3. Data signal processing Embedded systems with signal processing functionalities are

employed in applications demanding signal processing likespeech coding, audio video codec, transmission applicationsetc. A digital hearing aid is a typical example of an embedded

system employing data processing. Digital hearing aid improves the hearing capacity of hearing

impaired person

4. Monitoring All embedded products coming under the medical domain are

with monitoring functions. Electro cardiogram machine is intended to do the monitoring

of the heartbeat of a patient but it cannot impose control overthe heartbeat. Other examples with monitoring function are digital CRO,

digital multi-meters, and logic analyzers.

5. Control A system with control functionality contains both sensors and

actuators.

Page 9: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

9

Sensors are connected to the input port for capturing thechanges in environmental variable and the actuatorsconnected to the output port are controlled according to thechanges in the input variable.

Air conditioner system used to control the room temperatureto a specified limit is a typical example for CONTROLpurpose.

6. Application specific user interface Buttons, switches, keypad, lights, bells, display units etc are

application specific user interfaces. Mobile phone is an example of application specific user

interface. In mobile phone the user interface is provided through the

keypad, system speaker, vibration alert etc.

1.8 REVIEW QUESTIONS

1. Define Embedded System with the help of Microwave Owenas an example

2. Differentiate between general purpose computers &embedded systems

3. Give a classification of embedded systems4. List some applications of embedded systems5. Explain the various possible purposes of using and

embedded system.

1.9 REFERENCES & FURTHER READING

1. Programming Embedded systems in C++ by Michael Barr2. Introduction to Embedded systems – Shibu K. V

Page 10: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

10

2

ELEMENTS OF EMBEDDED SYSTEMS

Unit Structure3.0 Objectives3.1 Introduction3.2 Elements of Embedded Systems.3.3Case studies (examples)

3.3.1 Washing machine3.3.2 Microwave owen3.3.3 Automotive Embedded System (AES)

3.4Review questions3.5References & further reading

3.0 OBJECTIVES

After learning this chapter you will be able to:1. Define and describe the elements of an embedded system2. Understand how embedded system works with the help of two

case studies:i. Washing Machineii. Microwave Owen

3.1 INTRODUCTION

The previous chapter was an introduction to the world ofembedded systems and helped us define what is an embeddedsystem.

This chapter introduces us to the elements of an embeddedsystem and explains how embedded system works with the help oftwo case studies.

3.2 ELEMENTS OF EMBEDDED SYSTEMS.

• As defined earlier, an embedded system is a combination of 3things:

d. Hardwaree. Softwaref. Mechanical Components

And it is supposed to do one specific task only.

Page 11: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

11

Diagrammatically an embedded system can be represented asfollows:

Figure 2.0 : Elements of an Embedded System

• Embedded systems are basically designed to regulate aphysical variable (such Microwave Oven) or to manipulate thestate of some devices by sending some signals to the actuatorsor devices connected to the output port system (such astemperature in Air Conditioner), in response to the input signalprovided by the end users or sensors which are connected tothe input ports.

• Hence the embedded systems can be viewed as a reactivesystem.

• Examples of common user interface input devices arekeyboards, push button, switches, etc.

• The memory of the system is responsible for holding the code(control algorithm and other important configuration details).

• An embedded system without code (i.e. the control algorithm)implemented memory has all the peripherals but is not capableof making decisions depending on the situational as well as realworld changes.

• Memory for implementing the code may be present on theprocessor or may be implemented as a separate chip interfacingthe processor In a controller based embedded system, thecontroller may contain internal memory for storing code

• Such controllers are called Micro-controllers with on-chip ROM,eg. Atmel AT89C51.

Page 12: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

12

2.3 CASE STUDIES (EXAMPLES)

Here are some case studies on some commonly usedembedded systems that will help to better understand theconcept.

2.3.1 Washing MachineLet us see the important parts of the washing machine; this willalso help us understand the working of the washing machine:

1) Water inlet control valve: Near the water inlet point of thewashing there is water inlet control valve. When you load theclothes in washing machine, this valve gets openedautomatically and it closes automatically depending on the totalquantity of the water required. The water control valve isactually the solenoid valve.

2) Water pump: The water pump circulates water through thewashing machine. It works in two directions, re-circulating thewater during wash cycle and draining the water during the spincycle.

Figure 2.1 : Parts of a Washing Machine

Page 13: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

13

3) Tub: There are two types of tubs in the washing washingmachine: inner and outer. The clothes are loaded in the innertub, where the clothes are washed, rinsed and dried. The innertub has small holes for draining the water. The external tubcovers theinner tub and supports it during various cycles ofclothes washing.

4) Agitator or rotating disc: The agitator is located inside the tubof the washing machine. It is the important part of the washingmachine that actually performs the cleaning operation of theclothes. During the wash cycle the agitator rotates continuouslyand produces strong rotating currents within the water due towhich the clothes also rotate inside the tub. The rotation of theclothes within water containing the detergent enables theremoval of the dirt particles from the fabric of the clothes. Thusthe agitator produces most important function of rubbing theclothes with each other as well as with water.

In some washing machines, instead of the long agitator, there isa disc that contains blades on its upper side. The rotation of thedisc and the blades produce strong currents within the waterand the rubbing of clothes that helps in removing the dirt fromclothes.

5) Motor of the washing machine: The motor is coupled to theagitator or the disc and produces it rotator motion. These aremultispeed motors, whose speed can be changed as per therequirement. In the fully automatic washing machine the speedof the motor i.e. the agitator changes automatically as per theload on the washing machine.

6) Timer: The timer helps setting the wash time for the clothesmanually. In the automatic mode the time is set automaticallydepending upon the number of clothes inside the washingmachine.

7) Printed circuit board (PCB): The PCB comprises of the variouselectronic components and circuits, which are programmed toperform in unique ways depending on the load conditions (thecondition and the amount of clothes loaded in the washingmachine). They are sort of artificial intelligence devices thatsense the various external conditions and take the decisionsaccordingly. These are also called as fuzzy logic systems. Thusthe PCB will calculate the total weight of the clothes, and findout the quantity of water and detergent required, and the totaltime required for washing the clothes. Then they will decide thetime required for washing and rinsing. The entire processing isdone on a kind of processor which may be a microprocessor ormicrocontroller.

Page 14: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

14

8) Drain pipe: The drain pipe enables removing the dirty waterfrom the washing that has been used for the washing purpose.

2.3.2 Microwave OwenLet us see the important parts of the microwave oven; this willalso help us understand the working of the washing machine:

Figure 2.3 : Parts of a Microwave Owen

A microwave oven consists of:1. A high voltage transformer, which passes energy to the

magnetron2. A cavity magnetron,3. A Control circuit with a microcontroller,4. A waveguide, and5. A cooking chamber

1. A Transformer transfers electrical energy through a circuit bymagnetic coupling without using motion between parts. Theseare used for supplying power to the magnetron.

2. A Cavity magnetron is a microwave antenna placed in avacuum tube and oscillated in an electromagnetic field in orderto produce high GHz microwaves. Magnetrons are used inmicrowave ovens and radar systems.

3. A control circuit with a microcontroller is integrated on a circuitboard. The microcontroller controls the waveguide and theentire unit so the microwaves are emitted at a constant rate.

4. A Waveguide is any linear structure that guideselectromagnetic waves for the purpose of transmitting power or

Page 15: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

15

signals. Generally constructed of a hollow metal pipe. Placing awaveguide into a vacuum causes radio waves to scatter.

5. A Cooking Chamber is a microwave safe container theprevents microwaves from escaping. The door has a microwaveproof mesh with holes that are just small enough thatmicrowaves can't pass through but lightwaves can. The cookingchamber itself is a Faraday cage enclosure which prevents themicrowaves from escaping into the environment. The oven dooris usually a glass panel for easy viewing, but has a layer ofconductive mesh to maintain the shielding.

2.3.3 Automotive Embedded System (AES)• The Automotive industry is one of the major application

domains of embedded systems.

• Automotive embedded systems are the one where

electronics take control over the mechanical system. Ex.

Simple viper control.

• The number of embedded controllers in a normal vehicle

varies somewhere between 20 to 40 and can easily be

between 75 to 100 for more sophisticated vehicles.

• One of the first and very popular use of embedded system in

automotive industry was microprocessor based fuel injection.

• Some of the other uses of embedded controllers in a vehicle

are listed below:

a. Air Conditioner

b. Engine Control

c. Fan Control

d. Headlamp Control

e. Automatic break system control

f. Wiper control

g. Air bag control

h. Power Windows

• AES are normally built around microcontrollers or DSPs or a

hybrid of the two and are generally known as Electronic

Control Units (ECUs).

Page 16: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

16

• Types Of Electronic Control Units(ECU)1. High-speed Electronic Control Units (HECUs):

a. HECUs are deployed in critical control units

requiring fast response.

b. They Include fuel injection systems, antilock brake

systems, engine control, electronic throttle,

steering controls, transmission control and central

control units.

2. Low Speed Electronic Control Units (LECUs):-a. They are deployed in applications where

response time is not so critical.

b. They are built around low cost microprocessors

and microcontrollers and digital signal processors.

c. Audio controller, passenger and driver door locks,

door glass control etc.

• Automotive Communication BusesEmbedded system used inside an automobile

communicate with each other using serial buses. This

reduces the wiring required.

Following are the different types of serial Interfaces used

in automotive embedded applications:

a. Controller Area Network (CAN):- CAN bus was originally proposed by Robert Bosch.

It supports medium speed and high speed data

transfer

CAN is an event driven protocol interface with support

for error handling in data transmission.

b. Local Interconnect Network (LIN):-

• LIN bus is single master multiple slavecommunication interface with support for data ratesup to 20 Kbps and is used for sensor/actuatorinterfacing

Page 17: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

17

• LIN bus follows the master communication triggeringto eliminate the bus arbitration problem

• LIN bus applications are mirror controls , fan controls, seat positioning controls

c. Media-Oriented System Transport(MOST):-

• MOST is targeted for automotive audio/video

equipment interfacing

• A MOST bus is a multimedia fiber optics point–to-

point network implemented in a star , ring or daisy

chained topology over optical fiber cables.

• MOST bus specifications define the physical as well

as application layer , network layer and media access

control.

2.4 REVIEW QUESTIONS

1. What is an embedded system? What are the workingelements of an embedded system?

2. Explain the working of embedded system with respect to:B. Washing MachineC. MICROWAVE Owen

3. Conduct case studies for working of embedded systems forthe following topics:A. Air ConditionerB. Automobile

2.5 REFERENCES & FURTHER READING

Books:1. Programming Embedded systems in C++ by Michael Barr2. Introduction to Embedded systems – Shibu K. V

Websites:1. Washing Machine: http://www.brighthubengineering.com2. Microwave Owen : http://globalmicrowave.org/microwaves.php

Page 18: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

18

3CORE THE OF EMBEDDED SYSTEM

Unit Structure6.0 Objectives6.1 Introduction6.2Core of embedded systems

6.2.1 General purpose and domain specific processor.6.2.1.1 Microprocessors6.2.1.2 Microcontrollers.6.2.1.3 Digital signal processors

6.2.2 Application Specific Integrated Circuits. (ASIC)6.2.3 Programmable logic devices(PLD’s)6.2.4 Commercial off-the-shelf components(COTs)

6.3Sensors & Actuators6.4Communication Interface6.5Review Questions6.6References & Further Reading

3.0 OBJECTIVES

After reading this chapter you will be able to: Understand the different types of core i.e processor Understand difference between microprocessor &

microcontroller Understand the classification of processors based on Bus

Architecture, Instruction set Architecture and Endianness. Have an overview of processors from most simple and

cheap to most expensive and complex, powerful Understand what are sensors and actuators, communication

interfaces

3.1 INTRODUCTION

The first two chapters attempted on explain what anembedded system is about and what the working parts are. Thischapter attempts to go deeper and explain the core of embeddedsystem along with other related topics.

Page 19: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

19

3.2 CORE OF EMBEDDED SYSTEMS

Embedded systems are domain and application specificand are built around a central core. The core of the embeddedsystem falls into any of the following categories:

1. General purpose and Domain Specific Processors1.1. Microprocessors1.2. Microcontrollers1.3. Digital Signal Processors

2. Application Specific Integrated Circuits. (ASIC)3. Programmable logic devices(PLD’s)4. Commercial off-the-shelf components (COTs)

3.2.1 GENERAL PURPOSE AND DOMAIN SPECIFICPROCESSOR.

• Almost 80% of the embedded systems are processor/controller based.

• The processor may be microprocessor or a microcontrolleror digital signal processor, depending on the domain andapplication.

3.2.1.1 MICROPROCESSORS• A microprocessor is a silicon chip representing a central

processing unit.

• A microprocessor is a dependent unit and it requires thecombination of other hardware like memory, timer unit, andinterrupt controller, etc. for proper functioning.

• Developers of microprocessors.o Intel – Intel 4004 – November 1971(4-bit).o Intel – Intel 4040.o Intel – Intel 8008 – April 1972.o Intel – Intel 8080 – April 1974(8-bit).o Motorola – Motorola 6800.o Intel – Intel 8085 – 1976.o Zilog - Z80 – July 1976.

• Architectures used for processor design are Harvard or Von-Neumann.

Page 20: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

20

Harvard architecture Von-Neumann architecture It has separate buses for

instruction as well as datafetching.

Easier to pipeline, so highperformance can be achieve.

Comparatively high cost. Since data memory and

program memory are storedphysically in different locations,no chances exist for accidentalcorruption of program memory.

It shares single common busfor instruction and datafetching.

Low performance ascompared to Harvardarchitecture.

It is cheaper. Accidental corruption of

program memory may occur ifdata memory and programmemory are stored physicallyin the same chip,

• RISC and CISC are the two common Instruction SetArchitectures (ISA) available for processor design.

RISC CISC Reduced Instruction Set

Computing It contains lesser number of

instructions. Instruction pipelining and

increased execution speed. Orthogonal instruction

set(allows each instruction tooperate on any register anduse any addressing mode.

Operations are performed onregisters only, only memoryoperations are load and store.

A larger number of registersare available.

Programmer needs to writemore code to execute a tasksince instructions are simplerones.

It is single, fixed lengthinstruction.

Complex Instruction SetComputing

It contains greater number ofinstructions.

Instruction pipelining featuredoes not exist.

Non-orthogonal set(allinstructions are not allowed tooperate on any register anduse any addressing mode.

Operations are performedeither on registers or memorydepending on instruction.

The number of generalpurpose registers are verylimited.

Instructions are likemacros in C language. Aprogrammer can achieve thedesired functionality with asingle instruction which in turnprovides the effect of usingmore simpler singleinstruction in RISC.

It is variable lengthinstruction.

Page 21: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

21

Less silicon usage and pincount.

With Harvard Architecture.

More silicon usage sincemore additional decoder logicis required to implement thecomplex instruction decoding.

Can be Harvard or Von-Neumann Architecture.

• Endianneso Endianness specifies the order which the data is stored in

the memory by processor operations in a multi byte system.

o Based on Endiannes processors can be of two types:1. Little Endian Processors2. Big Endian Processors

1. Little-endian means lower order data byte is stored in memoryat the lowest address and the higher order data byte at thehighest address. For e.g, 4 byte long integer Byte3, Byte2,Byte1, Byte0 will be store in the memory as follows:

Base address+0 Byte 0

Base address+1 Byte 1

Base address+2 Byte 2

Base address+3 Byte 3

(Base address)

(Base address+1)

(Base address+2)

(Base address+3)

2. Big-endian means the higher order data byte is stored inmemory at the lowest and the lower order data byte at thehighest address. For e.g. a 4 byte integer Byte3, Byte2, Byte1,Byte0 will be stored in the memory as follows:

Page 22: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

22

Base address+0 Byte 3

Base address+1 Byte 2

Base address+2 Byte 1

Base address+3 Byte 0

(Base address)

(Base address+1)

(Base address+2)

(Base address+3)

3.2.1.2 MICROCONTROLLERS.

• A microcontroller is a highly integrated chip that contains aCPU, scratch pad RAM, special and general purposeregister arrays,on chip ROM/FLASH memory for programstorage , timer and interrupt control units and dedicated I/Oports.

• Texas Instrument’s TMS 1000 Is considered as the world’sfirst microcontroller.

• Some embedded system application require only 8 bitcontrollers whereas some requiring superior performanceand computational needs demand 16/32 bit controllers.

• The instruction set of a microcontroller can be RISC orCISC.

• Microcontrollers are designed for either general purposeapplication requirement or domain specific applicationrequirement.

3.2.1.3 Digital Signal Processors

• DSP are powerful special purpose 8/16/32 bitmicroprocessor designed to meet the computationaldemands and power constraints of today’s embeddedaudio, video and communication applications.

• DSP are 2 to 3 times faster than general purposemicroprocessors in signal processing applications. This isbecause of the architectural difference between DSP andgeneral purpose microprocessors.

Page 23: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

23

• DSPs implement algorithms in hardware which speedsup the execution whereas general purpose processorimplement the algorithm in software and the speed ofexecution depends primarily on the clock for theprocessors.

• DSP includes following key units:i. Program memory: It is a memory for storing the program

required by DSP to process the data.

ii. Data memory: It is a working memory for storingtemporary variables and data/signal to be processed.

iii. Computational engine: It performs the signal processingin accordance with the stored program memorycomputational engine incorporated many specializedarithmetic units and each of them operates simultaneouslyto increase the execution speed. It also includes multiplehardware shifters for shifting operands and savesexecution time.

iv. I/O unit: It acts as an interface between the outside worldand DSP. It is responsible for capturing signals to beprocessed and delivering the processed signals.

• Examples: Audio video signal processing,telecommunication and multimedia applications.

• SOP(Sum of Products) calculation, convolution,FFT(Fast Fourier Transform), DFT(Discrete FourierTransform), etc are some of the operation performed byDSP.

3.2.2 Application Specific Integrated Circuits. (ASIC)• ASICs is a microchip design to perform a specific and

unique applications.

• Because of using single chip for integrates severalfunctions there by reduces the system development cost.

• Most of the ASICs are proprietary (which having sometrade name) products, it is referred as ApplicationSpecific Standard Products(ASSP).

• As a single chip ASIC consumes a very small area in thetotal system. Thereby helps in the design of smallersystem with high capabilities or functionalities.

Page 24: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

24

• The developers of such chips may not be interested inrevealing the internal detail of it .

3.2.3 Programmable logic devices(PLD’s)• A PLD is an electronic component. It used to build digital

circuits which are reconfigurable.

• A logic gate has a fixed function but a PLD does not have adefined function at the time of manufacture.

• PLDs offer customers a wide range of logic capacity,features, speed, voltage characteristics.

• PLDs can be reconfigured to perform any number offunctions at any time.

• A variety of tools are available for the designers of PLDswhich are inexpensive and help to develop, simulate andtest the designs.

• PLDs having following two major types.

1) CPLD(Complex Programmable Logic Device):CPLDs offer much smaller amount of logic up to 1000gates.

2) FPGAs(Field Programmable Gate Arrays):It offers highest amount of performance as well ashighest logic density, the most features.

• Advantages of PLDs :-1) PLDs offer customer much more flexibility during the

design cycle.

2) PLDs do not require long lead times for prototypes orproduction parts because PLDs are already on adistributors shelf and ready for shipment.

3) PLDs can be reprogrammed even after a piece ofequipment is shipped to a customer

3.2.4 Commercial off-the-shelf components(COTs)1) A Commercial off the Shelf product is one which is used 'as-

is'.

2) The COTS components itself may be develop around ageneral purpose or domain specific processor or an ASICsor a PLDs.

Page 25: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

25

3) The major advantage of using COTS is that they are readilyavailable in the market, are chip and a developer can cutdown his/her development time to a great extent

4) The major drawback of using COTS components inembedded design is that the manufacturer of the COTScomponent may withdraw the product or discontinue theproduction of the COTS at any time if rapid change intechnology occurs.

5) Advantages of COTS:1) Ready to use2) Easy to integrate3) Reduces development time

6) Disadvantages of COTS:1) No operational or manufacturing standard (all

proprietary)

2) Vendor or manufacturer may discontinue productionof a particular COTS product

3.3 SENSORS & ACTUATORS

• Sensor• A Sensor is used for taking Input• It is a transducer that converts energy from one form to

another for any measurement or control purpose• Ex. A Temperature sensor

• Actuator• Actuator is used for output.• It is a transducer that may be either mechanical or electrical

which converts signals to corresponding physical actions.• Ex. LED (Light Emitting Diode)• LED is a p-n junction diode and contains a CATHODE and

ANODE• For functioning the anode is connected to +ve end of power

supply and cathode is connected to –ve end of powersupply.

• The maximum current flowing through the LED is limited byconnecting a RESISTOR in series between the power supplyand LED as shown in the figure below

Page 26: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

26

• There are two ways to interface an LED to amicroprocessor/microcontroller:

1. The Anode of LED is connected to the port pin andcathode to Ground : In this approach the port pin sourcesthe current to the LED when it is at logic high(ie. 1).

2. The Cathode of LED is connected to the port pin andAnode to Vcc : In this approach the port pin sources thecurrent to the LED when it is at logic high (ie. 1). Herethe port pin sinks the current and the LED is turned ONwhen the port pin is at Logic low (ie. 0)

3.4 COMMUNICATION INTERFACES

For any embedded system, the communication interfaces canbroadly classified into:

1. Onboard Communication Interfaces• These are used for internal communication of the embedded

system i.e: communication between different componentspresent on the system.

• Common examples of onboard interfaces are:• Inter Integrated Circuit (I2C)• Serial Peripheral Interface (SPI)• Universal Asynchronous Receiver Transmitter (UART)• 1-Wire Interface• Parallel Interface

• Example :Inter Integrated Circuit (I2C)• It is synchronous• Bi-directional, half duplex , two wire serial interface bus• Developed by Phillips semiconductors in 1980

Page 27: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

27

• It comprises of two buses :1. Serial clock –SCL2. Serial Data – SDA

• SCL generates synchronization clock pulses• SDA transmits data serially across devices• I2C is a shared bus system to which many devices can

be connected• Devices connected by I2C can act as either master or

slave• The master device is responsible for controlling

communication by initiating/ terminating data transfer.• Devices acting as slave wait for commands from the

master and respond to those commands.

Figure: I2C Bus Interfacing

2. External or Peripheral Communication Interfaces• These are used for external communication of the

embedded system i.e: communication of differentcomponents present on the system with external orperipheral components/devices.

• Common examples of external interfaces are:• RS-232 C & RS-485• Universal Serial Bus (USB)• IEEE 1394 (Firewire)• Infrared (IrDA)• Bluetooth• Wi-Fi• Zig Bee• General Packet Radio Service (GPRS)• Example: RS-232 C & RS-485

Page 28: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

28

• It is wired, asynchronous, serial, full duplexcommunication

• RS 232 interface was developed by EIA (ElectronicIndustries Associates) In early 1960s

• RS 232 is the extension to UART for externalcommunications

• RS-232 logic levels use:• +3 to +25 volts to signify a "Space" (Logic 0) and• -3 to -25 volts to signify a "Mark" (logic 1).• RS 232 supports two different types of connectors :• DB 9 and DB 25 as shown in figure below

• RS 232 interface is a point to point communicationinterface and the devices involved are called as DataTerminating Equipment (DTE) And Data CommunicationsTerminating Equipment (DCE)

• Embedded devices contain UART for serial transmissionand generate signal levels as per TTL/CMOS logic.

• A level translator IC (like Max 232) is used for convertingthe signal lines from UART to RS 232 signal lines forcommunication.

• The vice versa is performed on the receiving side.• Converter chips contain converters for both transmitters

and receivers• RS 232 is used only for point to point connections• It is susceptible to noise and hence is limited to short

distances only• RS 422 is another serial interface from EIA.• It supports multipoint connections with 1 transmitter and

10 receivers.• It supports data rates up to 100Kbps and distance up to

400 ft• RS 485 is enhanced version of RS 422 and supports up

to 32 transmitters and 32 receivers

3.5 REVIEW QUESTIONS

1. What do you mean by core of the embedded system? What isits significance? What are the possible options that can be usedas a core?

2. Distinguish between Microprocessor & Microcontroller

Page 29: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

29

3. Explain the different types of processors according to theirsystem bus architecture

4. Explain the different types of processors according to Instructionset Architecture

5. Explain the different types of processors according toEndianness

6. Write short note on :i. DSPii. PLDiii. ASICiv. COTS

7. Explain Communication Interfaces with respect to embeddedsystem

8. Explain the following with example:1. Onboard communication interface2. Peripheral communication interface

9. Find out information and write case studies on the followingcommunication interfaces:

i. Infraredii. WiFiiii. Zigbeeiv. UART

3.6 REFERENCES & FURTHER READING

2. Programming Embedded systems in C++ by Michael Barr2. Introduction to Embedded systems – Shibu K. V

Page 30: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

30

4CHARACTERISTICS & QUALITY

ATTRIBUTES OF EMBEDDED SYSTEMS

Unit Structure10.0 Objectives10.1 Introduction10.2 Characteristics of Embedded System10.3 Quality Attributes of Embedded System

10.3.1 Operational Attributes10.3.2 Non Operational Attributes

10.4 Review Questions10.5 References & Further Reading

4.0 OBJECTIVES

After reading this chapter you will:1. Understand the characteristics of Embedded system2. Understand the attributes related to quality of embedded

system.

4.1 INTRODUCTION

The characteristics of embedded system are different fromthose of a general purpose computer and so are its Quality metrics.This chapter gives a brief introduction on the characteristics of anembedded system and the attributes that are associated with itsquality.

4.2 CHARACTERISTICS OF EMBEDDED SYSTEM

Following are some of the characteristics of anembedded system that make it different from a general purposecomputer:

1. Application and Domain specific• An embedded system is designed for a specific purpose

only. It will not do any other task.• Ex. A washing machine can only wash, it cannot cook• Certain embedded systems are specific to a domain: ex. A

hearing aid is an application that belongs to the domain ofsignal processing.

Page 31: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

31

2. Reactive and Real time• Certain Embedded systems are designed to react to the

events that occur in the nearby environment. These eventsalso occur real-time.

• Ex. An air conditioner adjusts its mechanical parts as soonas it gets a signal from its sensors to increase or decreasethe temperature when the user operates it using a remotecontrol.

• An embedded system uses Sensors to take inputs and hasactuators to bring out the required functionality.

3. Operation in harsh environment• Certain embedded systems are designed to operate in harsh

environments like very high temperature of the deserts orvery low temperature of the mountains or extreme rains.

• These embedded systems have to be capable of sustainingthe environmental conditions it is designed to operate in.

4. Distributed• Certain embedded systems are part of a larger system and

thus form components of a distributed system.

• These components are independent of each other but haveto work together for the larger system to function properly.

• Ex. A car has many embedded systems controlled to itsdash board. Each one is an independent embedded systemyet the entire car can be said to function properly only if allthe systems work together.

5. Small size and weight• An embedded system that is compact in size and has light

weight will be desirable or more popular than one that isbulky and heavy.

• Ex. Currently available cell phones. The cell phones thathave the maximum features are popular but also their sizeand weight is an important characteristic.

• For convenience users prefer mobile phones than phablets.(phone + tablet pc)

6. Power concerns• It is desirable that the power utilization and heat dissipation

of any embedded system be low.

Page 32: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

32

• If more heat is dissipated then additional units like heat sinksor cooling fans need to be added to the circuit.

• If more power is required then a battery of higher power ormore batteries need to be accommodated in the embeddedsystem.

4.3 QUALITY ATTRIBUTES OF EMBEDDEDSYSTEM

These are the attributes that together form the decidingfactor about the quality of an embedded system.

There are two types of quality attributes are:-

1. Operational Quality Attributes.• These are attributes related to operation or functioning of an

embedded system. The way an embedded system operatesaffects its overall quality.

2. Non-Operational Quality Attributes.• These are attributes not related to operation or functioning

of an embedded system. The way an embedded systemoperates affects its overall quality.

• These are the attributes that are associated with theembedded system before it can be put in operation.

4.3.1 Operational Attributesa) Response

• Response is a measure of quickness of the system.• It gives you an idea about how fast your system is

tracking the input variables.• Most of the embedded system demand fast response

which should be real-time.

b) Throughput• Throughput deals with the efficiency of system.• It can be defined as rate of production or process of a

defined process over a stated period of time.• In case of card reader like the ones used in buses,

throughput means how much transaction the reader canperform in a minute or hour or day.

c) Reliability• Reliability is a measure of how much percentage you rely

upon the proper functioning of the system .

Page 33: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

33

• Mean Time between failures and Mean Time To Repairare terms used in defining system reliability.

• Mean Time between failures can be defined as theaverage time the system is functioning before a failureoccurs.

• Mean time to repair can be defined as the average timethe system has spent in repairs.

d) Maintainability• Maintainability deals with support and maintenance to the

end user or a client in case of technical issues andproduct failures or on the basis of a routine systemcheckup

• It can be classified into two types :-

1. Scheduled or Periodic Maintenanceo This is the maintenance that is required

regularly after a periodic time interval.o Example :

Periodic Cleaning of Air Conditioners Refilling of printer cartridges.

2. Maintenance to unexpected failure• This involves the maintenance due to a sudden

breakdown in the functioning of the system.• Example:

1. Air conditioner not powering on2. Printer not taking paper in spite of a full

paper stack

e) Security• Confidentiality, Integrity and Availability are three corner

stones of information security.• Confidentiality deals with protection data from unauthorized

disclosure.• Integrity gives protection from unauthorized modification.• Availability gives protection from unauthorized user• Certain Embedded systems have to make sure they conform

to the security measures. Ex. An Electronic Safety DepositLocker can be used only with a pin number like a password.

f) Safety• Safety deals with the possible damage that can happen to

the operating person and environment due to the breakdownof an embedded system or due to the emission of hazardousmaterials from the embedded products.

• A safety analysis is a must in product engineering toevaluate the anticipated damage and determine the best

Page 34: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

34

course of action to bring down the consequence of damagesto an acceptable level.

4.3.2 Non Operational Attributes

a) Testability and Debug-ability• It deals with how easily one can test his/her design,

application and by which mean he/she can test it.• In hardware testing the peripherals and total hardware

function in designed manner• Firmware testing is functioning in expected way• Debug-ability is means of debugging the product as such for

figuring out the probable sources that create unexpectedbehavior in the total system

b) Evolvability• For embedded system, the qualitative attribute “Evolvability”

refer to ease with which the embedded product can bemodified to take advantage of new firmware or hardwaretechnology.

c) Portability• Portability is measured of “system Independence”.• An embedded product can be called portable if it is capable

of performing its operation as it is intended to do in variousenvironments irrespective of different processor and orcontroller and embedded operating systems.

d) Time to prototype and market• Time to Market is the time elapsed between the

conceptualization of a product and time at which the productis ready for selling or use

• Product prototyping help in reducing time to market.• Prototyping is an informal kind of rapid product development

in which important feature of the under consider are develop.• In order to shorten the time to prototype, make use of all

possible option like use of reuse, off the self component etc.

e) Per unit and total cost• Cost is an important factor which needs to be carefully

monitored. Proper market study and cost benefit analysisshould be carried out before taking decision on the per unitcost of the embedded product.

• When the product is introduced in the market, for the initialperiod the sales and revenue will be low

• There won’t be much competition when the product salesand revenue increase.

Page 35: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

35

• During the maturing phase, the growth will be steady andrevenue reaches highest point and at retirement time therewill be a drop in sales volume.

4.4 REVIEW QUESTIONS

1. Explain the characteristics of an embedded system2. Explain the Operational Quality Attributes of an

embedded system3. Explain the non quality attributes of an embedded

system

4.5 REFERENCES & FURTHER READING

1. Programming Embedded systems in C++ by Michael Barr2. Introduction to Embedded systems – Shibu K. V

Page 36: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

36

5PROGRAM FOR EMBEDDED SYSTEMS

AND BUILD PROCESS

Unit Structure15.0 Objectives15.1 Introduction15.2 Starting with Embedded Programming15.3 “Hello World” For embedded systems15.4 Blinking LED Program and Infinite loop15.5 Build Process in Embedded System15.6 Review Questions15.7 References & Further Reading

5.0 OBJECTIVES

After reading this chapter you will be able to: Know the difficulties involved in programming embedded

systems Reasons for not implementing Hello World as a first program Write a generic code for Blinking LED Infinite loop Build Process in embedded system

5.1 INTRODUCTION

This chapter gives a head start into programming theembedded system. The embedded code is just like any other codebut there are several restrictions. For Example: the code that runson a computer makes certain assumptions about the availablememory while in embedded system there is no scope forassumptions. The Embedded System Programmer has to know thehardware before he can even attempt to write any code.

This chapter introduces to the readers the Blinking LEDprogram as a first program in embedded systems and explains whythe hello world would be rather a difficult program.

Then an essential necessity of the code is explained: theinfinite loop.

Page 37: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

37

5.2 STARTING WITH EMBEDDED PROGRAMMING

• Programmers for Embedded systems must be self-reliant. Theusual built in functions (i.e. standard library routines like cin andcout) may not be available to them.

• Further, programmers for embedded systems have to knowbeforehand what hardware is involved.

Example: They should know which processor will be used, howmuch memory is available and what the memory offsets are. Allthis information will change if the underlying hardware changes.

• Embedded system programming has no scope for assumption.

Example: Memory is a very limited hence precious resource inan embedded system. A large amount of memory for code aswell as processing data would mean adding more memory tothe circuit in the form of additional memory. A simple variabledeclaration like an integer (usually 2 bytes or 4 bytes) should bethought carefully before declaring it. Declaring the samevariable as unsigned integer (1 byte) will suffice the purposeas well as save memory location.

• Not many programmers are available for programming ofembedded systems.

5.3 “HELLO WORLD” FOR EMBEDDED SYSTEMS

• Every book on programming language begins with the examplethat prints "Hello, World!" on the output screen. The hello worldis a simple program that does not involve any logic and can beimplemented by a no-brainer (beginner).

• However, in embedded systems, the hello world program wouldbe a bad choice to be implemented as a first program. In caseof any programming language the hello world program isexecuted on a general purpose computer where we haverequirements like CPU, input and output devices and interactionbetween them taken care by the software and the operatingsystem.

• In case of embedded system there may be no operating systemat all. Certain embedded systems may not even have an outputdevice like a monitor. Embedded systems usually have LEDDisplays. To incorporate a display device in an embeddedsystem the programmer would involve writing a piece of code

Page 38: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

38

called a device driver which otherwise is taken care by theoperating system in case of a general purpose computer.

• Writing a code for a device driver is not an easy job atbeginner’s level. Hence hello world is a difficult program tobegin with while learning to program embedded system.

5.4 BLINKING LED PROGRAM AND INFINITE LOOP

• The substitute for hello world program could be a program thatblinks an LED. LEDs are used in almost every embeddedsystem. Also the code used to program an LED would be verysmall.

• To blink an LED we would require the following hardware:o LEDo A microcontroller or microprocessor

• The LED can be connected to any available port i.e P1, P2, P3,P4 on the microprocessor. Assuming the LED is connected toport 2, i.e. P2 its state is controlled by a bit in a register calledthe Port 2 I/O Latch Register, also known the P2LTCH.

• The structure of the program would be like this:

void main(){ while (1) { toggle(LED_1); /* Change thestate of the LED. */ delay(500); /* Pause for 500milliseconds. */ }}

• The above piece of code is hardware independent hencecan be implemented for any circuit.

• It contains two functions namely : toggle() & delay()o toggle(): This function is used to toggle the state of

the LED.o delay(): This function is used to introduce a delay of

500 ms every time the LED is toggled• The implementation of toggle() and delay() is hardware

specific.• Infinite Loop

Page 39: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

39

o The code for every embedded program is written in aninfinite loop. This is because the embedded system issupposed to run every time it is turned on till the time itspower goes off or it stops functioning.

o The code for blinking LED is also enclosed in an infiniteloop. The functions toggle() and delay() run infinitenumber of times.

o An application of an embedded system has an infiniteloop around its code. It’s just like the program you did toimplement switch case where the program has to runcontinuously until the user selects to exit.

5.5 BUILD PROCESS IN EMBEDDED SYSTEM

• Definition: The process which converts source code toexecutable code is called as the build process.

• The build process for embedded systems is different. This isbecause the code to be run on an embedded system is writtenone platform i.e. general purpose computer and executed onanother platform i.e. the target hardware.

• An Embedded system would also use tools such as a Compiler,Linker, Locater and Debugger to perform the entire buildprocess. These tools would be a part of a larger IDE.

• A compiler which produces the executable code to be run on adifferent platform is called a cross-compiler; else it is called anative compiler.

• Ex. Turbo C++ is a native compiler. The compiler in case ofembedded systems development is a cross compiler.

• The build process involves three steps:1. Compiling2. Linking3. Locating

Page 40: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

40

Figure: Build Process in Embedded System

• Compilingo The process of compiling is done by the compiler.o The compiler takes input as source code files and gives

output as multiple object files.o Compilers for embedded systems are essentially cross-

compilers. For example while compiling the programmer hasto select the target processor for which the code has to begenerated.

o The contents of the object files depend on its format. Twocommonly used formats are: 1. Common Object file format(COFF)

2. Extended file format (ELF)o Object files generally have the following structure:

header It describes the sections that will becontained in the object file.

text It contains all code blocks

data It contains all initialized global variablesand their values

bss It contains all initialized global variables.

• Linkingo The process of linking is carried out by the linkero The linker takes input as multiple object files and gives

output as a single object file which is also called as therelocatable code.

Page 41: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

41

o The output of compiler is multiple object files. These files areincomplete in the sense that they may contain reference tovariables and functions across multiple object files whichneed to be resolved.

o The job of the linker is to combine these multiple object filesand resolve the unresolved symbols.

o The Linker does this by merging the various sections liketext, data, and bss of the individual object files. The output ofthe linker will be a single file which contains all of themachine language code from all of the input object files thatwill be in the text section of this new file, and all of theinitialized and uninitialized variables will reside in the newdata section and bss section respectively.

• Locatingo The process of relocating is carried out by the relocater.o The relocater takes input as the relocatable code produced

by the linker and gives output as the final executable code.o This output is a binary executable file which is called hex

code.o The locator needs to be given information about the memory

available on the target processor.o The locator will use this information to assign physical

memory addresses to each of the code and data sectionswithin the relocatable program code. Finally it produces anoutput file that contains a binary memory image that can beloaded into the target processors ROM.

5.6 REVIEW QUESTIONS

1. What are the difficulties involved in programming embeddedsystems?

2. Why can’t a simple program like printing “hello world” on thescreen be used as a starting program in embedded system?

3. Explain the Blinking LED program structure for embeddedsystem

4. Explain the build process for embedded system5. Write a short note on Infinite Loop.

5.7 REFERENCES & FURTHER READING

1. Programming Embedded systems in C++ by MichaelBarr

2. Introduction to Embedded systems – Shibu K. V

Page 42: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

42

6DEBUGGING ON EMBEDDED SYSTEMS

Unit Structure21.0 Objectives21.1 Introduction21.2 Downloading the embedded code21.3 Debugging the embedded software

21.3.1 Remote Debuggers21.3.2 Emulators21.3.3 Simulators

21.4 Other Tools21.5 Review Questions21.6 References & Further Reading

6.0 OBJECTIVES

• After reading this chapter you will understand:• Concept of downloading the embedded code• Debugging the embedded software• Different possible tools available for debugging• Difference between Remote Debugger, Emulator &

Simulator

6.1 INTRODUCTION

In the previous chapter we saw how the code or software tobe executed on the embedded system (target board) is written on acomputer. The resulting code created after subjecting it to be buildprocess is called the binary executable image or simply hex code.

This chapter explains how the hex code is put on the targetboard which is referred as downloading and what are the variouspossible ways of debugging a code meant to run on a embeddedsystem.

Page 43: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

43

6.2 DOWNLOADING THE EMBEDDED CODE

The code to be run on the target embedded system isalways developed on the host computer. This code is called thebinary executable image or simply hex code.

The process of putting this code in the memory chip of thetarget embedded system is called Downloading.

There are two ways of downloading the binary image on theembedded system:

1. Using a Device ProgrammerA device programmer is a piece of hardware that works in

two steps.

Step 1 Once the binary image is ready on the computer, thedevice programmer is connected to the computer and the binaryimage is transferred to the device programmer.

Step 2 The microcontroller/microprocessor or memory chip, usuallythe ROM which is supposed to contain the binary image is placedon the proper socket on the device programmer. The deviceprogrammer contains a software interface through which the userselects the target microprocessor for which the binary image has tobe downloaded. The Device programmer then transfers the binaryimage bit by bit to the chip.

2. Using In System Programmer(ISP)Certain Target embedded platforms contain a piece of

hardware called ISP that have a hardware interface to both thecomputer as well the chip where the code is to be downloaded.

The user through the ISP’s software interface sends thebinary image to the target board.

This avoids the requirement of frequently removing themicroprocessor / microcontroller or ROM for downloading the codeif a device programmer had to be used.

6.3 DEBUGGING THE EMBEDDED SOFTWARE

• Debugging is the process of eliminating the bugs/errors insoftware.

• The software written to run on embedded systems may containerrors and hence needs debugging.

• However, the difficulty in case of embedded systems is to findout the bug/ error itself. This is because the binary image youdownloaded on the target board was free of syntax errors but

Page 44: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

44

still if the embedded system does not function the way it wassupposed to be then it can be either because of a hardwareproblem or a software problem. Assuming that the hardware isperfect all that remains to check is the software.

• The difficult part here is that once the embedded system startsfunctioning there is no way for the user or programmer to knowthe internal state of the components on the target board.

• The most primitive method of debugging is using LEDs. This issimilar to using a printf or a cout statement in c/c++ programs totest if the control enters the loop or not. Similarly an LED blindor a pattern of LED blinks can be used to check if the controlenters a particular piece of code.

• There are other advanced debugging tools like;a. Remote debuggerb. Emulatorc. Simulator

6.3.1 Remote Debuggers Remote Debugger is a tool that can be commonly used for: Downloading Executing and Debugging embedded software

A Remote Debugger contains a hardware interface between thehost computer and the target embedded system.

HOST TARGET EMBEDDED SYSTEM

COMMUNICATION LINK

Figure: Remote Debugger

Page 45: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

45

The Software interface of the remote debugger has GUI-basedmain window and several smaller windows for the source code,register contents and other information about the executingprogram.

It contains two pieces of software : Frontend remote debugger

• It runs on the host computer.• It provides the human interface.

Backend remote debugger Backend remote debugger runs on the target processor. It communicates with the frontend over a

communications link of some sort. It provides for low-level control of the target processor

and is usually called the debug monitor.

Debug monitor is a piece of software that has beendesigned specifically for use as a debugging tool forprocessors and chips.

It is automatically started whenever the processor isreset.

It monitors the communication link to the host computerand responds to requests from the remote debuggerrunning there.

One such debugger is the GNU. It was originally designed for native debugger. It performs cross-debugging. Communication between the GDB frontend and debug

monitor is byte-oriented and designed for transmissionover a serial connection.

6.3.2 Emulators A Remote debugger is helpful for monitoring and controlling the

state of embedded software prior to downloading it only.

An Emulator allows you to examine the state of the processoron which that program is actually running. It is itself anembedded system, with its own copy of the target processor,RAM, ROM, and its own embedded software

An Emulator takes the place of-or emulates-the processor onthe target board.

Emulator uses a remote debugger for its human interface.

Emulator supports such powerful debugging features such ashardware breakpoints and real-time tracing. Hardwarebreakpoints allow you to stop execution in response to a wide

Page 46: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

46

variety of events. These events include instruction fetches,memory and I/O reads and writes and interrupts. Real Timetracing allows you to see the exact order in which eventsoccurred, so it can help you answer questions related to specificerrors.

ROM Emulator• It is a device that emulates a read only memory device like

ICE (in-circuit emulator).• It connects to the target embedded system and

communicates with the host.• When a target connection is via a ROM socket to embedded

system it looks like any other read only memory. But when itis to the remote debugger it looks like a debug monitor.

Advantages: There is no need to port the debug monitor code to particular

target hardware. The ROM emulator supplies its own serial or network

connection to the host The ROM emulator is a true replacement for the original

ROM, so none of the target’s memory is used up by thedebug monitor code

6.3.3 Simulators A simulator is a completely host-based program that

simulates the functionality and instructions set of the targetprocessor.

Advantage: A Simulator can be quite valuable in the earlierstage of a project when there has not yet been any actualhardware implementation for the programmers to experimentwith.

Disadvantage: One of the disadvantages of simulator is thatit only simulates the processors.

6.4 OTHER TOOLS

Logic Analyzers and Oscilloscopes are very important debuggingtools.

Logic Analyzers It is a piece of laboratory equipment that is designed

especially for troubleshooting digital hardware.

It can have multiple inputs (up to 100 even), each capable ofdetecting whether the electrical signal it is attached to iscurrently at logic level 1 or 0

Page 47: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

47

An oscilloscope is another pieces of laboratory equipment ofhardware debugging. But this one is used to examine anyelectrical signal, analog or digital, on any piece of hardware

Oscilloscopes An oscilloscope is another pieces of laboratory equipment of

hardware debugging. But this one is used to examine anyelectrical signal, analog or digital, on any piece of hardware

Oscilloscope are sometimes useful for quickly observing thevoltage on the particular pin or, in the absence of a logicanalyzer, for something ,more complex

6.5 REVIEW QUESTIONS

1. Explain the process of Downloading embedded softwarecode

2. Write short note on debugging the embedded softwarecode

3. Explain the working of Remote Debugger4. Explain the working of Emulator5. Explain the use of Simulators, Logic analyzers and

Oscilloscopes in debugging embedded systems.

6.6 REFERENCES & FURTHER READING

1. Programming Embedded systems in C++ by Michael Barr2. 2. Introduction to Embedded systems – Shibu K. V

Page 48: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

48

7

EMBEDDED HARDWARE FROMSOFTWARE PROGRAMMERS

PERSPECTIVE

Unit Structure28.0 Objectives28.1 Introduction28.2 Components on an embedded system28.3 Memory Map28.4 I/O Map28.5 Interrupt Map28.6 Review Questions28.7 References & Further Reading

7.0 OBJECTIVES

After reading this chapter you will be able to:• Understand in general the difference in programming software

for general purpose computers and embedded systems• The way in which processor communicates with components of

embedded system• Memory Map, I/O Map & Interrupt Map

7.1 INTRODUCTION

The software programmer must know the hardware involvedin an embedded system before he can even attempt to write codefor its functioning.

Programming for embedded systems is different thanprogramming on computers. Embedded systems have certain strictassumptions to be followed. Until the programmer does not knowwhat hardware components are involved and what are theassumptions and rules related to those components, the programor code cannot be written.

This chapter introduces the reader with the hardware ofembedded system from a software perspective. It is this where the

Page 49: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

49

reader shall understand where the code fits in an embeddedsystem.

7.2 COMPONENTS ON AN EMBEDDED SYSTEM

• Before the programmer can start to code anything, he has toinvest some time in understand the functioning of the embeddedsystem.

• He is expected to understand the following things:a. Functioning or purpose of the embedded systemb. Individual components involvedc. The way data flows through the components of an

embedded system.

• Consider an example of an embedded system intended tobe used as a printer-sharing device. This device is attached to aprinter and allows access to two computers through serial interfaceand one printer through a parallel interface.

• The diagram below describes the way the devices areconnected to each other. Data to be printed is accepted from eitherserial port, held in RAM until the printer is ready for more data, anddelivered to the printer via the parallel port. The software thatmakes all of this happen is stored in ROM.

• The working or execution of the code is brought about by theprocessor. The processor knows two types of components: memoryand peripherals.

• Memories are for data and code storage and retrieval. Ex.RAM & ROM

• Peripherals are specialized hardware devices that eithercoordinate interaction with the outside world (I/O) or perform aspecific hardware function. Ex. Serial Port

Page 50: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

50

Figure: Components involved in an printer sharing device

• Certain processors like intel communicate with thesememories and peripherals with two distinct address spaces.

• The first address space is called the memory space and isintended mainly for memory devices; the second is reservedexclusively for peripherals and is called the I/O space.

• When peripherals are located in I/O space they are calledI/O Mapped peripheral else when peripherals are located inmemory space they are called Memory Mapped peripherals ormemory mapped I/O.

• If given a choice, Memory mapped peripherals are betterbecause it has advantages for both the hardware and softwaredevelopers. It is attractive to the hardware developer because hemight be able to eliminate the I/O space, and some of itsassociated wires, altogether. It is attractive to the softwaredeveloper who is able to use pointers, data structures, and unionsto interact with the peripherals more easily and efficiently.

Page 51: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

51

7.3 MEMORY MAP

• A Memory Map is the processor's "address book." It showswhat these devices look like to the processor. The memorymap contains one entry for each of the memories andperipherals that are accessible from the processor's memoryspace.

• All processors store their programs and data in memory.

• These chips are located in the processor's memory space,and the processor communicates with them by way of twosets of electrical wires called the address bus and the databus. To read or write a particular location in memory, theprocessor first writes the desired address onto the addressbus. The data is then transferred over the data bus.

• A memory map is a table that shows the name and addressrange of each memory device and peripheral that is locatedin the memory space.

• Organize the table such that the lowest address is at thebottom and the highest address is at the top. Each time anew device is added, add it to the memory map, place it inits approximate location in memory and label the starting andending addresses, in hexadecimal. After inserting all of thedevices into the memory map, be sure to label any unusedmemory regions as such.

• The block diagram of the Printer sharing device shownabove contains three devices attached to the address anddata buses. These devices are the RAM and ROM and aSerial Controller.

• Let us assume that the RAM is located at the bottom ofmemory and extends upward for the first 128 KB of thememory space.

• The ROM is located at the top of memory and extendsdownward for 256 KB. But considering the ROM containstwo ROMs-an EPROM and a Flash memory device-each ofsize 128 KB.

• The third device, the Serial Controller, is a memory-mappedperipheral whose registers are accessible between theaddresses say 70000h and 72000h.

Page 52: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

52

• The diagram below shows the memory map for the printersharing device.

FFFFFhEPROM(128K)

E0000h

FLASHMEMORY

(128K) C0000h

UNUSED 72000h

SERIALCONTROLLER 7000h

UNUSED 20000h

RAM (128K) 00000h

• For every embedded system, a header file should be createdthat describes these important features and provides an abstractinterface to the hardware. It allows the programmer to refer to thevarious devices on the board by name, rather than by address.

• The part of the header file below describes the memory map

#define RAM_BASE (void *) 0x00000000#define SC_BASE (void *) 0x70000000#define SC_INTACK (void *) 0x70001000#define FLASH_BASE (void *) 0xC0000000#define EPROM_BASE (void *) 0xE0000000

7.4 I/O MAP

• The I/O map contains one entry for each of the peripheral.

• An I/O map has to be created if a separate I/O space is present.It is done by repeating the steps performed to create memorymap.

• To create an I/O map, simply create a table of peripheral namesand address ranges, organized in such a way that the lowestaddresses are at the bottom.

• The diagram below shows the I/O map for the printer sharingdevice

Page 53: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

53

FFFFhPeripheralControlBlock

FF00h

Unused FE00hParallel

Port FD00hDebugger

Port FC00h

Unused 0000h

• It includes three devices: the peripheral control block (PCB),parallel port, and debugger port. The PCB is a set of registerswithin the processor that are used to control the on-chipperipherals. The chips that control the parallel port and debuggerport reside outside of the processor. These ports are used tocommunicate with the printer and a host-based debugger,respectively.

• The part of the header file below describes the I/O map

#define SVIEW_BASE 0xFC00#define PIO_BASE 0xFD00#define PCB_BASE 0xFF00

7.5 INTERRUPT MAP

• There are two techniques which can be used by theprocessor to communicate with memories or peripheral devices.These are:

a. Polling: In this technique the processor polls the device(asks question) repeatedly at regular intervals to check if the devicehas completed the given task or has any new task to execute.

b. Interrupt:• An interrupt is a signal sent from a peripheral to theprocessor. A peripheral may send an interrupt signal to a processorwhen it has some job to perform which requires the processorsintervention.

Page 54: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

54

• Upon receiving an interrupt signal the Processor does thejob by issuing certain commands and waits for another interrupt tosignal the completion of the job.

• While the processor is waiting for the interrupt to arrive, it isfree to continue working on other things.

• When a fresh interrupt signal is received, the processortemporarily sets aside its current work and executes a small pieceof software called the interrupt service routine (ISR). When the ISRcompletes, the processor returns to the work that was interrupted.

• The programmer must write the ISR himself and enable it sothat it will be executed when the relevant interrupt occurs.

• Interrupt Map• Embedded systems usually have only a handful of interrupts.Associated with each of these are an interrupt pin which is presenton the outside of the processor chip and an ISR.

• In order for the processor to execute the correct ISR, amapping must exist between interrupt pins and ISRs. This mappingusually takes the form of an interrupt vector table.

• The vector table is usually just an array of pointers tofunctions, located at some known memory address. The processoruses the interrupt type (a unique number associated with eachinterrupt pin) as its index into this array. The value stored at thatlocation in the vector table is usually just the address of the ISR tobe executed.

• An Interrupt Map is a step taken in this process. TheInterrupt Map is a table that contains a list of interrupt types and thedevices to which they refer.

• The diagram below shows the Interrupt map for the printersharing device

Interrupt Type Generating Device8 Timer/Counter #0

17 Serial Controller18 Timer/Counter #119 Timer/Counter #220 Serial Port Receive21 Serial Port Transmit

Page 55: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

55

• Once the I/O map is created the header file should beappended with the following information:

#define SCC_INT 17 /*Serial Controller*/

#define TIMER0_INT 8 /* On-Chip Timer/Counters*/#define TIMER1_INT 18#define TIMER2_INT 19

#define RX_INT 20 /* On-Chip Serial Ports */#define TX_INT 21

7.6 REVIEW QUESTIONS

1. Explain the Components involved in a printer sharing device2. Explain Memory Map for a printer sharing device3. Explain I/O Map for a printer sharing device4. Explain interrupt Map for a printer sharing device

7.7 REFERENCES & FURTHER READING

1. Programming Embedded systems in C++ by Michael Barr2. Introduction to Embedded systems – Shibu K. V

Page 56: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

56

8EMBEDDED SYSTEMS: MEMORY

Unit Structure

36.0 Objectives36.1 Introduction36.2 Types of Memory36.3 Types of RAM

36.3.1 SRAM36.3.2 DRAM

36.4 Types of ROM36.4.1 MASKED36.4.2 PROM36.4.3 EPROM

36.5 Types of Hybrid Memory36.5.1 NVRAM36.5.2 FLASH36.5.3 EEPROM

36.6 DIRECT MEMORY ACCESS (DMA)36.7 Review Questions36.8 References & Further Reading

37.0 OBJECTIVES

After reading this chapter you will understand: Different types of memory available Types of RAM Types of ROM Types of Hybrid Memory

8.1 INTRODUCTION

There are different types of memories available to be used incomputers as well as embedded system.

This chapter guides the reader through the different types ofmemories that are available and can be used and tries to explaintheir differences in simple words.

Page 57: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

57

8.2 TYPES OF MEMORY

• There are three main types of memories, they are

a) RAM (Random Access Memory)• It is read write memory.• Data at any memory location can be read or written.• It is volatile memory, i.e. retains the contents as long as

electricity is supplied.• Data access to RAM is very fast

b) ROM (Read Only Memory)• It is read only memory.• Data at any memory location can be only read.• It is non-volatile memory, i.e. the contents are retained

even after electricity is switched off and available after itis switched on.

• Data access to ROM is slow compared to RAM

c) HYBRID• It is combination of RAM as well as ROM• It has certain features of RAM and some of ROM• Like RAM the contents to hybrid memory can be read

and written• Like ROM the contents of hybrid memory are non volatile

• The following figure gives a classification of different types ofmemory

DRAM SRAM NVRAM Flash EEPROM EPROM PROM Masked

M e m o ry

R A M H yb rid R O M

Figure: Types of Memory

Page 58: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

58

8.3 TYPES OF RAM

• There are 2 important memory device in the RAM family.a) SRAM (Static RAM)b) DRAM (Dynamic RAM)

8.3.1 SRAM (Static RAM)c) It retains the content as long as the power is applied to the

chip.d) If the power is turned off then its contents will be lost forever.

8.3.2 DRAM (Dynamic RAM)a) DRAM has extremely short Data lifetime(usually less than a

quarter of second). This is true even when power is appliedconstantly.

b) A DRAM controller is used to make DRAM behave more likeSRAM.

c) The DRAM controller periodically refreshes the data storedin the DRAM. By refreshing the data several times a second,the DRAM controller keeps the contents of memory alive fora long time.

8.4 TYPES OF ROM

There are three types of ROM described as follows:

8.4.1 Masked ROMa. These are hardwired memory devices found on system.b. It contains pre-programmed set of instruction and data

and it cannot be modified or appended in any way. (it isjust like an Audio CD that contains songs pre-written on itand does not allow to write any other data)

c. The main advantage of masked ROM is low cost ofproduction.

8.4.2 PROM (PROGRAMMABLE ROM )a) This memory device comes in an un-programmed state

i.e. at the time of purchased it is in an un-programmedstate and it allows the user to write his/her own programor code into this ROM.

b) In the un-programmed state the data is entirely made upof 1’s.

c) PROMs are also known as one-time-programmable(OTP) device because any data can be written on it onlyonce. If the data on the chip has some error and needs tobe modified this memory chip has to be discarded andthe modified data has to be written to another newPROM.

Page 59: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

59

8.4.3 EPROM (ERASABLE-AND-PROGRAMABLE ROM)a) It is same as PROM and is programmed in same manner

as a PROM.b) It can be erased and reprogrammed repeatedly as the

name suggests.c) The erase operation in case of an EPROM is performed by

exposing the chip to a source of ultraviolet light.d) The reprogramming ability makes EPROM as essential

part of software development and testing process.

8.5 TYPES OF HYBRID MEMORY

There are three types of Hybrid memory devices:

8.5.1 EEPROMsa. EEPROMs stand for Electrically Erasable and

Programmable ROM.b. It is same as EPROM, but the erase operation is

performed electrically.c. Any byte in EEPROM can be erased and rewritten as

desired

8.5.2 Flasha. Flash memory is the most recent advancement in

memory technology.b. Flash memory devices are high density, low cost,

nonvolatile, fast (to read, but not to write), and electricallyreprogrammable.

c. Flash is much more popular than EEPROM and is rapidlydisplacing many of the ROM devices.

d. Flash devices can be erased only one sector at a time,not byte by byte.

8.5.3 NVRAMa. NVRAM is usually just a SRAM with battery backup.b. When power is turned on, the NVRAM operates just like

any other SRAM but when power is off, the NVRAMdraws enough electrical power from the battery to retainits content.

c. NVRAM is fairly common in embedded systems.d. It is more expensive than SRAM.

8.6 DIRECT MEMORY ACCESS (DMA)

DMA is a technique for transferring blocks of data directlybetween two hardware devices.

Page 60: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

60

In the absence of DMA the processor must read the datafrom one device and write it to the other one byte or word ata time.

DMA Absence Disadvantage: If the amount of data to betransferred is large or frequency of transfer is high the rest ofthe software might never get a chance to run.

DMA Presence Advantage: The DMA Controller performsentire transfer with little help from the Processor.

Working of DMA The Processor provides the DMA Controller with

source and destination address & total number ofbytes of the block of data which needs transfer.

After copying each byte each address is incremented& remaining bytes are reduced by one.

When number of bytes reaches zeros the blocktransfer ends & DMA Controller sends an Interrupt toProcessor.

Figure: Direct Memory Access

Page 61: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

61

8.7 REVIEW QUESTIONS

1. What are the different types of Memory?2. What are the different types of RAM?3. What are the different types of ROM?4. What are the different types of Hybrid Memory?

8.8 REFERENCES & FURTHER READING

1. Programming Embedded systems in C++ by Michael Barr2. Introduction to Embedded systems – Shibu K. V

Page 62: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

62

9EMBEDDED SYSTEMS: MEMORY

TESTINGUnit Structure46.0 Objectives46.1 Introduction46.2 Memory Testing and its purpose46.3 Common Memory Problems46.4 A strategy for memory testing

46.4.1 Data Bus Test46.4.2 Address Bus Test46.4.3 Device Test

46.5 Review Questions46.6 References & Further Reading

9.0 OBJECTIVES

After reading this chapter you will be able to understand: What is memory testing? What are the common memory related problems? What are the different types of test to detect memory related

problems and a general idea about the working of these tests

9.1 INTRODUCTION

The previous chapter dealt with the different types ofmemory. This chapter will focus on the concept of testing memorydevices, its purpose and different methods available.

9.2 MEMORY TESTING AND ITS PURPOSE

• The purpose of a memory test is to confirm that eachstorage location in a memory device is working.

• Memory Testing is performed when prototype hardware isready and the designer needs to verify that address and datalines are correctly wired and memory chips are workingproperly.

• Basic idea implement in testing can be understood by thissimple task:

Page 63: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

63

Write some set of Data values to each Address inMemory and Read it back to verify.

Ex. If number ’50’ is stored at a particular Address it isexpected to be there unless rewritten or erased.

If all values are verified by reading back then Memorydevice passes the test.

• Only through careful selection of data values can make surepassing result to be meaningful.

• Difficulties involved in memory testing: It can be difficult to detect all memory problems with a

simple test. Many Embedded Systems include Memory Tests only

to detect catastrophic memory failures which might noteven notice memory chips removal.

9.3 COMMON MEMORY PROBLEMS

Memory Problems rarely occur with the chip itself, but due toa variety of post production tests to check quality thispossibility is ruled out.

Catastrophic Failure is a memory problem that occurs due tophysical and electrical damage, it is uncommon and easilydetectable.

A common source of memory problems is associated withthe circuit board. Typical circuit board problems are:1. Circuit board wiring between Processor & Memory

device.2. Missing Memory chip.3. Improperly inserted Memory chip.

1. Circuit board wiring between Processor & Memory device. These are usually caused by,

i. An error in designii. An error in production of the boardiii. Any damage after manufacture

Wires that connect the memory are:-i. Address line :- select the memory locationii. Data line :- transfer the dataiii. Control line :- read or write operation Two wiring problems are shown below

1. Connected to another wire on the board- May be caused by a bit of solder splash

2. Not connected to anything- Caused by broken trace

Page 64: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

64

Figure: a. wiring problems: two wires shorted b. wiring problems: one wire open

• When Address line has a wiring problemo memory locations overlapo i.e. memory device to see an address different from the one

selected by the processor.o Problem is with a data lineo several data bits “stuck together”o i.e. two or more bits always contains same value

• When the problem is with a Data lineo several data bits “stuck together”o i.e. two or more bits always contains same valueo When Control lines is shorted or open

• When Control lines is shorted or openo The operation of many control lines is specific to the

processor or memory architecture.o the memory will probably not work at all.

2. Missing Memory chip.o A missing memory chip is clearly a problem that should be

detectedo Unfortunately, because of the capacitive nature of

unconnected electrical wires, some memory tests will notdetect.

Page 65: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

65

o For e.g. suppose you decided to use the following testalgorithm write the value 1 to the first location in memory, verify the

value by reading it back write 2 to the second location, verify the value write 3 to the third location, verify, etc.

o Because each read occurs immediately after thecorresponding write, it is possible that the data read backrepresents nothing more than the voltage remaining on thedata bus from the previous write.

o If the data is read back too quickly, it will appear that the datahas been correctly stored in memory-even though there is nomemory chip at the other end of the bus!

o To detect a missing memory chip the previous algorithm fortest must be altered.

o For example, write the value 1 to the first location, 2 to the second location, And 3 to the third location,

o Then verify the data at the first location, the second location,etc. If the data values are unique (as they are in the test justdescribed), the missing chip will be detected

3. Improperly inserted Memory chip. Caused by pins on the memory chip

o Will either not be connected to the socket at allo Will be connected at the wrong place

Symptoms :-o System behaves same as though there is a wiring

problem or a missing chip.

How to detect :-o Detected by any test

9.4 A STRATEGY FOR MEMORY TESTING

• For memory testing the strategy adopted should be effectiveand efficient. Ideally there should be multiple small tests insteadof one large test.

• It would be best to have three individual memory tests:1. A data bus test: Checks electrical wiring problems

Page 66: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

66

2. An address bus test: Checks improperly inserted chips3. A device test: Checks to detect missing chips and

catastrophic failures and problems with the control buswiring

• These tests have to be executed in a proper order which is: databus test first, followed by the address bus test, and then thedevice test. That's because the address bus test assumes aworking data bus, and the device test results are meaninglessunless both the address and data buses are known to be good.

9.4.1 Data Bus Test• It is used to check data bus wiring.• In this test we need to confirm that the received data is same

as the data sent by processor

• Implementation: Here we write all possible data values and verify that the

memory device stores each one successfully. In short to test the bus one bit at a time.

• Walking 1's test This test is used to independently test every bit. A single data bit is set to 1 and “walked” through the

entire data word. If the data bus is working properly, the function will return

0. Otherwise it will return the data value for which the test

failed. Because we are testing only the data bus at this point, all

of the data values can be written to the same address.Any address within the memory device will do

0000000100000010000001000000100000010000001000000100000010000000

Figure: Consecutive data values for walking 1's test

Page 67: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

67

9.4.2 Address Bus Test• Address bus problems lead to overlapping memory locations.

• In the Address Bus test we need to confirm that each of theaddress pins can be set to 0 and 1 without affecting any of theothers.

• The smallest set of address that will cover all possiblecombinations is the set of “power of two” addresses.

• After writing one of the addresses, we must check none of theothers has been overwritten.

9.4.3 Device Test• It is used to test if the memory device is working properly. It is

necessary to test the integrity of the memory device itself.

• The thing to test is that every bit in the device is capable ofholding both 0 and 1.

• For a thorough and complete device test every memory locationhas to be visited twice.

• A simple test implemented is the Increment test as shown inthe table below The first column represents the memory location The second column represents the data that is written at the

memory location indicated in column 1 in incrementalfashion.

The third column represents the data of column 2 in invertedformat.

Figure: Data Bus Test – Increment Test

Page 68: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

68

• During the first pass the data in column 1 is verified and duringsecond pass the data in column 2 is verified.

9.5 REVIEW QUESTIONS

1. What is Memory Testing? Why is it required?2. What are common memory problems in embedded system?3. Describe a test strategy for performing memory testing on

embedded system. Is there a specific order to perform thesetests? if yes, why?

4. Describe the different types of memory testing techniquesavailable.

9.6 REFERENCES & FURTHER READING

1. Programming Embedded systems in C++ by Michael Barr2. Introduction to Embedded systems – Shibu K. V

Page 69: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

69

10EMBEDDED SYSTEMS: PERIPHERALS

Chapter Structure56.0 Objectives56.1 Introduction56.2 Testing Non Volatile Memory Devices56.3 Control and Status Registers56.4 Device Driver56.5 Watchdog timer56.6 Review Questions56.7 References & Further Reading

10.0 OBJECTIVES

After reading this chapter you will learn: Concept of testing non –volatile memory devices using

Checksum and CRC Control and Status Registers Device Driver Watch Dog Timer

10.1 INTRODUCTION

This chapter initially continues the part of memory testingfrom last chapter. Here testing of Non Volatile memory devices isstudied.

Then we study how peripheral devices are incorporated inEmbedded System. Control and Status Registers, Device Driversand Watch Dog Timers are explained in the subsequent sections.

10.2 TESTING NON VOLATILE (ROM AND HYBRID)MEMORY DEVICES

• The testing techniques described previously cannot help totest ROM and hybrid devices since ROM devices cannot bewritten at all, and hybrid devices usually contain data orprograms that cannot be overwritten.

Page 70: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

70

• However ROM or hybrid memory device face the sameproblems as missing memory chip, improperly insertedmemory chip, damaged memory chip or wiring problem withthe memory chip.

• Two Techniques Checksums and CRC can be used to testnon volatile memory devices.

• Checksum Checksums basically deals with the question whether the

data stored in a memory device is valid or not? To do this the checksum of the data in the memory

device is computed and stored along with the data. Themoment when we have to confirm the validity of the data,we just have to recalculate the checksum and compare itwith previous checksum. If the two checksums match, thedata is assumed to be valid.

The simplest checksum algorithm is to add up all the databytes discarding carries.

A Checksum is usually stored at some fixed location inmemory. This makes it easy to compute and store thecheck sum for the very first time and later on to comparethe recomputed checksum with the original one.

Disadvantage: A simple sum-of-data checksum cannotdetect many of the most common data errors.

• CRC – Cyclic Redundancy Check

A Cyclic Redundancy Check is a specific checksumalgorithm designed to detect the most common dataerrors.

CRC’s are frequently used in Embedded Applicationsthat requires the storage or transmission of large blocksof data.

The CRC works as follows: The message is composed of a long string of 0’s

and 1’s A division operation occurs between the message

at numerator and the generator polynomial atdenominator. The generator polynomial is a fixedsmaller length binary string.

The remainder of the division operation is the CRCChecksum

Page 71: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

71

10.3 CONTROL AND STATUS REGISTERS

Control and status registers are the basic interface betweenand embedded processor and peripheral device.

These registers are a part of peripheral hardware and theirlocation size and individual meanings are feature of theperipheral.

For example, The registers vary from device to device:example the registers within a serial controller are verydifferent from those in a timer.

Depending upon the design of the processor and targetboard , peripheral devices are located either in theprocessor’s memory space or within the I/O space.

It is common for Embedded Systems to include someperipherals of each type. These are called Memory-Mappedand I/O-mapped peripherals.

Of the two types, memory-mapped peripherals are generallyeasier to work with and are increasingly popular.

Memory-mapped control and status registers can be usedjust like ordinary variables.

10.4 DEVICE DRIVER

The goal of designing a device driver is to hide the hardwarecompletely.

Attempts to hide the hardware completely are difficult. For example all Flash memory devices share the concept of

sectors. An erase operation can be performed only on an entiresector. Once erased individual bites or words can be rewritten.

Device drivers for embedded systems are quite different fromthe workstation counter parts. In modern computers workstationdevice drivers are most often concerned with satisfying therequirement of the operating system.

There are three benefits of good device driver:

i. Modularization, it makes the structure of the overall softwareis easier to understand.

ii. There exists only one module that interacts directly with theperipheral’s registers making communication easier.

iii. Software changes that result from hardware changes arelocalized to the device driver.

Page 72: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

72

Components of a Device DriverA device driver can be implemented (as components) in the

following steps:1. A data structure that overlays the memory-mapped

control and status registers of the device: This basic step involves creating a C style structure that

is actually a map of the registers present in the device.These registers can be found out by referring to the datasheet for the device.

A table is created which maps the control register to theirrelative offsets.

An example is shown below for a timer counter datastructure.

struct TimerCounter{

unsigned short count; // Current Count, offset 0x00unsigned short maxCountA;// Maximum Count, offset 0x02unsigned short _reserved; // Unused Space, offset 0x04unsigned short control; // Control Bits, offset 0x06

};

To make the bits within the control register easier to readand write individually, we define the following bitmasks:

#define TIMER_ENABLE 0xC000 // Enable thetimer.#define TIMER_DISABLE 0x4000 // Disablethe timer.#define TIMER_INTERRUPT 0x2000 // Enabletimer interrupts.#define TIMER_MAXCOUNT 0x0020 // Timercomplete?#define TIMER_PERIODIC 0x0001 // Periodictimer?

2. A set of variables to track the current state of thehardware and device driver: It involves listing out therequired variables needed to keep track of the state of thehardware and device driver

3. Initialize the hardware: Once the variables to be used areknown the next step in device driver programming is toinitialize the hardware. Next functions can be written tocontrol the device.

4. A set of routines that provide an API for users of thedevice driverThis involves writing different functions that will implementthe various tasks listed to be performed by the device.

Page 73: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

73

5. Interrupt service routinesOnce the required functions and routines are coded the thingremaining to be done is to identify and write routines forservicing the interrupts.

10.5 WATCHDOG TIMER

It is hardware equipment. It is special purpose hardware that protects the system from

software hangs. Watchdog timer always counts down from some large

number to zero This process takes a few seconds to reset, in the meantime,

it is possible for embedded software to “kick” the watchdogtimer, to reset its counter to the original large number.

If the timer expires i.e. counter reaches zero, the watchdogtimer will assume that the system has entered a state ofsoftware hang, then resets the embedded processor andrestarts the software

It is a common way to recover from unexpected softwarehangs

The figure below diagrammatically represents the working ofthe watchdog timer

Figure: Watchdog Timer

Page 74: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

74

10.6 REVIEW QUESTIONS

1. Explain testing for non-volatile memory devices2. Write short note on Control and status registers3. What is a device driver?4. What are the components of a device driver?5. Write short note on Watch Dog Timer

10.7 REFERENCES & FURTHER READING

1. Programming Embedded systems in C++ by Michael Barr2. Introduction to Embedded systems – Shibu K. V

Page 75: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

75

11EMBEDDED OPERATING SYSTEM

Chapter Structure67.0 Objectives67.1 Introduction67.2 Basics

67.2.1 Tasks67.2.2 Task States

67.3 Scheduler67.3.1 Scheduling Points67.3.2 Ready List67.3.3 Idle task

67.4 Context Switch67.5 Task Synchronization67.6 Real Time Characteristic67.7 Selection Process67.8 Review Questions67.9 References & Further Reading

11.0 OBJECTIVES

After reading this chapter you will learn: The basics of embedded Operating system with respect to

1. Tasks2. Task States

Scheduler with respect to:1. Scheduling Points2. Ready List3. Idle task

Concept of Context Switch and Task Synchronization Real Time Characteristic of embedded operating system.

11.1 INTRODUCTION

This chapter introduces the readers to the embeddedoperating system. Any operating system has a set of programswhich are implemented through a set of tasks.

Every embedded system may not require an operatingsystem. The requirement and complexity on an operating systemdepends on the functionality to be implemented by the embeddedsystem.

Page 76: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

76

11.2 BASICS

11.2.1 Tasks Task is a piece of code or program that is separate from

another task and can be executed independently of the othertasks.

In embedded systems, the operating system has to deal witha limited number of tasks depending on the functionality tobe implemented in the embedded system.

Multiple tasks are not executed at the same time insteadthey are executed in pseudo parallel i.e. the tasks execute inturns as the use the processor.

From a multitasking point of view, executing multiple tasks islike a single book being read by multiple people, at a timeonly one person can read it and then take turns to read it.Different bookmarks may be used to help a reader identifywhere to resume reading next time.

An Operating System decides which task to execute in casethere are multiple tasks to be executed. The operatingsystem maintains information about every task andinformation about the state of each task.

The information about a task is recorded in a data structurecalled the task context. When a task is executing, it usesthe processor and the registers available for all sorts ofprocessing. When a task leaves the processor for anothertask to execute before it has finished its own, it shouldresume at a later time from where it stopped and not fromthe first instruction. This requires the information about thetask with respect to the registers of the processor to bestored somewhere. This information is recorded in the taskcontext.

A C++ version of a Task that holds all information needed byoperating system is as follows:

class Task{

public:Task(void (*function)(), Priority p, intstackSize);

TaskId id;Context context;TaskState state;Priority priority;

Page 77: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

77

int * pStack;Task * pNext;

void (*entryPoint)();

private:static TaskId nextId;

};11.2.2 Task States

In an operation system there are always multiple tasks.At a time only one task can be executed. This means thatthere are other tasks which are waiting their turn to beexecuted.

Depending upon execution or not a task may beclassified into the following three states:

Running state - Only one task can actually be usingthe processor at a given time that task is said to bethe “running” task and its state is “running state”. Noother task can be in that same state at the same time

Ready state - Tasks that are are not currently usingthe processor but are ready to run are in the “ready”state. There may be a queue of tasks in the readystate.

Waiting state - Tasks that are neither in running norready state but that are waiting for some eventexternal to themselves to occur before the can go forexecution on are in the “waiting” state.

Figure: Task States

A transition of state between the ready and running stateoccurs whenever the operating system selects a newtask to run.

The task that was previously in running state becomesready and the new task is promoted to running state.

Page 78: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

78

A task will leave running state only if it needs to wait forsome event external to itself to occur before continuing.

A task's state can be defined as follows:enum TaskState { Ready, Running, Waiting };

11.3 SCHEDULER

• The heart and soul of any operating system is its scheduler.• This is the piece of the operating system that decides which

of the ready tasks has the right to use the processor at agiven time.

• It simple checks to see if the running task is the highestpriority ready task.

• Some of the more common scheduling algorithms:

1. First-in-first-out First-in-first-out (FIFO) scheduling describes an operating

system which is not a multitasking operating system.

Each task runs until it is finished, and only after that is thenext task started on a first come first served basis.

2. Shortest job first Shortest job first scheduling uses algorithms that will select

always select a task that will require the least amount ofprocessor time to complete.

3. Round robin. Round robin scheduling uses algorithms that allow every

task to execute for a fixed amount to time.

A running task is interrupted an put to a waiting state if itsexecution time expires.

11.3.1 Scheduling Points The scheduling points are the set of operating system events

that result in an invocation of the scheduler.

There are three such events: task creation and taskdeletion. During each of these events a method is called toselect the next task to be run.

A third scheduling point called the clock tick is a periodicevent that is triggered by a timer interrupt. When a timerexpires, all of the tasks that are waiting for it to complete arechanged from the waiting state to the ready state.

Page 79: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

79

11.3.2 Ready List The scheduler uses a data structure called the ready list to

track the tasks that are in the ready state.

The ready list is implemented as an ordinary linked list,ordered by priority.

So the head of this list is always the highest priority task thatis ready to run.

11.3.3 Idle task If there are no tasks in the ready state when the scheduler is

called, the idle task will be executed.

The idle task looks the same in every operating system.

The idle task is always considered to be in the ready state.

11.4 CONTEXT SWITCH

The actual process of changing from one task to another iscalled Context Switch.

Since contexts are processor-specific, so is the code thatimplements the context switches, hence, it must always bewritten in assembly language.

11.5 TASK SYNCHRONIZATION

All the tasks in the multitasking operating systems worktogether to solve a larger problem and to synchronize theiractivities, they occasionally communicate with one another.

For example, in the printer sharing device the printer taskdoesn’t have any work to do until new data is supplied to itby one of the computer tasks.

So the printer and the computer tasks must communicatewith one another to coordinate their access to common databuffers.

One way to do this is to use a data structure called amutex.

Mutexes are mechanisms provided by many operatingsystems to assist with task synchronization.

Page 80: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

80

A mutex is a multitasking-aware binary flag. It is becausethe processes of setting and clearing the binary flag areatomic (i.e. these operations cannot be interrupted).

When this binary flag is set, the shared data buffer isassumed to be in use by one of the tasks. All other tasksmust wait until that flag is cleared before reading or writingany of the data within that buffer.

The atomicity of the mutex set and clear operations isenforced by the operating system, which disables interruptsbefore reading or modifying the state of the binary flag.

11.6 REAL TIME CHARACTERISTIC

An Operating system is called “Real-Time Operating System”(RTOS) only if it has following characteristics:

i. Deterministic An OS is said to be deterministic if the worst case

execution time of each of the system calls is calculable.

The data sheet of an OS should publish the real-timebehavior of its RTOS provides average, minimum andmaximum number of clock cycles required by eachsystem call.

ii. Interrupt Latency Interrupt Latency is the total length of time from an

interrupt signal’s arrival at the processor to the start ofthe associated interrupt service routine.

iii.Context Switch Context Switch is important because it represents

overhead across your entire system.

11.7 SELECTION PROCESS

The process of selecting the best commercial operating systemthat best fits the needs of one’s project depends on various factors.

Commercial operating systems form a continuum offunctionality, performance and price.

Operating Systems that offer only a basic scheduler anda few other system calls are inexpensive and come withthe source code that one can modify and do not requirepayment of royalties.

Page 81: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

81

While on the other hand operating systems that include alot of useful functionality beyond just the scheduler arequite expensive and royalties due on every copy shippedin ROM and they might also make a stronger guaranteesabout real-time performance.

Two important points to be considered while selecting anoperating system :-

Put your processor, real time performance andbudgetary requirements first.

Contact all of the vendors of the remaining operatingsystems for more detailed technical information.

11.8 REVIEW QUESTIONS

1. Explain the embedded Operating system with respect toi) Tasksii) Task States

2. Explain Scheduler with respect to:i) Scheduling Pointsii) Ready Listiii) Idle task

3. Write a short note on Context Switch and Task Synchronization4. Explain the Real Time Characteristic of embedded operating

system.

11.9 REFERENCES & FURTHER READING

1. Programming Embedded systems in C++ by Michael Barr2. Introduction to Embedded systems – Shibu K. V

Page 82: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

82

12EMBEDDED SYSTEMS: INTEGRATED

DEVELOPMENT ENVIRONMENT

Chapter Structure79.0 Objectives79.1 Introduction79.2 Embedded IDE79.3 Types of file generated on cross compilation79.4 DISASSEMBLER/ DECOMIPILER79.5 SIMULATOR79.6 FirmWare Debugging79.7 Review Questions79.8 References & Further Reading

12.0 OBJECTIVES

After reading this chapter you will understand: Embedded IDE Types of file involved Disassembler/ Decomipiler Simulator Firmware Debugging and Emulator

12.1 INTRODUCTION

This chapter explains the IDE used for embedded systems. It thenexplains the different types of files that are generated on crosscompilation. Then it gives an account of utility tools like Disassembler/Decomipiler, Simulator and then FirmWare Debugging.

12.2 EMBEDDED IDE

• Integrated Development Environment with respect toembedded system IDE stands for an Integrated Environmentfor developing and debugging the target processor specificembedded software.

• IDE is a software package which contains:1. Text Editor(Source Code Editor)

Page 83: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

83

2. Cross Compiler(For Cross platform development andcomplier for the same platform development)

3. Linker and debugger.• Some IDEs may provide an interface to an emulator or

device programmer.• IDEs are used in embedded firmware development. IDEs may be of two types:

1. Command Line Base• Turbo C++ IDE is an example for a generic IDE with a

Command Line Interface.2. GUI Base• Microsoft Visual Studio is an example of GUI base IDE.• Others examples are NetBeans, Eclipse.

12.3 TYPES OF FILE GENERATED ON CROSSCOMPILATION

Following are some of the files generated upon cross compilation:1. List file .lst2. Hex file .hex3. Preprocessor output file4. Map file .map5. Obj file .obj

1. List File(.lst):-• Listing file is generated during the cross-compilation

process.• It contains an information about the cross compilation

process like cross compiler details, formatted sourcetext(‘C’ code), assembly code generated from the sourcefile, symbol tables, errors and warnings detected duringthe cross-compilation process.

• The list file contain the following sections:

1. Page Header• It indicates the compiler version name, source file name,

Date, Page No.• Example: C51 COMPILER V8.02 SAMPLE 05/23/2006

11:12:58 PAGE 1

2.Command Line• It represents the entire command line that was used for

invoking the compiler.• C51 COMPILER V8.02, COMPILATION OF MODULE

SAMPLE OBJECT MODULE PLACED IN sample.obj

Page 84: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

84

• COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXEsample.c BROWSE DEBUG OBJECTTEXTEND CODELISTINCLUDE SYMBOLS

3.Source Code• It contains source code along with line numbers• Line level Source

1 //Sample.c for printing Hello World!2 //Written by xyz3 #include<stdio.h>1 //Body part starts23456 //Body part end4 void main()5 {6 printf(“Hello World”);7 }8 //Header part ends

4. Assembly listing• It contains the asembly code generated by

compiler for even given ‘C’ code.• ASSEMBLY LISTING OF GENERATED OBJECT

CODE;• FUNCTION main(BEGIN)

;SOURCE LINE #5;SOURCE LINE #6

0000 7BFF MOV R3,#0FFH0002 7A00 R MOV

R2,#HIGH?SC_0

5. Symbol listing• It contains symbolic information about the various

symbols present in the cross compiled source file.• Eg: NAME, TYPE, SFR, SIZE.•

6. Module Information• The module information provides the size of

initialized and un-initialized memory areas definedby the source file.

Module Information Static OverlayableCode Size 9 -------------Constant size 14 -------------Bit size ------- -------------END OF MODULE INFORMATION

Page 85: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

85

7. Warnings and Errors• Warnings and Errors section of list file records the errors

encountered or any statement that may create issues inapplication(Warnings), during cross compilation.

• ie:- C51 COMPILATION COMPLETE, 0WARNING(S), 0ERROR(S).

2. Preprocessor Output File• It contains preprocessor output for preprocessor instructions

used in the source file.

• This file is used for verifying the operation of Macros andpreprocessor directive.

3. Object File(.OBJ File)• Cross-compiling each source module converts the

Embedded C/Assembly instructions and other directivespresent in the module to an object(.OBJ file)

4. Map File(.MAP)• Also called as Linker List file. Map file contains information

about the link/locate process and is composed of a numberof sections described below:

I. Page HeaderEach MAP file contains a header which indicates thelinker version number, date, time and page number.

II. Command LineRepresents the entire command line that was used forinvoking the linker.

III. CPU DetailsIt contains details about the target CPU and itsmemory model which includes information on internaldata memory, external data memory, paged datamemory, etc.

IV. Input ModulesIt includes the names of all the object files, library filesand other files that are included in the linking process.

V. Memory MapIt lists the starting address, length, relocation type andname of each segment in the program

Page 86: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

86

VI. Symbol TableIt contains the name, value and type for all symbolsfrom different input modules.

VII. Inter Module Cross ReferenceIt includes the section name, memory type andmodule names in which it is defined and all moduleswhere it is accessed.Ex.NAME…………………….USAGE……………………..MODULE NAMES?CCCASE…………………CODE;……………………?C?CCASE PRINTF?C?CLDOPTR……………CODE;…………….…..?C?CLDOPTR PRINTF?C?CSTPTR………………CODE;………………….?C?CSTPTR PRINTF

VIII. Program SizeIt contains the size of various memory areas,constants and code space for the entire applicationEx. Program Size: data=80.1 xdata=0 code 2000

IX. Warnings and ErrorsIt contains the warnings and errors that are generatedwhile linking a program. It is used in debugging linkerrors

5. HEX FILE (.hex file)1. It is a binary executable file created from the source code.2. The file created by linker/locater is converted into processor

understandable binary code.3. The tool used for converting and object file into a hex file is

known as object to Hex converter.4. Hex file have specific format and it varies for different

processor and controller. Two commonly used hex fileformat are:

A. Intel HexB. Motorola Hex.

5. Both Intel and Motorola hex file format represent data in theform of ASCII codes.

Page 87: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

87

12.4 DISASSEMBLER/ DECOMIPILER

• A Disassembler/ Decomipiler is a reverse engineering tool.• Reverse Engineering is used in embedded system to find out

the secret behind the working of a proprietary product.• A DISASSEMBLER is a utility program which converts

machine codes into target processor specific assemblycode/instruction.

• The process of converting machine codes to assembly codeis called disassembling.

• A DECOMIPILER is a utility program for translating machinecodes into corresponding high level language instruction.

• A decompiler performs the reverse operation of acompiler/cross-compiler.

12.5 SIMULATOR

• Simulators are used for embedded firmware debugging.• Simulator simulates the target hardware, while the code

execution can be inspected.• Simulators have the following characteristics which make

them very much favorable: Purely software based No need of target system (hardware) Support only for basic operations Cannot Support or lack real time behavior

• Advantages1. Simple and straight forward.• Simulators are a software utility with assumptions about the

underlying hardware. So it only requires concentrating ondebugging of the code, hence straight forward.

2. No Hardware• Simulators are purely software oriented.• The IDE simulates the target CPU. The user needs to know

only about the target specific details like memory map ofvarious devices.

• Since no hardware is required the code can be written andtested even before the hardware prototype is ready thussaving development time

3. Simulation options• Simulators provide various simulation options like I/O

peripherals or CRO or Logic analyzers.

Page 88: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

88

• Simulators I/O support can be used to edit values for I/Oregisters.

4. Simulation of abnormal conditions• Using simulator the code can be tested for any desired

value.• This helps to study the code behavior in abnormal conditions

without actually testing it on the hardware.

• Disadvantages1. Lack of real time behavior

• A simulator assumes the ideal condition for codeexecution.

• Hence the developer may not be able to debug the codeunder all possible combinations of input.

• The results obtained in simulation may deviate fromactual results on target hardware.

2. Lack of real timeliness• The I/O condition in hardware is unpredictable. So the

output of simulation is usually under ideal condition andhence lacks timeliness.

12.6 FIRMWARE DEBUGGING

• Debugging in embedded application is the process ofdiagnosing the firmware execution, monitoring the targetprocessor’s registers and memory while the firmware isrunning and checking the signals on various buses ofhardware.

• Debugging is classified into Hardware Debugging andFirmware Debugging.

• Hardware Debugging deals with debugging the variousaspects of hardware involved in the embedded system.

• The various tools used for hard ware debugging areMultimeter, CRO, Logic Analyzers and Function Generators.

• Firmware Debugging involves inspecting the code, itsexecution flow, changes to different registers on codeexecution.

• It is done to find out the bugs or errors in code whichproduces unexpected behavior in the system.

• There is a wide variety of firmware debugging techniquesavailable that have advanced from basic to advanced.

• Some to the tools used are Simulators and Emulators.

Page 89: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

89

• Emulators• The terms simulators and emulators are very confusing

but their basic functionality is the same i.e. to debug thecode. There is a difference in which this is achieved byboth the tools.

• A simulator is a utility program that duplicates the targetCPU and simulates the features and instructionssupported by target CPU whereas an Emulator is a selfcontained hardware device which emulates the targetCPU.

• The Emulator hardware contains the necessaryemulation logic and is connected to the debuggingapplication that runs on the host PC.

• The Simulator ‘simulates’ while the Emulator ‘emulates’

12.7 REVIEW QUESTIONS

1. Write a Short note on Embedded IDE2. What is Cross- Compilation? List the files that are generated

upon cross compilation3. Explain the contents of .MAP file.4. Explain the contents of .LST file.5. Write short notes on :

I. .OBJ FileII. .HEX File

III. Preprocessor Output File

12.8 REFERENCES & FURTHER READING

Introduction to Embedded systems – Shibu K. V

Page 90: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

90

13EMBEDDED DEVELOPMENT LIFE CYCLE

Chapter Structure13.0 Objectives13.1 Introduction13.2 EDLC

13.2.1 Need For ELDC13.2.2 Objectives

13.3 Different Phases of EDLC13.4 ELDC Approaches13.5 Review Questions13.6 References & Further Reading

13.0 OBJECTIVES

After Reading this chapter you will understand The Embedded Development Life Cycle Phases Involved in the EDLC

13.1 INTRODUCTION

Just like the SDLC used in Software Development, there isEDLC used in Embedded product development. This chapterexplains what is the EDLC, its objectives, the phases that areinvolved in the EDLC.

13.2 EMBEDDED PRODUCT DEVELOPMENT LIFECYCLE (EDLC)

EDLC is Embedded Product Development Life Cycle It is an Analysis – Design – Implementation based problem

solving approach for embedded systems development. There are three phases to Product development:

Page 91: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

91

Analysis involves understanding what product needs to bedeveloped

Design involves what approach to be used to build theproduct

Implementation is developing the product by realizing thedesign.

13.2.1 Need for EDLC EDLC is essential for understanding the scope and

complexity of the work involved in embedded systemsdevelopment

It can be used in any developing any embedded product EDLC defines the interaction and activities among various

groups of a product development phase. Example:-project management, system design

13.2.2 Objectives of EDLC The ultimate aim of any embedded product in a commercial

production setup is to produce Marginal benefit Marginal is usually expressed in terms of Return On

Investment The investment for product development includes initial

investment, manpower, infrastructure investment etc. EDLC has three primary objectives are:

i. Ensure that high quality products are delivered touser Quality in any product development is Return On

Investment achieved by the product The expenses incurred for developing the product the

product are:-

Page 92: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

92

• Initial investment• Developer recruiting• Training• Infrastructure requirement related

ii. Risk minimization defect prevention in productdevelopment through project management In which required for product development ‘loose’ or

‘tight’ project management ‘project management is essential for ’ predictability

co-ordination and risk minimization Resource allocation is critical and it is having a direct

impact on investment Example:- Microsoft @ Project Tool

iii. Maximize the productivity Productivity is a measure of efficiency as well as

Return On Investment This productivity measurement is based on total

manpower efficiency Productivity in which when product is increased then

investment is fall down Saving manpower

13.3 DIFFERENT PHASES OF EDLC

The following figure depicts the different phases in EDLC:

Figure : Phases of EDLC

Page 93: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

93

1. Need• The need may come from an individual or from the public or

from a company.• ‘Need’ should be articulated to initiate the Development Life

Cycle; a ‘Concept Proposal’ is prepared which is reviewedby the senior management for approval.

• Need can be visualized in any one of the following threeneeds:

1. New or Custom Product Development.2. Product Re-engineering.3. Product Maintenance.

2. Conceptualization• Defines the scope of concept, performs cost benefit analysis

and feasibility study and prepare project management andrisk management plans.

• The following activities performed during this phase:1. Feasibility Study : Examine the need and suggest

possible solutions.2. Cost Benefit Analysis (CBA): Revealing and assessing

the total development cost and profit expected from theproduct.

3. Product Scope: Deals with the activities involved in theproduct to be made.

4. Planning Activities: Requires various plans to bedeveloped first before development like ResourcePlanning & Risk management Plans.

3. Analysis• The product is defined in detail with respect to the inputs,

processes, outputs, and interfaces at a functional level.

• The various activities performed during this phase..• Analysis and Documentations: This activity

consolidates the business needs of the product underdevelopment.

• Requirements that need to be addressed.. Functional Capabilities like performance Operational and non-operational quality attribute Product external interface requirements Data requirements User manuals Operational requirements Maintenance requirements General assumptions

Page 94: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

94

• Defining Test Plan and Procedures: The various typeof testing performed in a product development are: Unit testing – Testing Individual modules Integration testing – Testing a group of modules for

required functionality System testing- Testing functional aspects or

functional requirements of the product afterintegration

User acceptance testing- Testing the product tomeet the end user requirements.

4. Design• The design phase identifies application environment and

creates an overall architecture for the product.• It starts with the Preliminary Design. It establishes the top

level architecture for the product. On completion it resemblesa ‘black box’ that defines only the inputs and outputs. Thefinal product is called Preliminary Design Document (PDD).

• Once the PDD is accepted by the End User the next task isto create the ‘Detailed Design’.

• It encompasses the Operations manual design, MaintenanceManual Design and Product Training material Design and istogether called the ‘Detailed Design Document’.

5. Development and Testing• Development phase transforms the design into a realizable

product.• The detailed specification generated during the design

phase is translated into hardware and firmware.

Page 95: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

95

• The Testing phase can be divided into independent testingof firmware and hardware that is: Unit testing Integration testing System testing User acceptance testing

6. Deployment• Deployment is the process of launching the first fully

functional model of the product in the market.• It is also known as First Customer Shipping (FCS).• Tasks performed during this phase are:

• Notification of Product Deployment: Tasks performedhere include: Deployment schedule Brief description about the product Targeted end user Extra features supported Product support information

• Execution of training planProper training should be given to the end user topget them acquainted with the new product.

• Product installationInstall the product as per the installation document toensure that it is fully functional.

• Product post Implementation ReviewAfter the product launch, a post implementationreview is done to test the success of the product.

7. Support• The support phase deals with the operational and

maintenance of the product in the production environment.• Bugs in the product may be observed and reported.• The support phase ensures that the product meets the user

needs and it continues functioning in the productionenvironment.

• Activities involved under support are Setting up of a dedicated support wing: Involves

providing 24 x 7 supports for the product after it islaunched.

Page 96: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

96

Identify Bugs and Areas of Improvement: Identifybugs and take measures to eliminate them.

8. Upgrades• Deals with the development of upgrades (new versions) for

the product which is already present in the market.• Product upgrade results as an output of major bug fixes.• During the upgrade phase the system is subject to design

modification to fix the major bugs reported.

9. Retirement/Disposal• The retirement/disposal of the product is a gradual process.• This phase is the final phase in a product development life

cycle where the product is declared as discontinued from themarket.

• The disposal of a product is essential due to the followingreasons Rapid technology advancement Increased user needs

13.4 ELDC APPROACHES

Following are some of the different types of approaches that can beused to model embedded products.

1. Waterfall or Linear Model2. Iterative/ Incremental or Fountain Model3. Prototyping Model4. Spiral Model

13.5 REVIEW QUESTIONS

1. What is EDLC? Why is it needed? What are its objectives?2. Draw an neat labeled diagram of the phases of the EDLC

and explain any two phases in detail.

13.6 REFERENCES & FURTHER READING

Introduction to Embedded systems – Shibu K. V

Page 97: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

97

14

EDLC MODELS

Chapter Structure107.0 Objectives107.1 Introduction107.2 Waterfall or Linear Model107.3 Iterative/ Incremental or Fountain Model107.4 Prototyping Model107.5 Spiral Model107.6 Review Questions107.7 References & Further Reading

14.0 OBJECTIVES

After reading this chapter you will understand: Some EDLC Models like: Waterfall or Linear Model Iterative/ Incremental or Fountain Model Prototyping Model Spiral Model

14.1 INTRODUCTION

The previous chapters introduced the readers to what ismeant by EDLC. This chapter is meant to explain the variousmodels available under the EDLC.

14.2 WATERFALL MODEL

Linear or waterfall model is the one adopted in most of theolden systems.

In this approach each phase of EDLC (EmbeddedDevelopment Product Lifecycle) is executed in sequence.

It establishes analysis and design with highly structureddevelopment phases.

The execution flow is unidirectional.

Page 98: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

98

The output of one phase serves as the input of the nextphase

All activities involved in each phase are well planned so thatwhat should be done in the next phase and how it can bedone.

The feedback of each phase is available only after they areexecuted.

It implements extensive review systems To ensure theprocess flow is going in the right direction.

One significant feature of this model is that even if youidentify bugs in the current design the development processproceeds with the design.

The fixes for the bug are postponed till the support phase. Advantages

• Product development is rich in terms of: Documentation Easy project management Good control over cost & Schedule

Drawbacks

• It assumes all the analysis can be done without doingany design or implementation

• The risk analysis is performed only once.

• The working product is available only at the end of thedevelopment phase

Bug fixes and correction are performed only at themaintenance/support phase of the life cycle.

Page 99: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

99

Figure: Waterfall Model

14.3 ITERATIVE/ INCREMENTAL OR FOUNTAINMODEL

• Iterative and Incremental development is at the heart of a cyclicsoftware development process developed in response to theweaknesses of the waterfall model.

• The iterative model is the repetitive process in which theWaterfall model is repeated over and over to correct theambiguities observed in each iteration.

Figure: Iterative model

Page 100: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

100

• The above figure illustrates the repetitive nature of the Iterativemodel.

• The core set of functions for each group is identified in the firstcycle, it is then built, deployed and release. This release iscalled as the first release.

• Bug fixes and modification for first cycle carried out in secondcycle.

• Process is repeated until all functionalities are implementedmeeting the requirements.

• Advantages• Good development cycle feedback at each function/feature

implementation• Data can be used as reference for similar product

development in future.• More responsive to changing user needs.• Provides working product model with at least minimum

features at the first cycle.• Minimized Risk• Project management and testing is much simpler compared

to linear model.• Product development can be stopped at any stage with a

bare minimum working product.

• Disadvantages• Extensive review requirement each cycle.• Impact on operations due to new releases.• Training requirement for each new deployment at the end of

each development cycle.• Structured and well documented interface definition across

modules to accommodate changes

14.4 PROTOTYPING MODEL

• It is similar to iterative model and the product is developed inmultiple cycles.

• The only difference is that, Prototyping model produces arefined prototype of the product at the end of each cycle

Page 101: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

101

instead of functionality/feature addition in each cycle asperformed by the iterative model.

• There won’t be any commercial deployment of the prototypeof the product at each cycle’s end.

• The shortcomings of the proto-model after each cycle areevaluated and it is fixed in the next cycle.

• After the initial requirement analysis, the design for the firstprototype is made, the development process is started.

• On finishing the prototype, it is sent to the customer forevaluation.

• The customer evaluates the product for the set ofrequirements and gives his/her feedback to the developer interms of shortcomings and improvements needed.

• The developer refines the product according to thecustomer’s exact expectation and repeats the protodevelopment process.

• After a finite number of iterations, the final product isdelivered to the customer and launches in themarket/operational environment

• In this approach the product undergoes significant evolutionas a result of periodic shuttling of product informationbetween the customer and developer

• The prototyping model follows the approach-• Requirement definition• Proto-type development• Proto-type evaluation• Requirements refining

Figure: Prototyping Model

Page 102: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

102

14.5 SPIRAL MODEL

• Spiral model is developed by Barry Boehm in 1988.• The Product development starts with project definition and

traverse through all phases of EDLC(Embedded ProductDevelopment Life Cycle).

• The activities involved are:I. Determine objectives, alternatives, constraintsII. Evaluate alternatives, identify and resolve risks

III. Develop and testIV. Plan

• It is a combines the concept of Linear Model and iterativenature of Prototyping Model.

• Prototyping Model• In prototyping after the requirement analysis the design

for the prototype is made and development process isstarted.

• On finishing the prototype it is send to the customer forevaluation ie. Judgment.

• After customer evaluation for the product the feedback istaken from the customer in term of what improvement isneeded.

• Then developer refines the product according to thecustomer expectation.

• Linear Model• Spiral Model contains the concept of linear model, having

following type.• Requirement• Analysis• Design• Implementation

Page 103: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

103

Figure: Spiral Model

1. Requirement:• This process is focused specifically on embedded software,

to understand the nature of the software to be build and whatare the requirement for the software.

• And the requirement for both the system & the software isdocumented & viewed to customer.

2. Analysis:• Analysis is performed to develop a detailed functional

module under consideration.• The product is defined in detailed with respect to the input,

processing & output.• This phase emphasis on determining ‘what function must be

performed by the product’ & how to perform those function.

3. Design:• Product design deals with the entire design of the product

taking the requirement into consideration.• The design phase translates requirement into

representation.

4. Implementation:• In this process the launching of first fully functional model of

the product in the market is done or handing over the modelto an end user/client

• In this product modifications are implemented & product ismade operational in production environment.

Page 104: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

104

14.6 REVIEW QUESTIONS

1. Explain in detail the Waterfall or Linear Model2. Explain in detail the Iterative/ Incremental or Fountain

Model3. Explain in detail the Prototyping Model4. Explain in detail the Spiral Model

14.7 REFERENCES & FURTHER READING

Introduction to Embedded systems – Shibu K. V

Page 105: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

105

15TRENDS IN EMBEDDED SYSTEMS

Chapter Structure122.0 Objectives122.1 Introduction122.2 Processor Trends122.3 Operating System Trends122.4 Development Language Trends122.5 Open Standards, Frameworks and alliances122.6 Bottlenecks faced by Embedded Industry122.7 Review Questions122.8 References & Further Reading

15.0 OBJECTIVES

After reading this chapter you will understand: Different trends in the embedded industry related to:

• Processor Trends• Operating System Trends• Development Language Trends• Open Standards, Frameworks and alliances• Bottlenecks faced by Embedded Industry

15.1 INTRODUCTION

This concluding chapter describes the trends in theembedded systems industry.

15.2 PROCESSOR TRENDS

• There have been tremendous advancements in the area ofprocessor design.

• Following are some of the points of difference between the firstgeneration of processor/controller and today’s processor/controller.

Page 106: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

106

o Number of ICs per chip: Early processors had a fewnumber of IC/gates per chip. Today’s processors with VeryLarge Scale Integration (VLSI) technology can pack togetherten of thousands of IC/gates per processor.

o Need for individual components: Early processors needdifferent components like brown out circuit, timers,DAC/ADC separately interfaced if required to be used in thecircuit. Today’s processors have all these components onthe same chip as the processor.

o Speed of Execution: Early processors were slow in termsof number of instructions executed per second. Today’sprocessor with advanced architecture support features likeinstruction pipeline improving the execution speed.

o Clock frequency: Early processors could execute at afrequency of a few MHz only. Today’s processors arecapable of achieving execution frequency in rage of GHz.

o Application specific processor: Early systems weredesigned using the processors available at that time. Todayit is possible to custom create a processor according to aproduct requirement.

• Following are the major trends in processor architecture inembedded development.

A. System on Chip (SoC)• This concept makes it possible to integrate almost all

functional systems required to build an embeddedproduct into a single chip.

• SoC are now available for a wide variety of diverseapplications like Set Top boxes, Media Players, PDA, etc.

• SoC integrate multiple functional components on thesame chip thereby saving board space which helps tominiaturize the overall design.

B. Multicore Processors/ Chiplevel Multi Processor• This concept employs multiple cores on the same

processor chip operating at the same clock frequencyand battery.

• Based on the number of cores, these processors areknown as:o Dual Core – 2 cores

Page 107: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

107

o Tri Core – 3 coreso Quad Core – 4 cores

• These processors implement multiprocessing conceptwhere each core implements pipelining andmultithreading.

C. Reconfigurable Processors• It is a processor with reconfigurable hardware features.

• Depending on the requirement, reconfigurableprocessors can change their functionality to adapt to thenew requirement. Example: A reconfigurable processorchip can be configured as the heart of a camera or that ofa media player.

• These processors contain an Array of ProgrammingElements (PE) along with a microprocessor. The PE canbe used as a computational engine like ALU or a memoryelement.

15.3 OPERATING SYSTEM TRENDS

• The advancements in processor technology have caused amajor change in the Embedded Operating System Industry.

• There are lots of options for embedded operating system toselect from which can be both commercial and proprietary orOpen Source.

• Virtualization concept is brought in picture in the embedded OSindustry which replaces the monolithic architecture with themicrokernel architecture.

• This enables only essential services to be contained in thekernel and the rest are installed as services in the user space asis done in Mobile phones.

• Off the shelf OS customized for specific device requirementsare now becoming a major trend.

15.4 DEVELOPMENT LANGUAGE TRENDS

There are two aspects to Development Languages withrespect to Embedded Systems Development

Page 108: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

108

A. Embedded Firmware• It is the application that is responsible for execution of

embedded system.

• It is the software that performs low level hardwareinteraction, memory management etc on the embeddedsystem.

B. Embedded Software• It is the software that runs on the host computer and is

responsible for interfacing with the embedded system.

• It is the user application that executes on top of theembedded system on a host computer.

Early languages available for embedded systems developmentwere limited to C & C++ only. Now languages like Microsoft C$,ASP.NET, VB, Java, etc are available.

A. Java• Java is not a popular language for embedded systems

development due to its nature of execution.

• Java programs are compiled by a compiler into bytecode.This bytecode is then converted by the JVM into processorspecific object code.

• During runtime, this interpretation of the bytecode by theJVM makes java applications slower that other crosscompiled applications.

• This disadvantage is overcome by providing in builthardware support for java bytecode execution.

Figure: Java based Embedded Application Development

Page 109: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

109

• Another technique used to speed up execution of javabytecode is using Just In Time (JIT) compiler. It speeds upthe program execution by caching all previously executedinstruction.

• Following are some of the disadvantage of Java inEmbedded Systems development:

o For real time applications java is slowo Garbage collector of Java is non-deterministic in

behavior which makes it not suitable for hard real timesystems.

o Processors need to have a built in version of JVMo Those processors that don’t have JVM require it to be

ported for the specific processor architecture.o Java is limited in terms of low level hardware handling

compared to C and C++o Runtime memory requirement of JAVA is high which

is not affordable by embedded systems.

B. .NET CF• It stands for .NET Compact Framework.

• .NET CF is a replacement of the original .NET framework tobe used on embedded systems.

• The CF version is customized to contain all the necessarycomponents for application development.

• The Original version of .NET Framework is very large andhence not a good choice for embedded development.

• The .NET Framework is a collection of precompiled libraries.

• Common Language Runtime (CLR) is the runtimeenvironment of .NET. It provides functions like memorymanagement, exception handling, etc.

• Applications written in .NET are compiled to a platformneutral language called Common Intermediate Language(CIL).

• For execution, the CIL is converted to target specificmachine instructions by CLR.

Page 110: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

110

Figure: .NET based Embedded Application Development

15.5 OPEN STANDARDS, FRAMEWORKS ANDALLIANCES

Standards are necessary for ensuring interoperability. Withdiverse market it is essential to have formal specifications to ensureinteroperability.

Following are some of the popular strategic alliances, opensource standards and frameworks specific to the mobile handsetindustry.

A. Open Mobile Alliance (OMA)• It is a standard body for creating open standards for mobile

industry.• OMA is the Leading Industry Forum for Developing Market

Driven – Interoperable Mobile Service Enablers• OMA was formed in June 2002 by the world’s leading mobile

operators, device and network suppliers, informationtechnology companies and content and service providers.

• OMA delivers open specifications for creating interoperableservices that work across all geographical boundaries, onany bearer network. OMA’s specifications support thebillions of new and existing fixed and mobile terminalsacross a variety of mobile networks, including traditionalcellular operator networks and emerging networkssupporting machine-to-machine device communication.

• OMA is the focal point for the development of mobile serviceenabler specifications, which support the creation ofinteroperable end-to-end mobile services.

• Goals of OMA• Deliver high quality, open technical specifications based

upon market requirements that drive modularity, extensibility,and consistency amongst enablers to reduce industryimplementation efforts.

Page 111: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

111

• Ensure OMA service enabler specifications provideinteroperability across different devices, geographies,service providers, operators, and networks; facilitateinteroperability of the resulting product implementations.

• Be the catalyst for the consolidation of standards activitywithin the mobile data service industry; working inconjunction with other existing standards organizations andindustry fora to improve interoperability and decreaseoperational costs for all involved.

• Provide value and benefits to members in OMA from allparts of the value chain including content and serviceproviders, information technology providers, mobileoperators and wireless vendors such that they elect toactively participate in the organization.

(Source : http://www.openmobilealliance.org)

B. Open Handset Alliance (OHA)• The Open Handset Alliance is a group of 84 technology and

mobile companies who have come together to accelerateinnovation in mobile and offer consumers a richer, lessexpensive, and better mobile experience. Together theyhave developed Android™, the first complete, open, and freemobile platform and are committed to commercially deployhandsets and services using the Android Platform.

• Members of OHA include mobile operators, handsetmanufacturers, semiconductor companies, softwarecompanies, and commercialization companies.(Source : http://www.openhandsetalliance.com/)

C. Android• Android is an operating system based on the Linux kernel,

and designed primarily for touchscreen mobile devices suchas smartphones and tablet computers.

• Initially developed by Android, Inc., which Google supportedfinancially and later bought in 2005, Android was unveiled in2007 along with the founding of the Open Handset Alliance:a consortium of hardware, software, and telecommunicationcompanies devoted to advancing open standards for mobiledevices.

• The first publicly-available Smartphone to run Android, theHTC Dream, was released on October 18, 2008

Source:http://en.wikipedia.org/wiki/Android_(28operating_system)

Page 112: Syllabus S.Y.B.Sc (Information Technology) Sem - IV, Paper ...archive.mu.ac.in/myweb_test/S.Y.B.Sc. IT (Sem - IV) - Embedded... · A system with control functionality contains both

112

D. Openmoko• Openmoko is a project to create a family of open source

mobile phones, including the hardware specification and theoperating system.

• The first sub-project is Openmoko Linux, a Linux-basedoperating system designed for mobile phones, built usingfree software.

• The second sub-project is developing hardware devices onwhich Openmoko Linux runs.

(Source: http://en.wikipedia.org/wiki/Openmoko)

15.6 Bottlenecks faced by Embedded Industry

Following are some of the problems faced by theembedded devices industry:

A. Memory Performance• The rate at which processors can process may have

increased considerably but rate at which memory speed isincreasing is slower.

B. Lack of Standards/ Conformance to standards• Standards in the embedded industry are followed only in

certain handful areas like Mobile handsets.• There is growing trend of proprietary architecture and

design in other areas.

C. Lack of Skilled Resource• Most important aspect in the development of embedded

system is availability of skilled labor. There may bethousands of developers who know how to code in C, C++,Java or .NET but very few in embedded software.

15.7 REVIEW QUESTIONS

1. Write a short note on Processor Trends in Embedded Systems2. Explain the Embedded Operating System Trends3. Write Short notes on Embedded Development Language Trends4. Explain Open Standards, Frameworks and alliances5. Write short note on Bottlenecks faced by Embedded Industry

15.8 REFERENCES & FURTHER READING

Introduction to Embedded systems – Shibu K. V