Professional Documents
Culture Documents
Ktustudents in
Ktustudents in
Module 4
Programming concepts of Embedded programming – Features
of Embedded C++ and Embedded Java (basics only). Software
Implementation, Testing, Validation and debugging, system-
KTUStudents.in
on- chip.
Assembly language
Assembly Language based development was (is) the most common technique
adopted from the beginning of embedded technology development. Thorough
understanding of the processor architecture, memory organisation, register
sets and mnemonics is very essential for Assembly Language based
development. If you master one processor architecture and its assembly
instructions, you can make the processor as flexible as a gymnast.
Assembly language programming
The Assembly language program written in assembly code is saved as .asm
(Assembly file) file or an .src (source) file. Any text editor like 'notepad' or
'WordPad' from Microsoft@ or the text editor provided by an Integrated
Development (IDE) tool can be used for writing the assembly instructions.
similar to 'C' and other high level language programming, you can have
multiple source files called modules in assembly language programming.
Each module is represented by an .asm' or '.src' file similar to the '.c' files in
C programming.
This approach is known as 'Modular Programming'. Modular programming is
employed when the program is too complex or too big. In 'Modular
Programming', the entire code is divided into submodules and each module is
KTUStudents.in
made re-usable. Modular Programs are usually easy to code, debug and alter.
Conversion of the assembly language to machine language
KTUStudents.in
various object modules in a multi-module project and assigning absolute
address to each module. Linker generates an absolute object module by
extracting the object modules from the library, if any and those obj files
created by the assembler, which is generated by assembling the individual
modules Of a project.
It is the responsibility of the linker to link any external dependent variables
or functions declared on various modules and resolve the external
dependencies among the modules.
Object to Hex File Converter
This is the final stage in the conversion of Assembly language (mnemonics)
to machine understandable language (machine code). Hex File is the
representation of the machine code and the hex file is dumped into the code
memory Of the processor/controller. The hex file representation varies
depending on the target processor/controller make.
Advantages of Assembly Language Based Development
a. Efficient Code Memory and Data Memory Usage (Memory
Optimisation): Since the developer is well versed with the target
processor architecture and memory organization, optimised code can
be written for performing operations. This leads to less utilisation of
code memory and efficient utilisation of data memory. Remember
memory is a primary concern in any embedded product
b. High Performance: Optimised code not only improves the code memory
usage but also improves the total system performance. Through
effective assembly coding, optimum performance can be achieved for a
target application.
c. Low Level Hardware Access: Most of the code for low level
programming like accessing external device specific registers from the
operating system kernel, device drivers, and low level interrupt
routines, etc. are making use of direct assembly coding since low level
device specific operation support is not commonly available with most
of the high-level language cross compilers.
d. Code Reverse Engineering: Reverse engineering is the process of
understanding the technology behind a product by extracting the
information from a finished product. Reverse engineering is performed
by 'hawkers' to reveal the technology behind 'Proprietary Products'.
e. Though most of the products employ code memory protection, if it may
be possible to break the memory protection and read the code memory,
it can easily be converted into assembly code using a dis-assembler
program for the target machine.
f. Assembly codes are sensitive to the processor, memory, ports and
devices. Assembly software gives a precise control of the processor
internal devices, and makes full use of processor-specific features of
processor instruction set and addressing modes.
g. Machine codes are compact, and are processor and memory sensitive.
The system thus needs a smaller memory. No additional memory need
due to data type's selection, conditions, and declarations of rules. A
program is also not compiler specific and library-function specific.
KTUStudents.in
h. Certain codes such as device-driver codes may need only a few
assembly instructions. Assembly codes for these can be compact and
precise, and are conveniently written.
i. Bottom-up-design approach is easily usable. Approach to this way of
designing a program is as follows: First code the basic functional
modules (submodules) and then use these to build a bigger module.
Submodules of the specific and distinct sets of actions are first coded.
Programs for delay, counting, finding time intervals and many
applications can be written. Then the final program is signed by
integrating the modules.
Drawbacks of Assembly Language Based Development
a. High Development Time: Assembly language is much harder to
program than high level languages. The developer must pay attention
to more details and must have thorough knowledge of the architecture
memory organization and register details of the target processor in use.
Learning the inner details Of the processor and its assembly
instructions is highly time consuming and it creates a delay impact in
product development. Also more lines of assembly code are required for
performing an action which can be done with a single instruction in a
high-level language like 'C'.
b. Developer Dependency: There is no common written rule for
developing assembly language based applications whereas all high level
languages instruct certain set of rules for application development.
In assembly language programming, the developers will have the
freedom to choose the different memory location and registers. Also the
KTUStudents.in
extensive cross platform development tool support
The various steps involved in high level language based embedded firmware
development is same as that Of assembly language based development except
that the conversion of source file Written in high level language to object file
is done by a cross-compiler, whereas in Assembly language based
development it is carried out by an assembler.
The various steps in high level language to machine language
The program written in any of the high level language is saved with the
corresponding language extension (.c for C, .cpp for C++ etc). Any text editor
KTUStudents.in
language are the only pre-requisites for high level language based
firmware development.
2. Developer Independency: The syntax used by most of the high level
languages are universal and a program written in the high level
language can easily be understood by a second person knowing the
syntax of the language.
Certain instructions may require little knowledge of the target hardware
details like register set, memory map etc. High level languages always
instruct certain set of rules for writing the code and commenting the
piece of code. If the developer strictly adheres to the rules, the firmware
will be 100% developer independent.
3. Portability: Target applications written in high level languages are
converted to target processor/controller understandable format
(machine codes) by a cross-compiler.
An application written in high level language for a particular target
processor can easily be converted to another target processor/controller
specific application, with little or less effort by simply re-compiling/little
code modification followed by re-compiling the application for the
required target processor/controller, provided, the cross-compiler has
support for the processor/controller selected.
This makes applications written in high level language highly portable.
Little effort may be required in the existing code to replace the target
processor specific header files with new header files, register definitions
with new ones, etc. This is the major flexibility offered by high level
language based design.
4. Program-development cycle is much shorter in high-level language even
for complex systems due to the following: use of (i) routines (procedures)
KTUStudents.in
1. Some cross-compilers available for high level languages may not be so
efficient in generating optimised target processor specific instructions.
2. Target images created by such compilers may be messy and non-
optimised in terms of performance as well as code size.
3. High level language based code snippets may not be efficient in
accessing low level hardware where hardware access timing is critical
(of the order of Nano or micro seconds).
4. The investment required for high level language based development
tools (Integrated Development Environment incorporating cross-
compiler) is high compared to Assembly Language based firmware
development tools.
PROGRAMMING IN EMBEDDED C
Whenever the conventional 'C' Language and its extensions are used for
programming embedded systems, it is referred as 'Embedded C'
programming.
Programming in 'Embedded C' is quite different from conventional Desktop
application development using 'C' language for a particular OS platform.
Desktop computers contain working memory in the range of Megabytes
(Nowadays Giga bytes) and storage memory in the range of Giga bytes. For a
desktop application developer, the resources available are surplus in quantity
and s/he can be very lavish in the usage of RAM and ROM and no restrictions
are imposed at all.
This is not the case for embedded application developers. Almost all embedded
systems are limited in both storage and working memory resources.
KTUStudents.in
Embedded 'C' can be considered as a subset of conventional 'C' language.
Embedded 'C' supports all 'C' instructions and incorporates a few target
processor specific functions/instructions. It should be noted that the
standard ANSI 'C' library implementation is always tailored to the target
processor/controller library files in Embedded C.
The implementation of target processor/controller specific
functions/instructions depends upon the processor/controller as well as the
supported cross-compiler for the particular Embedded 'C' language.
A software program called 'Cross-compiler' is used for the conversion of
programs written in Embedded 'C' to target processor/controller specific
instructions (machine language).
Compiler vs. Cross-Compiler
Compiler is a software tool that converts a source code written in a high level
language on top of a particular operating system running on a specific target
processor architecture. Here the operating system, the compiler program and
the application making use of the source code run on the same target
processor. The source code is converted to the target processor specific
machine instructions.
The development is platform specific (OS as well as target processor on which
the OS is running). Compilers are generally termed as 'Native Compilers'. A
native compiler generates machine code for the same machine (processor) on
which it is running
Cross-compilers are the software tools used in cross-platform development
applications. In cross- platform development, the compiler running on a
particular target processor/OS converts the source code to machine code for
a target processor whose architecture and instruction set is different from the
processor on which the compiler is running or for an operating system which
is different from the current development environment OS.
Embedded system development is a typical example for cross- platform
development where embedded firmware is developed on a machine with
Intel/AMD or any Other target processors and the same is converted into
machine code for any other target processor architecture (e.g. 8051, PIC, ARM
etc). Keil C51 is an example for cross-compiler. The term 'Compiler' is used
interchangeably with 'Cross-compiler' in embedded firmware applications.
Whenever you see the term 'Compiler' related to any embedded firmware
application, please understand that it is referring the cross-compiler.
Embedded C programing
Keywords and identifiers:
Keywords are the reserved names used by the 'C' language. All keywords have
a fixed meaning in the 'C' language context and they are not allowed for
programmers for naming their own variables or functions. ANSI 'C' supports
32 keywords and they are listed below. All 'C' supported keywords should be
written in 'lowercase' letters.
KTUStudents.in
Identifiers are user defined names and labels. Identifiers can contain letters
of English alphabet (both upper and lower case) and numbers. The starting
character of an identifier should be a letter. The only special character allowed
in identifier is underscore.
Data Types:
Data type represents the type of data held by a variable. It should be noted
that the storage size may vary for data type depending on the cross-compiler
in use for embedded applications.
Since memory is a big constraint in embedded applications, select the
optimum data type for a variable. For example if the variable is expected to be
within the range 0 to 255, declare the same as an 'unsigned char' or 'unsigned
short int' data type instead of declaring it as 'int' or 'unsigned int'. This will
definitely save considerable amount of memory.
Storage Class:
KTUStudents.in
Keywords related to storage class provide information on the scope (visibility
or accessibility) and life time (existence) of a variable. 'C' supports four types
of storage classes and they are listed below.
Arithmetic Operations:
The list of arithmetic operators supported by 'C' are listed below
Logical Operations:
Logical operations are usually performed for decision making and Program
control transfer. The list of logical operations supported by 'C' are listed below.
Relational Operations :
Relational operations are normally performed for decision making and
program control transfer on the basis of comparison. Relational operations
supported by 'C' are listed below.
KTUStudents.in
Branching Instructions:
Branching instructions change the program execution flow conditionally or
unconditionally. Conditional branching depends on certain conditions and if
the conditions are met, the program execution is diverted accordingly.
Unconditional branching instructions divert program execution
unconditionally. Commonly used conditional branching instructions are
listed below
KTUStudents.in
Looping Instructions:
Looping instructions are used for executing a particular block of code
repeatedly till a condition is met or wait till an event is fired. Embedded
programming often uses the looping instructions for checking the status of
certain I/o ports, registers, etc. and also for producing delays.
Certain devices allow write/read operations to and from some registers of the
device only when the device is ready and the device ready is normally
indicated by a status register or by Setting/clearing certain bits of status
registers.
Hence the program should keep on reading the status register till the device
KTUStudents.in
ready indication comes. The reading operation forms a loop. The looping
instructions supported by 'C' are listed below.
KTUStudents.in
Definitions for pre-processor global variables (global means all
throughout the program module)
Definitions of constants
Declarations for global data types, type declaration and data structures,
macros and functions.
Include Directive for the Inclusion of Files
Include is a pre-processor directive to include the contents (codes or data) of
a file. Inclusion of all files and specific header files has to be as per
requirements. A 'C' program first includes the header and source files. These
are readily available files. The purpose Of each included file is mentioned in
the comments within the /* and */ symbols as per practice in 'C'.
including Codes Files :These are the files for the codes already available.
For example, #include "prct1Handlers. c . /* Include file for the codes for
handling and actions as per the protocols used for driving streams to the
network. */
including Constant Data Files: These are the files for the codes and may have
the extension ' .const'.
Including Strings Data Files These are the files for the strings and may have
the extension '.strings' or '.str.' or '.txt.
Including Initial Data Files :Initial or default data files are for locating in ROM
of embedded system. Boot-up program is copied later into RAM and has
extension, '.init'. On the other hand, data files have the extension, .'data'.
Including Basic Variables Files: Files for the local or global static variables
are stored in RAM. These basic variables are stored in the files with the
extension '.bss'.
Including Header Files :It is a pre-processor directive. It includes the contents
(codes or data of a set of source files. These are files for specific modules. A
header file has the extension '.h'. Example # include "vxWorks.h"/* Include
VxWorks functions * /
Source Files
source files are program files for the functions of application software. The
source files need to be compiled, tested and validated. A source file also
possesses the pre-processor directives of application software. The file has the
first function (main function) from where the processing will start. The code
in C for first function is void main ( ). The main function calls other functions.
Configuration Files
configuration files are the files for the configuration of a subsystem. Device
configuration codes can be put in a file of basic variables and included when
needed. If these codes are in the file "serial Line_ cfg. h", then # include
"serialLine __ cfg.h " will be pre-processor directive.
Pre-processor Directives
KTUStudents.in
A pre-processor directive starts with a sharp (hash) sign. These commands
are for the following directives to the compiler for processing. Pre-processor
Global Variables For example, in a program "# define time pre-processor
Constants "# define false 0" is a pre-processor directive in an example. It
means it is a directive before processing to assume 'false' as 0
program elements: macros and functions
pre-processor Macros A macro is a collection of codes that is defined in a
program by a name. It differs from a function in the sense that once a macro
is defined by a name, the compiler puts the corresponding codes for it at every
place wherever that macro name appears.
Example : Consider two macros, 'enable_ Maskable _ Intr ( ) ' and disable
Maskable_ Intr ( ) ' (The pair of brackets in the macro is optional. If it is
present, it improves readability as it distinguishes a macro from a constant).
Whenever the name enable Mask able Intr appears, the compiler places the
codes designed for it.
How does a macro differ from a function?
The codes for a function are compiled only once. Processor has to save the
context on calling that function, and on return, processor restores the
context. Further, a function may return nothing (void declaration case) or
return a Boolean value, an integer, or any primitive or reference type of data.
Primitive means similar to an integer or character. Reference type means
similar to an array or structure.
The codes for Macro are compiled in every function wherever that macro name
is used, Compiler, before compilation, puts the codes at the places wherever
the macro is used. When a macro runs in a function, the processor does not
save the context, and thus does not have to restore the context, as there is no
return in macro.
Macros are used for short codes only. This is because, if a function call is
used for short codes instead of macro, the overheads (context saving and other
actions on function call and return) take additional time T overheads ,The
time is the same order of magnitude as the time .T exec , for execution
overheads of short codes within a function. We use a function for codes when
the T overheads <<T exec macro for codes when T overheads >> T exec.
PROGRAM ELEMENTS: DATA TYPES, DATA STRUCTURES, MODIFIERS,
STATEMENTS, LOOPS AND POINTERS
Use of Data Types: Whenever data is named using an identifier, it will have
the address(es) allocated at the memory. Number of allocated addresses for
data depends upon data type
Use of Modifiers: A modifier modifies the actions of a data type.
Use of Pointers and Null Pointers: Pointers are powerful tools when used
correctly and according to certain basic principles. A Pointer is a reference to
KTUStudents.in
a starting memory address. A pointer can refer to a variable, data structure
or function.
In the 'C' language, symbol * is used before a pointer. For example, unsigned
char * Ox 1000 means a character of 8 bit at the address Oxl000. A NULL
pointer declares the following: ' #define NULL (void*) Ox0000'.
Use of Data Structures: Stack, Queue, Array, List, Tree, Pipe, Table and
Hash Table
A data structure is a way of organising several data elements of same types
or different types. A data in a data structure can then be identified and
accessed with the help of a few pointers and/or indices and/ or functions.
A data structure is an important element of any program. A data structure
saves a set of memory addresses in an organized way. Any data structure
element can be retrieved. Few important data structures are stack, one-
dimensional array, queue, circular queue, pipe, a table (two-dimensional
array), lookup table, hash table and list.
Stack: It is a structure with a series of elements with its last element waiting
for an operation. An operation can be done only in the last in first out (LIFO)
mode. An element can be pushed (inserted) only at the top in the series of
elements and is still waiting for an operation.
There is only one pointer used for pop (deleting) after the operation as well as
for push (inserting). A pointer which points to stack top is needed for handling
each stack. It is called SP (Stack Pointer) or Stop which points to the top of
the stack and changes on each push or pop.
KTUStudents.in
List: A list is for nonconsecutively located objects at the memory. A list is a
data structure with a set of number of distinct sets of memory addresses, one
for each element.
A list has a top (head) pointer for the memory address from where the list
starts. Each list element at the memory also stores a pointer to the next
element at next set of addresses. The last element in the list points to null.
A table: is a two-dimensional array (matrix). It is an important data set in
memory block. There is always a base pointer for a table. The base points to
its first element at the first column, first row. There are two indices, one for a
row and the other for a column Look-up Table and Hash Table.
OBJECTED-ORIENTED PROGRAMMING
When a large program is made, an object-oriented language offers many
advantages. An Objected Oriented Programming (OOP) language provides for
the followings:
defining of an object or set of objects, which are common or similar
objects within a program and between many programs,
defining the methods that manipulate the objects without modifying
their definitions,
creation of multiple instances of the defined object or set of objects or
new objects,
inheritance,
data encapsulation, and design of reusable components
An object can be characterized by the following.
KTUStudents.in
Programming concepts for embedded programming in C++ are as follows:
A class binds all the member functions together for creating objects. The objects will
have memory allocation as well as default assignments to its variables that are not
declared static.
A class can derive (inherit) from another class also. Creating a child class from a parent
class creates a new application
Methods (C functions) can have same name in the inherited class. This
is called method overloading. Methods can have the same name as well
as the same number and type of arguments in the inherited class. This
is called method overriding. These are the two significant features that
are extremely useful in a large program.
Operators in can be overloaded like in method overloading
There is struct that binds all the member functions together in C. But
a C++ class has object features. It can be extended and child classes
can be derived from it.A number of child classes can be derived from a
common class. This feature is called polymorphism.A class can be
declared as public or private.
The data and methods access is restricted when a class is declared
private. Struct does not have these features.
Embedded system programmers use C++ due to the OOP features of software
re-usability, extendibility, polymorphism, function overriding and overloading
along with the portability with the C codes and in-line assembly codes. also
provides for overloading of operators.
Embedded C++ is a C++ version, which makes large program development
simpler by providing Object-Oriented Programming (OOP) features of using
an object, which binds state and behavior and which is defined by an instance
of a class. We use objects in a way that minimises memory needs and run-
time overheads in the system
Advantages of C++
1. C++is an Object-Oriented Program (OOP) language, which in addition,
supports the procedure oriented codes of C.
2. Program coding in C++ codes provides the advantage of objected-
oriented programming as well as the advantage of C and in-line
assembly.
Disadvantages of C++
The program codes become lengthy, particularly when certain features of the
standard C++ are used.
Examples of these features are as follows:
(a) Template (b) Multiple Inheritance (Deriving a class from many parents) (c)
Exceptional handling (d) Virtual base classes (e) Classes for I/O Streams ( Two
library functions are cin (for character (s) in) and cout (for character (s) out)).
The I/O stream class library provides for the input and output streams of
characters
KTUStudents.in
EMBEDDED PROGRAMMING IN JAVA
Java programming starts from coding for the classes. A class has members.
A field is like a variable or struct in 'C'. A method defines the operations on
the fields, similar to function in 'C‘. Class is a named set of codes that has a
number of members such as data fields (variables), and methods (functions).
Class is used to create objects with instances of these members. The
operations are done on the objects by passing the messages to the objects in
object-oriented programming. Each class is a logical group with an identity, a
state and a behavior specification.
Java program elements
1. Local Variable: A variable within a block of codes that is defined inside
the curly braces and has limited scope.
2. Instance Method: Blocks of Java codes, which are given a name, a call
(invocation) is made by other Java codes that can also pass (transmit)
the needed reference to the values, parameters, etc.
3. Instance Field: An identifier with a name using which, a declaration is
made in a Java class. It does have a default value and the field is also
present in the objects which are instances of the class.
4. Class: a class is a basic structural unit in a Java program. A class
consists of data fields and methods that operate on the fields. A class
is a group of objects with similar attributes and common behavior and
relationships. A class is used to create objects as its instances.
5. Inheritance: Java Class inherits members when a Java class is
extended from a parent class called super class. The inherited instance
fields and methods can be overridden by redefining them in extended
KTUStudents.in
4. Java has in-built support for creating multiple threads. It obviates the
need for an operating system based scheduler for handling the task
5. Java generates the byte codes. These are executed on an installed JVM
(Java Virtual Machine) on a machine. Virtual machine takes the Java
byte codes in the input and runs on the given platform (processor,
system and OS ); virtual Machine (VM) in embedded systems is stored
at the ROM. Therefore, Java codes can host on diverse platforms.
Platform independence in hosting the compiled code permit java for
N/W applications.
6. Platform independence gives portability with respect to the processor
and the OS used. Java is considered as write once and run anywhere.
7. Java is the language for most Web applications and allows machines
of different types to communicate on the Web.
8. Java is easier to learn by C++ programmer.
9. Java does not permit pointer manipulation instructions. So it is robust
in the sense that memory leaks and memory related errors do not occur.
10. Java
does not permit dual way of object manipulation by value and reference.
There are no struc, enum, typedef and union.
11. Java
does not permit multiple inheritances and operator overloading, except
for + sign used for string concatenation
Java objects bind state and behavior by the instance of a Java class. Java
has large number Of readily available classes for the I/O stream, network and
security. Object-oriented features and ready availability of classes make a
KTUStudents.in
software development
process.
ISO/IEC 12207 is an international standard for software life-cycle
processes. It aims to be
the standard that defines all the tasks required for developing and
maintaining software.
SDLC is a process followed for a software project, within a software
organization. It consists of a detailed plan describing how to develop,
maintain, replace and alter or enhance specific software. The life cycle defines
a methodology for improving the quality of software and the overall
development process.
customer, the sales department, market surveys and domain experts in the
industry. This information is then used to plan the basic project approach
and to conduct product feasibility study in the economical, operational and
technical areas. Planning for the quality assurance requirements and
identification of the risks associated with the project is also done in the
planning stage. The outcome of the technical feasibility study is to define the
various technical approaches that can be followed to implement the project
successfully with minimum risks.
Defining Requirements
Once the requirement analysis is done the next step is to clearly define and
document the product requirements and get them approved from the
customer or the market analysts. This is done through an SRS (Software
Requirement Specification) document which consists of all the product
requirements to be designed and developed during the project life cycle.
Designing the Product Architecture
SRS is the reference for product architects to come out with the best
architecture for the product to be developed. Based on the requirements
specified in SRS, usually more than one design approach for the product
architecture is proposed and documented in a DDS - Design Document
Specification. This DDS is reviewed by all the important stakeholders and
KTUStudents.in
based on various parameters as risk assessment, product robustness, design
modularity, budget and time constraints, the best design approach is selected
for the product.
A design approach clearly defines all the architectural modules of the product
along with its communication and data flow representation with the external
and third party modules (if any). The internal design of all the modules of the
proposed architecture should be clearly defined with the minutest of the
details in DDS.
Building or Developing the Product
In this stage of SDLC the actual development starts and the product is built.
The programming code is generated as per DDS during this stage. If the design
is performed in a detailed and organized manner, code generation can be
accomplished without much hassle. Developers must follow the coding
guidelines defined by their organization and programming tools like
compilers, interpreters, debuggers, etc. are used to generate the code.
Different high level programming languages such as C, C++, Pascal, Java and
PHP are used for coding. The programming language is chosen with respect
to the type of software being developed.
Testing the Product
This stage is usually a subset of all the stages as in the modern SDLC models,
the testing activities are mostly involved in all the stages of SDLC. However,
this stage refers to the testing only stage of the product where product defects
are reported, tracked, fixed and retested, until the product reaches the quality
standards defined in the SRS.
KTUStudents.in
Each of these stages have a definite Entry and Exit criteria; , Activities &
Deliverables associated with it.
Entry Criteria: Entry Criteria gives the prerequisite items that must be
completed before testing can begin.
Exit Criteria: Exit Criteria defines the items that must be completed before
testing can be concluded
Requirement Analysis
During this phase, test team studies the requirements from a testing point of
view to identify the testable requirements. The QA team may interact with
various stakeholders (Client, Business Analyst, Technical Leads, System
Architects etc) to understand the requirements in detail. Requirements could
be either Functional (defining what the software must do) or Non Functional
(defining system performance /security availability) .Automation feasibility for
the given testing project is also done in this stage.
Activities
KTUStudents.in
This phase involves creation, verification and rework of test cases & test
scripts. Test data , is identified/created and is reviewed and then reworked
as well.
Activities
Test Execution
During this phase the testers will carry out the testing based on the test plans
and the test cases prepared. Bugs will be reported back to the development
team for correction and retesting will be performed.
Activities
KTUStudents.in
Business Objectives, Quality
Prepare test metrics based on the above parameters.
Document the learning out of the project
Prepare Test closure report
Qualitative and quantitative reporting of quality of the work product to
the customer.
Test result analysis to find out the defect distribution by type and
severity.
Type of testing strategies
1. Black-Box Testing
The technique of testing without having any knowledge of the interior
workings of the application is called black-box testing. The tester is oblivious
to the system architecture and does not have access to the source code.
Typically, while performing a black-box test, a tester will interact with the
system's user interface by providing inputs and examining outputs without
knowing how and where the inputs are worked upon.The following table lists
the advantages and disadvantages of black-box testing.
Advantages
2. White-Box Testing
White-box testing is the detailed investigation of internal logic and structure
of the code. White-box testing is also called glass testing or open-box testing.
In order to perform white-box testing on an application, a tester needs to know
the internal workings of the code. The tester needs to have a look inside the
source code and find out which unit/chunk of the code is behaving
inappropriately.
KTUStudents.in
The following table lists the advantages and disadvantages of white-box
testing.
Advantages
As the tester has knowledge of the source code, it becomes very easy to
find out which type of data can help in testing the application effectively.
It helps in optimizing the code.
Extra lines of code can be removed which can bring in hidden defects.
Due to the tester's knowledge about the code, maximum coverage is
attained during test scenario writing.
Disadvantages
Due to the fact that a skilled tester is needed to perform white-box
testing, the costs are increased.
Sometimes it is impossible to look into every nook and corner to find
out hidden errors that may create problems, as many paths will go
untested.
It is difficult to maintain white-box testing, as it requires specialized
tools like code analyzers and debugging tools.
3. Grey-Box Testing
Grey-box testing is a technique to test the application with having a limited
knowledge of the internal workings of an application. In software testing, the
phrase the more you know, the better carries a lot of weight while testing an
application.
Mastering the domain of a system always gives the tester an edge over
someone with limited domain knowledge. Unlike black-box testing, where the
tester only tests the application's user interface; in grey-box testing, the tester
has access to design documents and the database. Having this knowledge, a
tester can prepare better test data and test scenarios while making a test plan.
Advantages
KTUStudents.in
The tests can be redundant if the software designer has already run a
test case.
Testing every possible input stream is unrealistic because it would take
an unreasonable amount of time; therefore, many program paths will
go untested.
The following table lists the points that differentiate black-box testing, grey-
box testing, and white-box testing.
KTUStudents.in
Design for Testability
An embedded system developer needs to design for Hardware as well as
Software Testability. Hardware Testability means provisioning of input ports
and output ports during designing such that the Hardware can be tested for
any fault in assembly. The developer considers software testability of the
software components and requirements
Testability is a degree to which it is possible to control and observe the states
and output of a component during testing. Software Testability means a
design such that it should be possible to test a system using the sets of data
or automate the test of the component under test.
Assert Macro: Use of assert macros is a method to incorporate testability in a
system. A macro is inserted to assert certain conditions so that effect or
output can be tested. The use of an assert macro is an important test
technique. We can use the assert macro at different critical places in the
application program.
Design of Self-Test: Self-test means that a system performs the tests for all
the functions expected on its own. The developer writes self-tests. A self-test
enables to test the specified functions of a system.
Testing on Host Machine
The system embeds three types of codes such as
l. Host-dependent
2. Target-independent
3. Target-dependent codes.
Following figure shows the test system in a development process, which
consists of host and target Hardware systems.
KTUStudents.in
We have two computing systems such as host and target. Each has a distinct
CPU or microcontroller. Hardware architecture of each is also distinct. The
host is generally a workstation, PC or laptop. The target is actual Hardware
for the embedded system, which is in the development phase. dependent
codes and test systems in a development process. Testing and debugging are
required at each stage as well as at the final stage when the modules integrate
together. Initial stage tests are done on the host machine. The developer tests
hardware-independent codes on a host machine. A simulator is then run on
the host. codes have two parts
l. Hardware-independent codes.
2. Hardware-dependent codes.
DEBUGGING
Debugging is the process of checking the errors and correcting those errors.
Software debugging can be done by compiling and executing the code on a PC
or workstation. Debugging can be performed in two sides, one is the software
side and another one is the Hardware side for both sides many debugging
tools are involved.
KTUStudents.in
be used. Hardware tools clearly mention what is happening in the system and
when the system is running. As like software tolls it has the following tools.
I. Microprocessor In- Circuit Emulator (ICE)
2. Logic Analyzer
Microprocessor In-Circuit Emulator
The Microprocessor in circuit emulator is a specialized Hardware tool that can
help debug software in a working embedded system. In circuit emulator is a
special version of the microprocessor that has internal registers it will be read
out when it is stopped. The CPU provides as much debugging functionality
without any memory utilization.
Drawbacks
l. In- circuit emulator machine is must specific to a particular microprocessor.
2. Several microprocessors used means maintaining a fleet of in-circuit
emulators can be very expensive.
Logic Analyzer
The logic analyzer can sample many different signals simultaneously but can
display only 0, 1 or changing values for each. The logic analyzer records the
values on the into an internal memory and then displays the results on a
display once the memory is full or the run is aborted.
The logic Analyzer can capture thousands or even millions of samples of data
on all of these channels and providing a much larger time window into the
KTUStudents.in
components. But it gives a very good view of the externally visible signals, that
information can be used for both Functional and timing debugging.
DEBUGGING CHALLENGES
Logical errors in software can be hard to track down and it will create
many problems in real time code.
Real Time programs are required to finish their work within a certain
amount of time.
Real time programs run too long means -it creates very unexpected
behavior.
The exact results of missing real time deadlines is it depends on the
detailed characteristics of the I/O devices.
Missing of deadline makes debugging process as difficult.
DEBUGGING TECHNIQUES
Simulator
A simulator helps in the development of the system before the final target
system is ready with only a PC as the tool for development. Simulators are
readily available for different processors and processing devices employing
embedded systems. System designer and /or developer need not code for the
simulator for application software and hardware development in the design
laboratory.
The simulator uses knowledge of target processor or microcontroller, and
target system architecture on the host processor. The simulator first does
cross complication of the codes and places these into the host-system RAM.
The behavior of processor registers in a target system is also simulated in the
RAM. The simulator software also simulates hardware units like emulator,
peripherals, network and input-output devices on a host. A simulator remains
independent of a particular target system. It is useful during the development
phase for, application software for the system that is expected to employ a
particular processor, microcontroller or device.
Simulator Features:
It defines the processor or processing device family as well as its various
versions for the target system. It monitors the detailed information of a source
code part with labels and symbolic arguments as the execution goes on for
each single step. It provides the detailed information of the status of RAM and
ports Of the defined target system as the execution goes on for each single
step. It provides the detailed information of the status of peripheral devices
with the defined system.
It helps the window on the screen to provide the detailed meaning Of the
present command. It supports the conditions and unconditional break points.
It facilitates synchronizing the internal peripherals and delays. It provides a
network driver and device-driver support. It employs an RTOS scheduler that
preempts tasks.
Validation
KTUStudents.in
The process of evaluating software during the development process or at the
end of the development process to determine whether it satisfies specified
business requirements.
Validation Testing ensures that the product actually meets the client's needs.
It can also be defined as to demonstrate that the product fulfils its intended
use when deployed on appropriate environment.
Unit Testing :A level of the software testing process where individual units of
software are tested. The purpose is to validate that each unit of the software
performs as designed.
Integration Testing: A level of the software testing process where individual
KTUStudents.in
units are combined and tested as a group. The purpose of this level of testing
is to expose faults in the interaction between integrated units.
System Testing : A level of the software testing process where a complete,
integrated system is tested. The purpose of this test is to evaluate the system’s
compliance with the specified requirements.
Acceptance Testing: A level of the software testing process where a system
is tested for acceptability. The purpose of this test is to evaluate the system’s
compliance with the business requirements and assess whether it is
acceptable for delivery.
SYSTEM-ON-CHIP (SOC)
There are two approaches to design an embedded system such as
1. Using System-on-Chip (SOC)
2. Using chips on a circuit Board (COB)
System-on-chip approach is used for extensively used systems, for example,
mobile phone and cameras.
In chips on. a circuit board approach, separate chips for the microprocessor
or ASIP, memory, single-purpose processors and peripherals are
interconnected on a board.
All chips interface with an appropriate circuit. The chips interconnect on a
board and software embeds into memory in a chip.
KTUStudents.in
9. Other logic circuits and Analog units.
Advantages of SOC:
The system has very high performance, functionalities and very low power
dissipation. Therefore, SoCs are used in Embedded systems, which are
extensively and commonly used, need the small size, high system
performance, much functionality, very low power dissipation and have low
energy consumption. Examples of extensively used systems are mobile
phones, tablets, personal computers, Set-top boxes, digital TVs and cameras.