Embedded system and
Development
Rajani Bhandari
Senior Project Manager
HCL Technologies
Topics
Introduction to Embedded systems
How embedded is different from PC
Design constraints in embedded software
Examples of Embedded applications
Software development cycle in embedded
applications
Architecture of embedded applications.
Development Guidelines
2
Introduction to Embedded systems
3
Introduction of Embedded system
An embedded system is a combination of computer hardware and
software accomplished with additional mechanical or other parts designed
to perform a Specific Function
Embedded software is In every electronic device used in real life like
cell phone, pager, digital camera, portable video games, Calculators,
oven, washing machine etc.
Limited Resources
: :Embedded systems often must cost just a few
dollars, must be sized to fit on a single chip, must perform fast enough to
process data in real-time, and must consume minimum power to extend
battery life. High user expectations in terms of performance
4
Connect via peripherals
Embedded Systems talk with the outside world via peripherals,
such as:
Serial Communication Interfaces (SCI): RS-232, RS-422, RS-485
etc.
Universal Serial Bus (USB)
Multi Media Cards (SD Cards, Compact Flash etc.)
Networks: Ethernet, Lon Works, etc.
Analog to Digital/Digital to Analog (ADC/DAC)
5
Examples In Your Daily Life
…wake up …
…have breakfast …
…set home safety system …
…get into your car …
…on your way to your office…
6
Examples In Your Daily Life
(cont’)
…in Your office…
7
Examples In Your Daily Life
(cont’)
…Back Home …
8
A “short list” of embedded systems
Anti-lock brakes Modems
Auto-focus cameras MPEG decoders
Automatic teller machines Network cards
Automatic toll systems Network switches/routers
Automatic transmission On-board navigation
Avionic systems Pagers
Battery chargers Photocopiers
Camcorders Point-of-sale systems
Cell phones Portable video games
Cell-phone base stations Printers
Cordless phones Satellite phones
Cruise control Scanners
Curbside check-in systems Smart ovens/dishwashers
Digital cameras Speech recognizers
Disk drives Stereo systems
Electronic card readers Teleconferencing systems
Electronic instruments Televisions
Electronic toys/games Temperature controllers
Factory control Theft tracking systems
Fax machines TV set-top boxes
Fingerprint identifiers VCR’s, DVD players
Home security systems Video game consoles
Life-support systems Video phones
Medical testing systems Washers and dryers
And the list goes on and on
9
9
Embedded Vs PC
10
Difference - Embedded and PC
An embedded system have defined process and function whereas PC
is generic
Computer system can be manufactured with general requirement and the
manufacturer does not know what the customer will do, while embedded
system is Application Specific .
Numerous embedded system make up the computer
Tightly constrained: Embedded system design is tightly constraint.
Important factors to be considered are as cost, size, performance, and
power.
Reactive and real-time:
Continually reacts to changes in the system’s environment.
Must compute certain results in real-time without delay
11
Difference - Embedded and PC App- Coding
Embedded PC Application
Closer to the Hardware Abstracted Hardware
Use native data types
Fewer System Resources Plenty of Resources
No Operating System Has an Operating System
More efficient algorithms
Higher frequency = higher
power
12
Embedded vs PC App - Testing
Embedded PC Application
Debugging is very difficult Usually simple to get a basic
Emulators or simulators are debug output
required at the time of Can be very sophisticated
development testing
Usually a simple interface
Often involves extra hardware
Design challenges
14
Design Challenges
Unit Cost- Cost of manufacturing each unit
Cost NON recurring Engg Cost: Monetary cost of designing the system
The physical space required by the system and measured in bytes for
Size software and gates for hardware.
Performance Execution cost
The amount of power consumed which determines life time of battery.
Power Maximum Source of power : Antennas – Bluetooth, Wi-Fi, RF .
Digital displays
Time-to market constraint. Hardware and software development goes in
Time Line parallel
Missing this window – significant loss
Change functionality without heavy NRE cost. Code should be
Flexiblity maintainable
15
Design Metrics
Power
Performance Size
NRE
cost
Improving one often leads to a degradation in another
16
Examples of embedded system
Car cruise It Compute acceleration Delayed
controllers reacts and deceleration computation System
to brake sensor Failure
and speed
17
Mobile evolution – impact on design matrices
Digital Mobile Wide Band Mobile Broadband Mobile
1980 analog cellular technology Communication 1990 Communication 2000 Communication 2010
Factors Affected
Cost
Design Complexity
Size
Performance
Power Consumption
18
Digital camera- An embedded system example
Digital camera chip
CCD
CCD preprocessor Pixel coprocessor D2A
A2D
lens
JPEG codec Microcontroller Multiplier/Accum
DMA controller Display ctrl
Memory controller ISA bus interface UART LCD ctrl
19
Time to Market- Design challenge
Revenues ($)
Time (months)
Market window:
Period during which the product would have highest sales
Average time-to-market constraint is about 8 months. Delays can be costly.
20
Design Challenge
After decision of mass production of embedded system and a small
bug found at that time may be very expensive. Even a 1 day delay can
cost equivalent ……… Any Guesses??
21
Software Development Life cycle
22
Embedded system Life Cycle
Development of Hardware and software goes in parallel which is a major
challenge.
23
Architecture of embedded application
24
Architecture of embedded system
Application Software
Operating System
Hardware
25
Hardware architecture
26
Development Guidelines
27
Guidelines for embedded application
development
Memory Guidelines
Data Type
Life time of variable
Memory allocation on heap or stack. Memory should be freed
if not required
Stateless components
Logging and Instrumentation
User Interface
Simple UI
Hour glass as visual indicator for blocking operation
Resolution and LCD size
Design for usability by supporting for touch, stylus driven, 5-
way
Do not update ui frequently
Power:
Optimal Power usage
Transferring data on Air
Reset Device
Design for the restoration of configuration
28
Key rules for best coding
Maintainability Reliability Efficiency
29
Maintenance problems
Unstructured code
Insufficient domain knowledge
Insufficient documentation
30
Efficiency
Optimal Utilization of Resources
Design and architecture of software
Memory management
31
Coding standards
Readability of code
Size of Function
Variable naming
Code Commenting
Long methods
Private, public or local variable naming rule
Formatting and indentation
Complexity of code
Multiple return statement
Nested loop or conditions
Uninitialized variables
Duplicate code prone to errors
Avoid Hard Coding
Multilingual support
Use of enum to indicate discrete values
Reusable code or shared libraries
32
Sample code
// This class provides the functionality
// of adding numbers
#include <iostream>
using namespace std;
int main( )
class Adder{ {
public:
// constructor
Adder a;
Adder(int i = 0)
{ a.addNum(10);
total = i;
}
a.addNum(20);
// interface to outside world a.addNum(30);
// Adds a number and calculates
total
void addNum(int number) cout << "Total " << a.getTotal()
{ <<endl;
total += number; return 0;
}
// interface to outside world
}
//get sum total result
int getTotal()
{
return total;
};
private:
// hidden data from outside world
int total;
33
};
Which one is better
bool MyApplication::ReportGenerator:: bool
GenerateReport() MyApplication::ReportGenerator::GenerateReport(
{ )
bool returnValue = false; { if ( ! isAdmin () ) return false ;
if (isAdmin() && if ( ! isConditionOne () ) return false ;
isConditionOne() && if ( ! isConditionTwo () ) return false ;
isConditionTwo() && if ( ! isConditionThree() ) return false ;
isConditionThree()) return generateReport() ;
{ returnValue = generateReport(); } }
return returnValue;
}
34
Sample Code
function do_stuff() { function do_stuff() {
// …
if (is_writable($folder)) { // ...
if ($fp =
fopen($file_path,'w')) { if (!is_writable($folder)) {
if ($stuff = return false;
get_some_stuff()) {
}
if
(fwrite($fp,$stuff)) {
if (!$fp = fopen($file_path,'w')) {
// ...
return false;
} else {
}
return false;
if (!$stuff = get_some_stuff()) {
} return false;
} else { }
return false;
} if (fwrite($fp,$stuff)) {
} else { // ...
return } else {
false; return false;
} }
} else { }
return false;
}
}
35
Good Coding and Design brings >>>
Quality software On-time to bring customer
Delight
36
Questions ??
37
Thanks!!
38