Professional Documents
Culture Documents
It is thus clear that embedded software development can be highly complex besides
having a large number of data type, structure and algorithm (functions) needs that are to be
engineered.
It is also seen that embedded system programs differ from the usual computer programs
in the following respects. (i) Several components of vastly different functionalities are found in
embedded system software. Functionalities of the physical and virtual device driver routines,
application software and operating systems are vastly different and must not only be
appropriately engineered, but also system-integrated. (ii) Different software components have
2 Embedded System…
response time constraints and have to often meet strict deadlines. (iii) All software components
must also use the memory optimally. (iv)Each software-component execution speed must be
the optimum, to enable the minimisation of energy while meeting all deadlines. (v) Software
must have controlled complexity and must be thoroughly tested and debugged for errors
because the codes will be permanently burned-in at the system ROM. Therefore, a software
algorithm development process must use standard software engineering practice(s).
Hurrying through the coding directly without following the software engineering
approaches and practices should never be done in any system above a minimum level of
complexity. Research by software engineering experts have shown that on an average, a
designer needs to spend about 50% of time for planning, analysis and design, 40 % for testing,
validation and debugging and 10 --15 % on coding.
There are a number of standard textbooks for in-depth and detailed understanding of
software engineering principles, approaches and practices. Software engineering involves:
(i) Developing and using skills and CASE (Computer Aided Software Engineering) tools
so that a system is analysed and specified correctly,
(ii) Software implementation with an appropriate set of source code engineering tools,
(iii) Testing, verification and validation so that quality software is produced.
Standard texts should be studied to develop these skills in depth. [One such textbook is
“Software Engineering – A Practitioner’s Approach” authored by an International authority on
this subject, Roger S. Pressman, McGraw-Hill, 5th Edition 20th Anniversary Edition, 2001. Also
see ‘References’.]
The first objective of this web article is, therefore, to learn the software engineering
concepts and find answers to the following: questions:
4. What are the real-time programming and software development process issues?
Software Engineering Practices …
3
When software is developed and its design and codes are finalised, it has to be
maintained. The next objective of this web article is to learn, and find answers to, the
following:
5. How is a project managed? What are the software management practices and project metrics
to estimates efforts at planning stage?
6. How is software maintained?
Unified Modeling Language (UML) is a modeling tool available for use during
development or design or process. The next objective of this web article is to learn following:
One principle is that a complex system needs greater attention during its development process.
Software complexity can be understood by the following:
1. Complexity may be used to predict (a) critical information about reliability and (b)
maintainability of software systems from an automatic analysis of source code or for
procedural design information.
2. Complexity metrics also provide numerically a feedback during the software
development process, to help by controlling the design activity for a project.
3. Complexity provides detailed information about modules and helps to focus on the
areas of potential instability during testing and maintenance.
4. Complexity in object-oriented design is measured in terms of structural characteristics.
It is found by examining how classes of an OO design are interrelated to each other.
How can software algorithm complexity be measured?? There are at least 18 different
categories of software complexity metrics. One of the most popular metrics is from McCabe.
[Refer to “Software Engineering –a Practitioners Approach” by Roger S. Pressman, McGraw-
Hill, 5 edition, 20 Anniversary Edition, 2001.] It is called Cyclomatic Complexity’. When stated
in terms of a flow graph, an independent path is the path that moves at least one edge (arc or
directed arc) that has not been traversed before the path is defined. An independent path is any
path that is traversed due to at least one new set of processing statements or a new condition.
Figure 6.6 (a) showed eight paths. Four are independent paths. Cyclomatic complexity, C (g)
4 Embedded System…
equals the number of independently traversed paths. The C (g) computation gives us the number
of paths to look for which in this case are 4 (besides the one expected path to facilitate flow).
Example 1 gives three computation formulae and analysis of C (g) of a CDFG shown in Figure
6.6.
Example 1 [B+]
1. C (g) = E – N +2, where E = the number of edges in the graph and N is the number of
decision nodes. E = 6. [There are three incoming plus outgoing edges per node. Four nodes
have 12 of them. But each edge is shared between two nodes. So the number of edges are
taken as = 6]. The number of nodes, N = 4. Cyclomatic complexity is again found to be 4
by this formula.
2. C (g) = P + 1, where P is the number of predicate nodes contained in the CDFG. Number of
predicate nodes = 3 in the figure. Cyclomatic complexity is again found to be 4 by this
criterion. [The node at which there are two predictable paths, one when the test result is
true (yes) and the other when the test result is false, (no) defines the predicate node.] Figure
6.6(a) shows P = 3 (three predictable paths). The testing node at the test start is simply a
decision node and not a predicate node. Calculation of yn starts on the event of a new n
value at the input.
3. C (g) = Number of regions in the flow graph. There are four regions. One region is for
calculating e. The second region is for calculating s. The third is to calculate yn. The fourth
region is for testing conditions at the flow start. Cyclomatic complexity is again found to be
4 by this criterion.
Let a program posses a logical complexity. The number of independent paths in a basic
set in an algorithm = maximum number of tests that ensures that all the statements have been
executed at least once. Figure 6.6(a) showed four test conditions and four independent paths.
Therefore, cyclomatic complexity in Example 6.5 can be taken as four.
[C+]
Software Engineering Practices …
5
Table 1
Phase Activities
Definition (1) Complete clarity of the specifications of the required system is the aim of the
and Analysis definition phase. (2) Specifications are obtained for (i) required processing of
of System data, (ii) necessary functions and tasks and their expected performance, (iii)
Requirement expected system behavior, (iv) constraints of design (v) expected life cycle of
the product, (vi) human-machine interaction, (vii) validation criteria for finally
developed systems and (viii) time delivery schedule
Developmen Software design, coding and testing are the main activities in the development
t phase. Conceptual design of the system is evolved during the software design
phase for following: (i) structuring data, (ii) implementing functions, (iii)
implementing interfaces (iv) algorithms and the languages to be used for them,
(v) testing methodologies to be followed. Conceptual design leads to the
development of codes for application software. Testing and validation are
essential activities of any software development process.
Support Embedded software should need little support. Support phase activities are the
correction of bugs detected and software enhancement by adding the extra
functions necessitated by changing environment and software re-engineering.
There are seven important models from which to choose for the process lifecycle. (i)
Linear Sequential Lifecycle Model. (ii) RAD (Rapid Development) Model. (iii) Increment
6 Embedded System…
Development model (iv) Concurrent Development (v) Component based model (vi) Fourth
generation tool base development (4GL model) (vii) Object Oriented Development Model.
2.1. Use of Linear Sequential Model (Waterfall Model or Lifecycle Model) for the
Software Development Process [B]
Table 2
Figure 1 shows the model. Stages in development are as per Table 2. The Linear
sequential model is a classic model of the software engineering approach to development
processes. Software development progresses through four incremental stages sequentially. Its
path is like a waterfall and hence it is also called waterfall model even though there may be the
looping back to the beginning on uncovering of errors, bugs and malfunctions. The model
proceeds from a start to an end, and hence it is also called Life-cycle model. The development
cycle repeats the four stages as in a lifecycle until software is finally validated (qualifies all
tests and proven as per required specifications).
Software Engineering Practices …
7
Development
Process
Model /Analyse
1
Requirements of
System
Design
Data Structure, Software 2
Architecture, Interfaces
and Algorithms
One Linear
Life Sequence
Cycle
Implementation
3
of Design
Test
Internal logic and 4
External functions
This high-speed development model is an adaptation of the linear sequential model for the
development of each software component separately by the team. The RAD stages in
development are as per Table 3.
Table 3
Stage 2 Characteristics and attributes by sets of data structures development from each
and objects, data modeling designs of attributes of data member, the necessity
structure, software architecture, interfaces and for more team members
algorithms in case of large number of
Stage 3 Process modeling creating descriptions of adding, software components,
deleting, modifying and retrieving data objects lack of readily available
Stage 4 Code creation by reuse of available software reusable components,
components which can delay the
Stage 5 Testing stage is short due to reuse of previously tested process, and the risk of
software components. Interfaces the internal logic of bugs in rapid approach
algorithms and tests for external functions and detecting
errors and bugs
There are multiple efforts to deliver the software incrementally. First-effort designed software is
delivered first and next-effort designed software is then delivered. Successively improved
versions are delivered. Incremental efforts for successively delivering improved software are as
per Table 4.
Table 4
Efforts in Software Development by Incremental Model adapted from Linear Sequential Model
The Concurrent model takes all the stages concurrently for each element of the software
development process that forms part of the product. For example, consider process analysis
stage activities. Each of its elements can be (i) 'under development' (ii) 'awaiting change' (in
second and successive cycles) and (iii) 'under revision' (iv) 'done'. Client server process
architecture is well suited for concurrent development during a software process.
The Component based Object Oriented Software Development Process Model has stages as per
the list in Table 5.
Table 5
Refer to Section 10 for methods of object oriented design and a modeling language for
representing the design.
10 Embedded System…
2.6 The Use of Fourth Generation Tools-Based Software Development Process Model
[B]
Software tools are available that can generate codes according to higher-level specifications.
These tools are called Fourth Generation Tools. Examples are the tools for automatic report
generation, automatic high-level graphics generation, creating data base queries and automated
HTML code-generation when creating a website. RTOS tools are available for embedded
systems.
Use of fourth generation tools can quicken the development processes and provide the
tested and debugged solutions available with it. Its drawback is the need for detailed analysis,
design and validation.
2.7 The Use of Object-Oriented Based and Fourth Generation Tools Based Approach
[B]
Currently, software development processes combine object orientation and fourth generation
tools. This approach has yet to be perfected for embedded systems.
A Successive refinement model is a model in which the process lifecycle is iterated till
verification and validation and delivery (or installing the ROM of the system).
[C+]
§ Activities during a software-development are divided into three phases: Definition
and Analysis of system Requirements, development of designs, code and support. A software
development process can be represented by a cycle called lifecycle. From the last stage, the
cycle can restart iteratively from the first stage till verified and validated software is
completed. Refinement is by successive iterations. There are several software-development
process models, which are in use. Activities during seven of these have been discussed.
3. A problem can be divided into several parts and represented by suitable notations that
describe the essence of the problem.
4. Many a time, it may not be possible to completely specify the problem at an early stage.
5. Prototype development and prototype specifications can often help.
6. Even with the use of the best analysis and models, problems may change. Therefore
communication between the developer team and the customer is essential so that before
the design process starts; both have identical perceptions of the problem, domains,
requirements and software and system specifications.
Analyses can be modeled as three-layered structures. (i) Data and its contents and
information form the inner layer (ii) Next layer is ‘DFGs’, ‘CDFGs’, ‘Entity relationship
diagrams’ and ‘State transition diagrams’. (iii) Data, control and process names, notations and
specifications (descriptions) form the highest layer. There may be specifications and
descriptions also for the protocols in embedded networking systems.
Implementation specifications-- how the messages shall pass between different objects--
may also be described by the analysis. Implementation can be viewed at the analysis stage while
defining the requirements.
Table 6 lists the activities during the use of various models and during obtaining the
specifications in the three layers that are used for analyzing the software-requirements. It also
gives examples for each stage of activity.
Table 6
Algorithms (i) DFGs for information flow, Algorithms for (i) application data flow
(Functions) (ii) CDFGs for program flow through transport and internet-work layers in
(iii) Real time functions and TCP/IP networks (ii) Control algorithms for
their priorities, preempting establishing network connections, transmission
strategies and critical regions and connection termination (iii) Real time
functions in automotive cruise control.
Behavior States and state transition Automatic chocolate vending machine
diagrams behavior when waiting for coin, when coin(s)
is inserted (input event), process activated
(internal machine actions) and when chocolate
is delivered (output). Also refer Figures 6.8 to
6.10 for examples.
Data content Data content naming, input Frames for video processing. Image and sound
Specification sources (files), output sources, format names. Input system name.
s notations and meanings and Compression format specifications.
specifications Compressed files names and specifications
Control Control specifications Robot motors control specifications and what
Specification analysed for normal and real the controlling functions are specified in real
s time functions time.
Process Process Specifications Cruise control process specification, how
Specification analysed by making lists of cruising speed measured, analysed and used
s inputs on events list, outputs for controlling the throttle valve-orifice.
on events, processes activated [Section 11.3.]
on each event.
Figure 2 shows the activities for software analysis during an embedded software-
development Process.
Software Engineering Practices …
13
Requirement Analysis
State
State
Transitions
The reader is referred to Table 2 for development phases and a development process life-cycle
model. The next stage is design, after software analysis for requirements and specifications is
done. Design means a blueprint for software development. It gives an engineering
representation of the system to be built. Software design consists of four layers.
2. The second layer consists of data-design. Questions at this stage are as follows. What
shall be design of data structures and databases that would be most appropriate for the
given problem? Whether data organised as a tree- like structure will be appropriate?
What will be the design of the components in the data? [For example, video information
will have two components, image and sound.]
3. The third layer consists of interfaces design. Important questions at this stage are as
follows. What shall be the interfaces to integrate the components? What is the design
for system integration? What shall be design of interfaces used for taking inputs from
the data objects, structures and databases and for delivering outputs? What will be the
ports structure for receiving inputs and transmitting outputs?
4. The fourth layer is a component level design. The question at this stage is as follows.
What shall be the design of each component? There is an additional requirement in the
design of embedded systems, that each component should be optimised for memory
usage and power dissipation.
What are the concepts used during the design process? They are as follows.
Also, appropriate protection strategies are necessary for each module. A module is
not permitted to change or modify another module functionality. For example,
protection from a device driver modifying the configuration of another device.
8. Mapping into various representations is done from the software requirements.
For example, DFGs lying in the same path during the program flow can be mapped
together as a single entity. Transform and transaction mapping design processes are
used in designing. For example, an image is input data to a system; it can have a
different number of pixels and colors of each pixel. The system cannot process each
pixel and color individually. Transform mapping of image is done by appropriate
compression and storage algorithm(s). Transaction mapping is done to define the
sequence of the images.
9. User Interface Design is an important part of design. User interfaces are designed
as per user requirements, analysis of the environment and system functions. For
example, in an automatic chocolate vending machine system, the user interface is a
LCD matrix display. It can display a welcome message as well as specify the coins
needed to be inserted into the machine for each type of chocolate. Interface design
has to be validated by the software-customer. For example, the customer must
validate message language and messages to be displayed before an interface design
can proceed to the implementation stage.
10. Refinement. Each component and module design needs to be refined iteratively
till it becomes the most appropriate for implementation by the software team.
Software design process may require use of Architecture Description Language (ADL). It
is used for representing the following: (a) Control Hierarchy (b) Structural Partitioning (c) Data
Structure and hierarchy (d) Software procedures.
[C+]
§ The software design stage involves abstraction level to detailed designing level design
activities. Software design can be assumed to consist of four layers: Architecture design, data
design, interfaces design and component level design. There is a need for continuous
refinements in the designs by effective communication between designers and implementers.
The reader can refer to Table 2 for development phases and a development process life-cycle
model. The next stage is software-implementation, after the designing that succeeds the
Software Engineering Practices …
17
software analysis for requirements and specifications. Implementation is real world realisation
after translating a software design. Implementation must be according to the software
requirements and specifications agreed upon between developing team and customer. Functions
(codes) are written to accomplish information (or events) processing as per the design. Each
module of every component is first implemented separately. Later they are coupled and
interfaced.
Software is implemented using source code engineering tools. [Refer Section 5. 11 for
details.] For software implementation, certain standards and procedures are followed. Following
are the principles for implementation.
(1) 1. Use language in which the software team has expertise and experience. For example,
C++ should be used if a team does not have Java skills but has the required skills and
experience in implementing in C++. It is important to remember that good software must
fulfil the specified requirements within the scheduled time.
(2) 2. Use an operating system or RTOS that is the most appropriate and on which the team
has expertise and experience. [Small scale embedded systems may not need RTOS in
simple implementations. This will also keep the code size small without affecting
functionality.]
(3) 3. Program simplicity should be maintained. Each function should perform a single task
and a have simple design. Comments must be added before the control statements. This
helps to make a program easily understandable by all team members. It helps in
subsequent debugging of the program.. Loops should be simple, nested, or concatenated.
Unstructured loops should be avoided in any program and one loop intermingling with
another should not occur.
(4) 4. Program implementation should be as per program structure design specifications.
(5) 5. Make the functions general, not tied to specific input conditions or events. This makes
reuse easier.
(6) 6. Redesigning might be needed to solve software implementation difficulties.
[C+]
§ Each component and its interfaces system integration are implemented after the
design stage. Program implementation is in a language and may use source codes
engineering tools. It should be as per program structure design specifications. Program
simplicity should be maintained during the implementation process.
18 Embedded System…
(7)
Refer to Table 2 for development phases and a development process life-cycle model. The next
stage after analysis, design and implementation is testing. Testing is an important part of the
activity. Embedded software needs thorough testing. This is because the software is to be
permanently installed.
The goal of testing is to find errors and to validate that the implemented software is as per
the specifications and requirements. Validation means that software must be shown to be
according to the specifications and must show behavior as expected in all the events, conditions
and times specified. What is the most important feature of a good software test? If more errors
are discovered at the initial 20% stage of testing , the greater will be the probability of errors
remaining undetected. There will be a higher probability of finding error(s) not yet discovered.
When an error is found which was not detected by any previous test, then a test is said to be
successful. An important principle of any test is also that the software should meet the customer
requirements fully. What is the most effective testing? Most effective testing is testing by an
independent third party.
Tests must be planned long before the testing phase starts. Pareto’s principle is that 80%
of errors uncovered during testing belongs to 20% of the program. Individual components
should be tested before the integrated-system.
Table 7
Test Approaches
or feasible
White Box White Box (also called glass box) White box testing is When the number
Testing testing means a close examination of used in early testing of tests and paths
each procedural detail by testing the phases and when are too large, white
program flow at the independent not reusing the box testing is not
paths. Testing is such that (i) all previously practical. It should
decision nodes (Section 2) are developed then be applied to a
traversed at least once. It ensures that components. Its limited number of
all conditions are tested (ii) all loops need is due to the logical paths that
are executed from the starting index nature of software are critical to a
to the last (iii) all logical paths are defects. Logical system and
thoroughly tested. Testing is done by error and incorrect program-logic
test inputs. Test input sets design is assumptions can should be
crucial and they are designed for the often be made and adequately
specific sets of loops and conditions. these are inversely exercised.
Testing is for control structures, proportional to the
conditions, data flow and loops (‘for’ probability of
loops, ‘while-do’, ‘do-until’). execution of a
program path. It
could be assumed
that a logical path
will not be
traversed and no
situation will arise
causing that path
to be followed.
However, it does
arise eventually.
20 Embedded System…
Black Box Black box testing (Behavioral When the focus is Early stages of
Testing testing) must supplement white box on testing the development.
testing. It uncovers a class of errors functional Availability of
different from those detected by the requirements and sufficient time for
white box. Testing is done by there are tight thorough white box
choosing the most appropriate set of delivery schedules. testing.
input conditions and generating Fast but reliable
events that test functional validity. black box test
Black box testing means testing of procedure has been
behavior and performance. Black box designed by the
testing is for: discovering whether development team.
the system response is sensitive to
particular inputs and system
malfunctions at these inputs and
events; when the values are beyond
the set boundaries in the system, how
the system responds; whether there is
any specific combination of data
objects, inputs or events leading to
malfunction; whether the data inputs
reaching at faster rates modify the
system performance.
Black box testing looks only at the
relationships between a graphical-
collection of nodes. It is for boundary
values analyses, not for all in-range
inputs. Each set of nodes is examined
to describe functions and
relationships.
Software Engineering Practices …
21
Specific Examples for environment specific When a system is Early stage and
Environment testing are as follows. (i) Testing user complete and now incomplete system.
interfaces and GUIs: the embedded has a specific For example,
systems LCD matrix display and environment to test embedded software
keypad may be the GUI and user its behavior. For is ready but
interface, respectively. The testing example, mobile hardware is still
exercise is for finding the effect of phone system. It under
each command from the keys and for needs to be tested development.
proper display of messages. (ii) by dialing a
Testing Client Server architecture: number. A robot
server behavior for different inputs system needs to be
from each client is tested. Whether tested by specified
response to a client request is as per reaches of the robot
specifications is checked. (iii) arm at the specified
Testing Help Utilities and locations.
Documents: A system provides Help
Utilities for the user. These need
testing. Documents also need testing
to ascertain whether documented
functions are working well or even
exist!
Comparison Several available versions are run in For example, an Comparison
testing parallel and the functions and automobile braking systems not
behavior compared. system reliability is available.
absolutely
essential. New
software is tested
for better reliability
compared to
previous ones.
22 Embedded System…
Orthogonal Testing is done at every combination Inputs are bounded When the number
testing of values. and every of combinations of
combination can be inputs are large
tested.
How can one ascertain whether the implemented software is testable or not? Testability
criteria are as follows: (i) It should be possible to decompose the system so that each system
component becomes simple and therefore easier to test. (ii) Observation must be made possible
by distinct outputs for each input so that any incorrect output is easily identified and internal
errors can then be automatically removed. (iii) The test designing team must understand the
designed software well. (iv) Dependencies between internal, external and shared components
must be well understood. (v) Changes in design must be communicated to all necessary
components. (vi) Technical documents must be well organised, specifically for the detailed
tests.
When can a test be more effective? A system can be tested more effectively if it works
well. For example, if none of the robotic motors move during a test, more thorough testing is
needed; and when a single motor does not move while all others function normally, the test
should only be for the module which drives that motor. The test becomes easy and thus, more
effective.
Embedded software needs to be of the highest quality and therefore demands a more
systematic approach to testing. What can be the strategies adopted for testing?
aspects are tested. This could be done , when there are error conditions. For
example, when a queue overflows its size, the software must execute the
routine for ‘exception’. [Refer to the ISR_Qerror in Example 5.5 and Section
4.5.2 for definition of an exception.] There are two types of validation testing,:
(a) Alfa testing, which is at developer site and (b) Beta testing, which is at the
embedded system user site.
(iv) Recovery testing is done to determine how a system recovers when software or
hardware fails.
(v) System testing means integrated system testing, either by top-down, bottom-up
or by regression testing (exercise subset of all test cases)
Testing a system can have several meanings. For example, unit testing, integration
testing, design testing and requirements testing.
Embedded system testing is done in two parts: (i) testing during the software
development process, on the host machine only, and (ii) testing along with the target system.
The latter part is taken up in Chapters 13 and 14.
Like software complexity metrics, there exists a software- test metrics. It uses (i) Data
elements or Objects (ii) Relationships between the data or objects (iii) States (iv) Transitions (v)
A number of functional points. Computations for test-metrics can be understood from the
following example.
Example 2[B+]
1. Let (a) k1 be the number of operators that are distinct and are appearing in n-th software
module. (b) k2 = number of operands that are distinct and are appearing in the module. (c)
K1= Number of times the k1 operators occur in the module and K2= Number of times the k2
operands occur in the module. (d) r = ratio of occurrences of operators per operator
appearing in the program and S = size of software.
2. Now, c = r * k1 /2 defines the programming effort coefficient. The logic for so defining is
as follows The more times an operator occurs in a module, the greater is the testing effortIf
the ratio of occurrences of the operands is larger, the greater will be the efforts needed for
testing. Division by 2 is done because the operation is between two operands.
3. Testing effort metric for a module te (n) will be = c* S. The logic for this definition is:
greater the module size, greater will be total test efforts.
24 Embedded System…
Testing is the activity that detects faults and errors, while debugging means finding the
reasons for a fault. Debugging means that once an error (or set of errors) is detected, the
problem creating source and causes must be identified and the bug present in the software
corrected (fixed). Presence of bugs is intolerable in embedded software. Consider a
sophisticated embedded system for a space lifeboat. The cost of any bug left uncovered in the
system can be imagined!
A fact of life is that a specific software engineer may be able to debug a program easily
and another may not. Debugging can be considered an art. Standard guidelines for debugging
are given below.
1. Use suitable strategys. Available strategies are as follows: (i) Use early stage testing
and debugging. (ii) Debug and locate the problem by binary portioning method, also
called cause-elimination method. It means firstly divide the modules in two halves for
the expected sources. Then subdivide into another two halves. For example, in
debugging a TV fault, first divide into two sections -- video and audio. If audio problem
exists, then divide the audio section circuit into two halves-- detector circuits and
amplifier circuits and continue till problem source is located. (iii) Use backtracking
method. Source is found by backtracking along the program flow path. (iv) Use brute
force method. A brute force method example is source found by white-box testing
(Table 7).
2. Develop a working hypothesis such that it is possible to predict new values that are to
be examined to trace the source during debugging.
3. Develop test modules that can be repeatedly used.
4. Examine previously logged test results.
Table 8 gives the various embedded-system debugging techniques during and after the
software development process.
Software Engineering Practices …
25
Table 8
Use of test Results from the macros specially When test functions Addition of test
Macros written for the tests help embedded are also added in macro adds to
software debugging greatly. [Refer to the software greater code size
Section 5.3 for understanding macro development beyond the
in C.] process to ensure available memory.
efficient debugging
Use of A set of sampled input files are Software Not possible to
output files designed for the debugging phase development create inputs such
for sampled and the outputs that the system process phase and as events.
inputs generates are observed. smoke testing
activity
26 Embedded System…
Caution:
Figure 4 shows testing, debugging, verification and validation activities for software
during an embedded software-development process.
Software Engineering Practices …
27
System
Test Approaches
On Error or
On Failure of
Validation for
Meeting
Specifications
and Requirements
Debugging Approaches
Figure 4 Testing, Debugging, Verification and Validation activities for software during an Embedded
Software-Development Process
[C+]
§ Testing stage follows the implementation stage. Testing approaches are ‘white-box
testing, ‘black-box testing’, specific requirement tests, comparison testing and testing by
orthogonal data inputs. Tests verify that the software developed after processing through the
lifecycle stages is as per required and agreed specifications. Validation of required
specifications is done at the last stage before delivering to the customer. The cycles may have
to be iterated according to successive refinement models if validation fails. Observed error
source is traced during debugging by use of breakpoints, test macros and test vectors
simulators and laboratory tools.
28 Embedded System…
A real time system is system that has an additional programming requirement that it has to meet
response time (deadline) constraints in one or more of its functions. (Section 6.1 for real-time
program models). Therefore, real-time programming has the following additional issues.
(i) Events are asynchronous in nature. What are maximum latencies and time
dependencies of events? What are the program flow control-specifications on
occurrences of real-time events?
(ii) What are the specifications of the acceptable maximum response times (time
intervals between set of inputs and outputs) from each software function (or
component)?
(i) What are specifications of the acceptable maximum latencies of the Interrupt
Service Routines (ISRs) and what are their servicing deadlines?
(iv) What are specifications for the software components (tasks) and interrupts
priorities? What are the allocations of priorities to those with shorter deadlines
and what are the routines that can await execution at a later stage?
(ii) IPCs specifications. [Refer to Chapter 7]
(vi) What are the risks on failure to meet a deadline and what are the recovery
methods in case of failures?
(iii) Reliability and acceptable fault-tolerances. [Refer to the space lifeboat
example].
(i) Selection of processor, memories and their sizes, and hardware. [Refer to
Chapter 1]
(ii) Selection of single processor or multiprocessor systems.
(iii) Selections of software design such that there is memory and power dissipation
optimisation in the system and hardware-software design is optimised.
(iv) Selection of software language, C or C++ or Java. [Refer to Sections 5.1, 5.8
and 9.] .
(ii) Decision to use RTOS (real-time operating system) and to design them if
needed. [Refer to Chapter 8.] .
Software Engineering Practices …
29
(iii) Decision to design RTOS by the software team or to use the readily tested and
debugged RTOS. [Refer to Chapters 9 and 10.].
(iv) Design and selection of tests and debugging breakpoints and macros (test-
vectors). [Tables 7 and 8.].
(viii) Selection of uncompressed or compressed software and input data in the
system ROM (Section 2.4).
(ix) Decision of whether to use caches and if used, in what sections and data to
manage the power dissipation
(x) Use of stop and wait states in the software to manage the power dissipation.
As inputs, events and interrupts are time dependent and asynchronous, real-time system
software is difficult to test compared to non real time software. Not only white-box as well as
black box and smoke testing but also testing is required for handling of asynchronous events by
the system. Real time system testing, debugging and verification may offer real challenges.
Following are the issues:
(i) Testing whether, occasionally, in one state the real-time data processes
properly but in other states fails.
(ii) Selection of testing strategy (s): (i) Task Testing by testing each task
independently so that it not only detects logic errors and functional errors but
also errors in meeting timing constraints and in system behavior. (ii) Behavioral
testing by simulating the real time system behavior and studying the
behavior(s) on external events.
(iii) Effects of events by testing for each event individually and by pairs and sets of
events.
(iv) System testing for hardware and software integration.
(v) Test for Proper interrupt priority assignments
(vi) Test for each ISR for each of its interrupt source and source groups
30 Embedded System…
Pressman defines four Ps in his book: people, product, process, project, for software project
management. Table 9 lists these four and gives their functions. [People in fact means here a
team of software engineers or system development engineers.] Software project management
principles are as follows: (a) Organisation of the people (b) Development perception correct for
analysis, design, implementation and testing when developing the product. (c) Monitoring of
process adopted at each stage (d) Organise and manage the project so as to ensure its success, )
Software Engineering Practices …
31
Table 9
Is there a way by which the magnitude of the size of a project and the effort required could be
measured in the beginning of a project? Project metrics for software are for (i) KLOC (Kilo
lines of code) (ii) Pages of documentation per KLOC (iii) Errors per KLOC (iv) Defects per
KLOC and (v) Cost of documentation per page. These give the estimates of (a) Cost per LOC,
(b) Error per person-month, and (c) LOC per person-month.
Example 3 [B+]
Consider an embedded system in a car. Assume that following are the external interfacing-
devices and C functions in the system. Assume a system is being developed to monitor (i)
Watch, (ii) Engine speed, (iii) Vehicle speed, (iv) Odometer, (v) Fuel sensing, (vi) Alarm, (vii)
Illumination, (viii) Automatic gearbox, (ix) Secured telltales control (recording the car use and
malfunctions data for retrieval by mechanics later for servicing and maintenance) and a few
other activities. Table 10 gives a typical LOC estimates during a project. Table 11 gives a
format for defects planning and productivity and cost estimates.
Table 10
temperature
Illumination 1611 1925 2240
Automatic Gear 240
Box 174 207
Total 10241 11643 13051
Note: (1) *LOC includes as follows.
Commentary 100%
includes ( ) 100%
!
lines notconcluded by semi 100%
column
blank lines 0%
special statements like macros 100%
Note: Project metrics failed because of these estimates. Why? It used earlier research estimates
and the team did not have any perception of the nature of the efforts needed in assembly code
sections of C algorithms in the current project.
Table 11
How does one calculate the estimates for LOC? There is a function oriented metric, called
FP (function points) and called FFP (Full Function Points) for the total of all FPs in the project.
Calculation of function points is by counting and then multiplying counts suitably by three
weighting factors (simple, average and complex) for the three columns in the Table 10. The
following function points F(i) are used for finding the i-th counts and then count total. Three
weight factors for multiplying a count for an F(i) are given in brackets. These factors are based
on the experiences with a large number of projects and have been adapted for the project
metrics.
LOC per FP depends on coding language. For C codes, LOC per FP is 128, Assembly =
320 and C++ = 64. It is used in productivity function metrics and for generating a table like
Table 10.
[C+]
§ According to Pressman, Software project management can be said to consist of
management of people, product, process and projects. For planning stage estimation of
program efforts, project metrics are available. One such metrics is by use of function points
and use of FFPs (Full Function Points) to estimate the KLOC (Kilo lines of codes) and
productivity per person-month.
The life cycle of software development process ends with delivery, but its life itself does not
end there. Maintenance involves changes, removals and additions in the objects or modules
after delivery (or installation in ROM in case of embedded systems). The maintenance
Software Engineering Practices …
37
Table 12
Adaptive Adapt the software to new A robot may have Complex systems
conditions. [Shirt adaptive to be adapted to a may be more
maintenance by tailor for a change in the difficult or costly
slimmer look!] specifications of its to adapt compared
arm reach and to designing a new
range of operations. one.
An automatic
chocolate machine
may have to adapt
to the introduction
of new types of
coins in the
country’s currency.
Enhancement or Development team delivers a New design Perfection process
Perfection system on schedule and then development and can never end and
Maintenance finds another design capable of availability of new system must have
working more accurately and tools with the only the acceptable
effectively. developer so that fault tolerances.
better systems can
be delivered
System Merely delivering a system Reengineering is Complex systems
reengineering never satisfies an innovative another way to may be difficult to
team. It does reengineering of maintain a given reengineer
previously developed objects system up to date
and components
When can a software or system be called matured, needing no further maintenance? IEEE
has given a standard, which answers this question-- the IEEE 962.1 standard, called SMI
(Software Maturity Index). When SMI approaches 1.0, the software is matured and needs no
further maintenance. Let software have Cc, Cr and Cn changed, removed and new objects or
modules, respectively. Let Nc be total objects or modules in its current release. Cc/Nc, Cr/Nc and
Cn /Nc will be the ratios r1, r2 and r3 that reflect the degree of changes, removals and additions
per unit objects (or modules). Therefore SMI = (1– r1- r2 – r3).
Software Engineering Practices …
39
[C+]
§ Embedded systems should be engineered to need minimum post-validation and
delivery maintenance. However, due to improper customer specifications necessitating
corrections, changing conditions, the need for adaptation and the need for improved systems
or system perfection achievement, software maintenance is required. Software with greater
complexity needs greater effort during maintenance. The IEEE 962.1 standard, called SMI
(Software Maturity Index) is used to measure maintenance needs. When SMI approaches
1.0, the software is matured and needs no further maintenance.
SUMMARY
1. Software engineering practices must be followed during the development process of any
software or system.
2. Software complexity gives a quantitative indication of maximum algorithm size and its
reliability and a complexity measure is called Cyclomatic complexity. It is the number
of needed paths that are to be tested. It is also a measure of the difficulties in
maintaining software.
3. The software development process can be represented by lifecycle (also called) or
waterfall or linear incremental model. Analysis, design, implementation and
maintenance are stages of this model. Final product development is by successive
refinements. .
4. There is a choice of seven important models for the process lifecycle. (i) Linear
Sequential Lifecycle Model. (ii) RAD (Rapid Development) Model. (iii) Increment
Development model (iv) Concurrent Development (v) Component based model (vi)
Fourth generation Object and (vii) Oriented Development Model.
5. Requirements analysis is the first step in the software development process. General
statements are first made and then the concrete technical specifications are obtained
from them.
6. Any problem can be modeled as consisting of three domains: information, functional
and behavioral domains. An important approach to a problem is to first divide it into
several parts and then to represent them by suitable notations that describe the problem
essence.
40 Embedded System…
7. Often, it may not possible to completely specify the problem at an early stage.
Prototype development and prototype specifications can frequently help. Even with the
use of the best analyses and models the problems may change. Therefore,
communication between the developer team and the customer is essential so that before
the design process starts both have clear perceptions of the requirements.
8. Analyses of the requirements is done and specifications are obtained for data elements
and structures, algorithms, behavior, data contents and process specifications.
9. The first Designing steps are
a. Abstraction. Each problem component is abstracted first. For example, robotic
system problem abstraction can be in terms of control of arm and motors.
b. Software architectural structural-properties design.
c. Extra functional Properties design.
d. Families of related systems design.
10. Modular Design concepts are used. System designing is decomposed into modules that
are to be implemented. Modules should have the property that allows them to be
composed (coupled or integrated) later. Effective Modular design should ensure (i)
function independence, (ii) cohesion and (iii) coupling.
11. Interface design is also essential to integrate the objects and components.
12. Software design can be assumed to consist of four layers: Architecture design, data
design, interfaces design and component level design. There is a need for continuous
refinements in the designs by effective communication between designers and
implementers.
13. Implemented programs should be simple. The functions should be made general, not
tied to a specific input condition or event. This makes reuse easier. Programs should be
implemented as per program structure design specifications.
14. Goal of testing is to find errors and to validate that the implemented software is as per
the specifications and requirements. Validation means that the software must be
according to the specifications and must show behavior as expected in all the events,
conditions and times specified.
15. Important testing strategies are white box testing, black box testing, specific
environment testing and comparison testing.
16. Debugging is by using breakpoints, macros, and sample outputs from standard inputs,
instruction simulators and laboratory tools.
Software Engineering Practices …
41
17. Real-time systems development process has complex issues. There are software
response-time constraints for the algorithms and ISRs. It must be done for timing
analysis, for IPCs and for the asynchronous event(s) and their sets at each state of the
system. Test for fast occurring events is also done. Testing has to be thorough and tests
for fault tolerances and failure recoveries are also essential.
18. Software project management issues are the management of people, product, process
and project. For planning stage estimation of program efforts, project metrics are
available. One project metrics is the use of function points and use of FFPs (Full
Function Points) to estimate the KLOC (Kilo lines of codes) and productivity per
person-month
19. Maintenance means changes, removal and new additions in the objects or modules after
delivery (or installation in ROM in the case of embedded systems). The maintenance
requirement is inversely proportional to software complexity, as simpler systems need
little maintenance.
20. Embedded systems should be engineered to need least post-validation and delivery
maintenance. Improper customer specifications need correction maintenance. Changing
conditions need adaptation maintenance. Improved system or system perfection
achievement needs software perfection maintenance. Preventive maintenance needs
perfection maintenance. Software with greater complexity needs greater efforts during
maintenance.
21. The IEEE 962.1 standard, called SMI (Software Maturity Index) is used to measure the
need for maintenance. When SMI approaches 1.0, the software is matured and needs no
further maintenance.
20. Modeling domains: Any problem can be modeled as consisting of three domains:
information, functional and behavioral domains.
21. Prototype development: Developing a prototype, which has functions similar to the
final system. For example, first a small laboratory scale robot prototype is developed
and then the industrial level robot.
22. Modular Design: System designing process is decomposed into modules that are to be
implemented. Modules should have the property that allows them to be composed
(coupled or integrated) later. Effective Modular design should ensure (i) function
independence, (ii) cohesion and (iii) coupling
23. Software design layers: Architecture design, data design, interfaces design and
component level design.
24. Architecture Design: Describing the structural units and their behavior and
relationships.
25. Data Design: Design for input and output data elements, structures and databases.
26. Interface design: Design for integrating the objects and components.
27. Software Implementation: Coding the software by using a code-engineering tool
employing a language like C, C++ and Java.
28. Software Testing: To find errors till developed software is verified and validated.
29. Software validation: Validation means that software must be according to the
specifications and must show behavior as expected in all the events, conditions and
times specified, and all components must meet constraints (memory, energy
requirement, and response times of functions, routines and drivers).
30. White box testing: Testing for each program path, each loop and conditions, input
ranges, events, fast occurring events and constraints (memory, energy requirement, and
response times of functions, routines and drivers).
31. Black box testing: Testing for behavior and all functional aspects only.
32. Specific environment testing: Testing for specific environment and components. For
example, keyboard, displays, drivers and ISRs.
33. Comparison testing: Comparison with previously available results.
34. Debugging: Tracing the source of error by using breakpoints, macros, samples outputs
from standard inputs, instruction simulators and laboratory tools.
35. Real time Software: Software with response time constraints for its elements and
components.
36. Asynchronous event: Event occurring at unrelated intervals.
44 Embedded System…
37. Software Maintenance: Maintenance involves changes, removal s and additions in the
objects or modules after delivery.
38. Software People: A team of software engineers or system development engineers.
39. Project management: Managing a project for the development process for a product by
the people (team) and monitoring and coordinating each stage of activities.
40. Software planning: Estimating efforts for a project and developing a suitable strategy
for the development process.
41. Program efforts: Efforts by the people during programming, and it is measured by
project metrics.
42. Function points: A parameter obtained by total counts for a number of function
development parameters like external interfaces, user inputs, user outputs, enquiries and
files. Appropriate weights are given for each by using the previous results for the
software engineering field researchers. Function point is calculated for three types --
simple, average and complex (maximum), to find KLOC form full function points.
43. Full function Points: FFPs (Full Function Points) mean the sum of function points for a
simple, average and complex program.
44. KLOC: Kilo lines of codes.
45. SMI (Software Maturity Index): A measure of the need for maintenance.