You are on page 1of 46

Unit – II

Design of Embedded System


Design
• The validated system specifications
document has to be converted into design
• We need to carry out a paper design for
both hardware and software.
Design Tradeoffs
• Design Stage we need to select processor
and OS.
Design Goals are
Co-Design
Partitioning the system into hardware and
software is known as co-design.
Hardware Design
It Involves
Selection of Processor
Processor selection is the most crucial in hardware design
Processor will be Micro controller, Microprocessor or Digital
Signal Processor (DSP).

A Micro Controller is a low cost processor. Its main attraction is


that on the chip itself, there will be many other components such
as memory, serial communication interface, ADC etc..

A Microprocessor are more powerful, but you need to use many


external components with them.

DSP is used mainly for applications in which signal processing is


involved such as audio and video processing.
Based on processor selection
the following criteria involved
• Performance requirements
• Cost of the processor
• Development tools
• Special requirements
• Support for RTOS
• Technical support from the vendor
• Availability of people with the expertise on a
specific processor
Software Design
• for small embedded systems, there will be no
need for an OS and hence we can write our own
software routines for task management, I/O
management and memory management and
integrate your application software with these
routines.

• for complex embedded system an embedded


real time OS will make the development faster
Software design involves
• Working out the details of the processing to be done by
the embedded system
• Decomposition of the processing into different tasks.
• Calculation of the processing time and the resources
required for each task.
• Deciding on the use of an embedded OS.
• Studying the need for support for communication
protocols stack.
• Study the need for embedding the HTTP server software
• Study the need for field up gradation of the software.
Selection of OS
• Optimized kernel for the chosen processor
• Support for languages
• Support for POSIX function calls
• Footprint
• Software component
• Source code/Object code
• Licensing fee
Implementation
Hardware implementation involves

– Developing the circuit schematics


– Obtaining the PCBs
– Procuring the components
– Assembling the components and testing the
individual modules on the populated PCB.
– Testing the complete hardware
Integration and Testing

Testing is the most difficult and time


consuming process. The project team needs
to assign sufficient time for testing the
embedded system not only for its
performance characteristics but also for
checking its reliability.

What is testing?
• Testing is the process to prove that the
system works correctly,
• Testing is the process to prove that the
software does not work correctly.
• Testing is the process to reduce the risk
associated with the residual defects.
Types of Testing
• Black box testing
• White box testing
• Performance testing
• Gorilla testing
• Field trial
• Acceptance testing
• Regression testing
Black box testing
The functionality of the product is tested.
The system is considered as a black box the
implementation details are not considered at
all.
White box Testing
Implementation details are considered
while testing the system. Each and every line
of code is tested.
Performance Testing
Check whether the system is meeting the
time constraints as per the requirements.
Particularly for hard real time systems a
rigorous testing has to be done to ensure that
deadlines are not missed at all.
Gorilla Testing
It will randomly press some buttons on the
keypad or switch on/off the system power
supply.
Field Trial
If your system has to work in mission critical
applications or when safety is a major concern you need
to conduct the field trial in extremely controlled
conditions.
Acceptance Testing
When you are satisfying that the system is
working as per the requirements.
Regression Testing
To ensure that modifications to one portion of the
code have no ill effects on other parts of the code. Using
a set of test cases regression testing has to be done
every time changes are made to the source code.
Testing is complete?
To declare that the testing of the embedded system is
complete, the test engineers need to carry out a statistical
analysis of the number of defects found per unit time (Say
one day). The values of MTBF (Mean Time Between
Failures), MTTR(Mean Time to Repair) and MTTF (Mean
Time to Fail) need to be measured.
Types of Hardware Platforms

• Single Board Computers


• PC add on cards
• Custom Built hardware platforms
Single Board Computers
Is built around a 32 bit or 64 bit processor with all the
peripherals integrated into a single printed circuit board. For
industrial use the SBC is housed in a 19 inch rack mountable
cabinet.
PC Add on cards
The PC add on cards are plugged into the motherboard of
a PC. In many process control applications these PC add on
cards are used for data acquisition. These cards use different
types of buses for communication with the processor board.
ISA Bus
PCI Bus
Computer PCI Bus
•Virtual Instrumentation
•Interactive Voice Response
•Software Defined Radio
•Telephone tapping system
Custom Built Hardware Platforms
It is used when the application demands
design of a processor based system as per the
customer requirements.
ATMEL 89C51 Microcontroller
AVR ATmega 128 Microcontroller
89C51 Microcontroller Development Board
AVR Microcontroller Development Board
Features
Introduction in RTOS
A Real Time Operating System is
multitasking operation system for applications,
which require that system tasks and functions
execute with real-time constraints.
The system controls the execution of all
functions such that time deadlines are met.
• It responds to inputs immediately(Real Time)
• Here the task is completed within a specified
time delay.
• In real life situations like controlling traffic
signal or a nuclear reactor or an aircraft.
• The operating system has to respond quickly.
There are two types
1.Hard Real time system
2.Soft Real time system
Hard Real Time System
Soft Real Time System
Characteristics of RTOS
Functions of RTOS
• Task Management
• Scheduling
• Resource Allocation
• Interrupt Handling

Task Management
* Real Time Applications the process is called as Task
which takes execution time and occupies
memory.
* Task management is the process of managing task
through its life cycle.
Task
• No of Tasks
• Resource Requirements
• Release Time
• Execution Time
• Deadlines
Resource Allocation
• Weighted Round Robin
• Priority Based
Interrupt
An interrupt is a signal from a device attached to
a computer or from a program with in a computer that
causes the main program that is operating system to
stop and figure out what to do next.
Examples of Real Time System
• Plant control
• Control of production processes / industrial automation
• Railway switching systems
• Automotive applications
• Flight control systems
• Environmental acquisition and monitoring
• Telecommunication systems
• Robotics
• Military systems
• Space missions
• Household appliances.
Architecture of the Kernel
• The embedded software consists of the
Operating System and the application
software.
• The services provided by the operating
system are accessed through Application
Programming Interface(API) to develop
application software.
• The API is a set of function calls using which
you can access the various kernel objects and
the service provided by the kernel.
The Various Kernel Objects are
• Task
• Task Scheduling
• Interrupt Service Routines
• Semaphores
• Mutexes
• Mailboxes
• Message queues
• Pipes
• Event Registers
• Signals
• Timers
The Kernel provides various services through
operations on the kernel objects.

These services are


•Memory Management
•Device Management
•Interrupt Handling
•Time Management
Tasks and Task Scheduler
• The Embedded software consists of a number of
tasks.
• These tasks include the OS tasks and
Application specific task.
• Each task in ES is implemented as an infinite
loop.
• The task objects consist of Name, unique ID,
priority, stack and task control block.
• In addition to the tasks required for the
application software, the kernel has its own
system tasks with priorities.
• Startup task: Which is executed when the
operating system starts.
• Exception handling task to handle the
exceptions.
• Logging task: log the various system messages.
• Idle task : Which will have lowest priority and will
run when there is no other task to run.

One CPU has to handle multiple tasks, the tasks


have to share the CPU time in a disciplined
manner so that one task does not get lot of
time while others are waiting forever.
Task Scheduling
• Each task has to be assigned a priority
mechanism for deciding which task will get CPU
time next has to be worked out. This is known
as task scheduling.
• The object that does task scheduling is the task
scheduler.
• The task have to share the system resources
such as CPU registers, external memory and I/O
devices.
• The important requirement is that one task
should not corrupt the data of another task.
While scheduling Task no of Issues are

Many tasks may make calls to a function.


•A function that can be used by more than one task
without data corruption is called reentrant
function.
•If data is corrupted when more than one task
calls the function such a function is called non
reentrant function.
•Every task requires resources such as serial port,
keyboard, display or memory locations.
•The resources shared by two or more tasks are
called as shared resources.
Task States
For Instance consider an embedded system that
obtains data from a serial port and converts the
data into Ethernet packets.

Task 1: reads the data from serial port another


task (task2) keeps converting the serial data
(Character) into packets and put them into buffer.

Another Task (Task3) read data from buffer and


sends it over an ethernet interface.
Task2 has to wait for Task1 to complete its work
and then inform task3 can do its work.
Task can be in one of the following 3 states
• Running
• Waiting
• Ready to Run
Running State:
A task is said to be in running state If it is being
executed by the CPU.
Waiting State:
If it is waiting for another event to occur. Waiting state
cannot be executed till the external event occurs.
Ready to Run State:
If it is waiting in a queue for the CPU time.
Task Stack:
Every task will have a stack that stores the local
variables, function parameters, return address
and CPU registers during an interrupt.

Context Switching:
The state of the CPU registers when a task has to
be preempted is called the context. Saving the
contents of the CPU registers and loading the new
task parameters is called context switching (High
Priority to low priority).

You might also like